darkstat
2 years agoExport host statistics in prometheus text format on /metrics. master
Peter Ward [Wed, 15 Mar 2017 03:55:09 +0000 (14:55 +1100)]
Export host statistics in prometheus text format on /metrics.

3 years agoRemove dead code after call to dns_main().
Emil Mikulic [Thu, 1 Sep 2016 07:51:50 +0000 (17:51 +1000)]
Remove dead code after call to dns_main().

Reported by: David Binderman
Found with: cppcheck --enable=style

3 years agoCheck bounds before using index.
Emil Mikulic [Thu, 1 Sep 2016 07:49:06 +0000 (17:49 +1000)]
Check bounds before using index.

Reported by: David Binderman
Found with: cppcheck --enable=style

3 years agoUse :nth-child selector instead of css class to colorize tables.
Emil Mikulic [Mon, 28 Mar 2016 04:08:11 +0000 (15:08 +1100)]
Use :nth-child selector instead of css class to colorize tables.

Suggested by: Daniel Aleksandersen https://www.daniel.priv.no/

3 years agoUpdate scan-build call.
Emil Mikulic [Mon, 28 Mar 2016 03:50:18 +0000 (14:50 +1100)]
Update scan-build call.

3 years agochdir("/") immediately after chroot()
Emil Mikulic [Mon, 28 Mar 2016 03:45:19 +0000 (14:45 +1100)]
chdir("/") immediately after chroot()

Suggested by clang static analyzer.

3 years agoRemove un-needed include.
Emil Mikulic [Mon, 28 Mar 2016 03:25:21 +0000 (14:25 +1100)]
Remove un-needed include.

3 years agoConstify static content.
Emil Mikulic [Mon, 28 Mar 2016 03:22:36 +0000 (14:22 +1100)]
Constify static content.

This moves it from data pages to text pages.

3 years agoMake static the options not in opt.h
Emil Mikulic [Mon, 28 Mar 2016 02:33:47 +0000 (13:33 +1100)]
Make static the options not in opt.h

3 years agoSuppress noisy reserved-id-macro warning.
Emil Mikulic [Mon, 28 Mar 2016 02:31:52 +0000 (13:31 +1100)]
Suppress noisy reserved-id-macro warning.

3 years agoServe favicon over http.
Emil Mikulic [Mon, 28 Mar 2016 02:24:35 +0000 (13:24 +1100)]
Serve favicon over http.

3 years agoAdd favicon for darkstat.
Emil Mikulic [Sun, 27 Mar 2016 08:32:23 +0000 (19:32 +1100)]
Add favicon for darkstat.

Contributed by: Daniel Aleksandersen https://www.daniel.priv.no/

4 years agoAllow mobile users to zoom out.
Emil Mikulic [Mon, 23 Nov 2015 04:45:24 +0000 (15:45 +1100)]
Allow mobile users to zoom out.

Suggested by: Dallen Wilson

4 years agoImprove graphs page display on mobile devices.
Dallen Wilson [Wed, 11 Nov 2015 22:00:26 +0000 (15:00 -0700)]
Improve graphs page display on mobile devices.

This has little to no effect on a desktop browser, but on a mobile browser, it
will automatically fit the page to the browser window, without the user having
to manually zoom or scroll left or right to see everything. This results in the
graphs being arranged in a single column, rather then a 2x2 grid, which is also
what happens on my desktop when I make the browser window narrower.

4 years agoUpdate example URL for FreeBSD port update.
Emil Mikulic [Sat, 30 May 2015 01:28:40 +0000 (11:28 +1000)]
Update example URL for FreeBSD port update.

4 years agoAdjust date in ChangeLog. 3.0.719
Emil Mikulic [Sun, 24 May 2015 07:39:38 +0000 (17:39 +1000)]
Adjust date in ChangeLog.

4 years agoUpdate portability notes.
Emil Mikulic [Sat, 27 Dec 2014 15:35:17 +0000 (02:35 +1100)]
Update portability notes.

4 years agoFix the build on Debian GNU/Hurd.
Emil Mikulic [Sat, 27 Dec 2014 15:27:13 +0000 (02:27 +1100)]
Fix the build on Debian GNU/Hurd.

4 years agoconfigure: give better zlib advice for Debian.
Emil Mikulic [Sat, 27 Dec 2014 15:20:03 +0000 (02:20 +1100)]
configure: give better zlib advice for Debian.

4 years agoCall setgroups() before setgid() to drop supplementary groups.
Emil Mikulic [Sat, 27 Dec 2014 13:58:00 +0000 (00:58 +1100)]
Call setgroups() before setgid() to drop supplementary groups.

Pointed out to me by: Pavel Alexeev
Caught by rpmlint

See also: https://www.securecoding.cert.org/confluence/display/seccode/POS36-C.+Observe+correct+revocation+order+while+relinquishing+privileges

4 years agoRebuild deps.
Emil Mikulic [Sat, 27 Dec 2014 13:20:40 +0000 (00:20 +1100)]
Rebuild deps.

4 years agoUpdate ChangeLog for 3.0.719.
Emil Mikulic [Sat, 27 Dec 2014 13:18:43 +0000 (00:18 +1100)]
Update ChangeLog for 3.0.719.

4 years agoOCD: add space to bottom of host detail page.
Emil Mikulic [Sat, 27 Dec 2014 13:06:15 +0000 (00:06 +1100)]
OCD: add space to bottom of host detail page.

4 years agoImplement tracking of remote ports.
Emil Mikulic [Sat, 27 Dec 2014 13:04:52 +0000 (00:04 +1100)]
Implement tracking of remote ports.

4 years agoPretty sure show-dep isn't needed, also add vim modeline.
Emil Mikulic [Sat, 27 Dec 2014 11:53:07 +0000 (22:53 +1100)]
Pretty sure show-dep isn't needed, also add vim modeline.

4 years ago-D__OPTIMIZE__ comes from -O anyway.
Emil Mikulic [Sat, 27 Dec 2014 11:50:02 +0000 (22:50 +1100)]
-D__OPTIMIZE__ comes from -O anyway.

4 years agotest_headers.sh: handle the "#define restrict" bit in config.h
Emil Mikulic [Sat, 27 Dec 2014 11:48:06 +0000 (22:48 +1100)]
test_headers.sh: handle the "#define restrict" bit in config.h

4 years agoChange the default ports_max to twice ports_keep.
Emil Mikulic [Sat, 27 Dec 2014 09:44:40 +0000 (20:44 +1100)]
Change the default ports_max to twice ports_keep.

4 years agoStop using inline, get restrict from autoconf.
Emil Mikulic [Sat, 27 Dec 2014 09:38:59 +0000 (20:38 +1100)]
Stop using inline, get restrict from autoconf.

4 years agoFree lists of cmdline args in the DNS child.
Emil Mikulic [Sat, 27 Dec 2014 09:27:54 +0000 (20:27 +1100)]
Free lists of cmdline args in the DNS child.

This is a tiny amount of memory but it brings us closer to being valgrind clean.

4 years agoAdd sanitizer and valgrind hints for development.
Emil Mikulic [Sat, 27 Dec 2014 09:19:41 +0000 (20:19 +1100)]
Add sanitizer and valgrind hints for development.

4 years agoAccount for all IP protocols.
Emil Mikulic [Sat, 27 Dec 2014 09:04:31 +0000 (20:04 +1100)]
Account for all IP protocols.

4 years agoMake SIGUSR1 reset reported time and counters.
Emil Mikulic [Sat, 27 Dec 2014 08:47:00 +0000 (19:47 +1100)]
Make SIGUSR1 reset reported time and counters.

4 years agoUse labs(long).
Emil Mikulic [Sat, 27 Dec 2014 08:19:18 +0000 (19:19 +1100)]
Use labs(long).

5 years agoFix use-after-free in http_stop().
Emil Mikulic [Sun, 7 Dec 2014 09:56:43 +0000 (20:56 +1100)]
Fix use-after-free in http_stop().

5 years agoCorrectly show "last seen: never" on the host details page.
Emil Mikulic [Sun, 7 Dec 2014 09:51:24 +0000 (20:51 +1100)]
Correctly show "last seen: never" on the host details page.

5 years agoFix "clock error" due to machine reboot.
Emil Mikulic [Sun, 7 Dec 2014 06:37:38 +0000 (17:37 +1100)]
Fix "clock error" due to machine reboot.

Treat per-host last_seen_mono as a signed integer which can go negative
if the host was last seen before reboot (or whatever corresponds to t=0
on the monotonic clock)

5 years agoIndent, no functional change.
Emil Mikulic [Sun, 7 Dec 2014 06:19:03 +0000 (17:19 +1100)]
Indent, no functional change.

5 years agoUpdate export-format.txt to match hosts_db.c
Emil Mikulic [Sun, 7 Dec 2014 05:59:09 +0000 (16:59 +1100)]
Update export-format.txt to match hosts_db.c

last_seen is stored before the MAC address.

Pointed out by: Trond Endrestol

5 years agoWebsite URL: http -> https
Emil Mikulic [Sun, 7 Dec 2014 05:41:27 +0000 (16:41 +1100)]
Website URL: http -> https

5 years agoAdd README.git notes.
Emil Mikulic [Sun, 7 Dec 2014 05:40:27 +0000 (16:40 +1100)]
Add README.git notes.

5 years agoTurn two unreachable statements into errx().
Emil Mikulic [Sun, 7 Dec 2014 05:36:01 +0000 (16:36 +1100)]
Turn two unreachable statements into errx().

5 years agoExit (instead of busy-loop) when the interface goes down.
Emil Mikulic [Sun, 7 Dec 2014 05:12:15 +0000 (16:12 +1100)]
Exit (instead of busy-loop) when the interface goes down.

5 years agoUpdate COPYING.GPL
Emil Mikulic [Fri, 14 Mar 2014 10:56:38 +0000 (21:56 +1100)]
Update COPYING.GPL

The new one is taken from http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
and has an updated street address for the Free Software Foundation, Inc.

www.gnu.org says: Last-Modified: Tue, 23 Mar 2010 23:34:05 GMT

Reported by: Pavel Alexeev <pahan@hubbitus.info>
Found with: rpmlint

5 years agoUpdate ChangeLog for 3.0.718. 3.0.718
Emil Mikulic [Sat, 25 Jan 2014 11:30:56 +0000 (22:30 +1100)]
Update ChangeLog for 3.0.718.

5 years agoBump copyright years.
Emil Mikulic [Sat, 25 Jan 2014 11:13:39 +0000 (22:13 +1100)]
Bump copyright years.

5 years agocontrib/darkstat_export converts the binary export (.db file) into .csv format.
Jürgen Kahrs MediaMobil [Sat, 25 Jan 2014 10:55:40 +0000 (21:55 +1100)]
contrib/darkstat_export converts the binary export (.db file) into .csv format.

5 years agoDon't chroot() by default.
Emil Mikulic [Sat, 25 Jan 2014 10:51:42 +0000 (21:51 +1100)]
Don't chroot() by default.

Don't detect default chroot dir in the configure script.

The motivation behind this is to no longer fail to configure when /var/empty
doesn't exist, which is the case on most distros.

5 years agoHint on how to view the manpage.
Emil Mikulic [Sat, 25 Jan 2014 10:34:51 +0000 (21:34 +1100)]
Hint on how to view the manpage.

5 years agoMake base url optional.
Emil Mikulic [Sat, 25 Jan 2014 10:25:01 +0000 (21:25 +1100)]
Make base url optional.

Requested by: Lonnie Abelbeck

5 years agoBring back the --base functionality.
Emil Mikulic [Sat, 25 Jan 2014 10:04:25 +0000 (21:04 +1100)]
Bring back the --base functionality.

This is mostly a rollback of "Replace the --base code with relative paths."
except we keep the relative paths.

Requested by: Lonnie Abelbeck

5 years agoUse llu.
Emil Mikulic [Sat, 25 Jan 2014 09:36:32 +0000 (20:36 +1100)]
Use llu.

5 years agoAdd explicit warning about blank graphs due to no localips.
Emil Mikulic [Sat, 25 Jan 2014 09:35:38 +0000 (20:35 +1100)]
Add explicit warning about blank graphs due to no localips.

5 years agoxasprintf() size_t as %qu with cast.
Emil Mikulic [Sat, 25 Jan 2014 09:24:11 +0000 (20:24 +1100)]
xasprintf() size_t as %qu with cast.

5 years agoDon't die from assert() in timer_stop() if time goes backwards.
Emil Mikulic [Sat, 25 Jan 2014 09:18:46 +0000 (20:18 +1100)]
Don't die from assert() in timer_stop() if time goes backwards.

5 years agoMake timer around pcap_dispatch() tighter.
Emil Mikulic [Sat, 25 Jan 2014 09:11:41 +0000 (20:11 +1100)]
Make timer around pcap_dispatch() tighter.

5 years agomake depend
Emil Mikulic [Sat, 25 Jan 2014 09:09:23 +0000 (20:09 +1100)]
make depend

5 years agoFix more clang warnings.
Emil Mikulic [Sat, 25 Jan 2014 09:08:21 +0000 (20:08 +1100)]
Fix more clang warnings.

5 years agoAdd assert() to soothe Clang static analyzer.
Emil Mikulic [Sat, 25 Jan 2014 09:02:29 +0000 (20:02 +1100)]
Add assert() to soothe Clang static analyzer.

5 years agoFix memory leak.
Emil Mikulic [Sat, 25 Jan 2014 09:01:14 +0000 (20:01 +1100)]
Fix memory leak.

Found with Clang static analyzer.

5 years agoAdd assert()s to tree.h to soothe Clang static analyzer.
Emil Mikulic [Sat, 25 Jan 2014 08:43:32 +0000 (19:43 +1100)]
Add assert()s to tree.h to soothe Clang static analyzer.

5 years agoFix some clang warnings.
Emil Mikulic [Sat, 25 Jan 2014 08:30:34 +0000 (19:30 +1100)]
Fix some clang warnings.

5 years agoAdd header sentinel to str.h
Emil Mikulic [Sat, 25 Jan 2014 08:21:18 +0000 (19:21 +1100)]
Add header sentinel to str.h

5 years agoQuiet format string warnings in graph_db.
Emil Mikulic [Sat, 25 Jan 2014 08:18:50 +0000 (19:18 +1100)]
Quiet format string warnings in graph_db.

5 years agoFix type errors in format strings in hosts_db and use time_t instead of long.
Emil Mikulic [Sat, 25 Jan 2014 08:05:40 +0000 (19:05 +1100)]
Fix type errors in format strings in hosts_db and use time_t instead of long.

5 years agoDefine qu and llu in str.h and _Static_assert that they're 64 bits.
Emil Mikulic [Sat, 25 Jan 2014 08:02:18 +0000 (19:02 +1100)]
Define qu and llu in str.h and _Static_assert that they're 64 bits.

5 years agoExplicitly initialize last_real time.
Emil Mikulic [Sat, 25 Jan 2014 07:51:16 +0000 (18:51 +1100)]
Explicitly initialize last_real time.

5 years agoFix type errors in daylog.c format strings, and use time_t instead of long.
Emil Mikulic [Sat, 25 Jan 2014 07:45:57 +0000 (18:45 +1100)]
Fix type errors in daylog.c format strings, and use time_t instead of long.

5 years agoMark _printflike_ things so we get format warnings.
Emil Mikulic [Sat, 25 Jan 2014 07:31:10 +0000 (18:31 +1100)]
Mark _printflike_ things so we get format warnings.

5 years agoRename daylog_fn to opt_daylog_fn when parsing options.
Emil Mikulic [Sat, 25 Jan 2014 07:05:03 +0000 (18:05 +1100)]
Rename daylog_fn to opt_daylog_fn when parsing options.

This avoids using the same name as a different daylog_fn
in the daylog.c module.

5 years agoUse time_t instead of long.
Emil Mikulic [Sat, 25 Jan 2014 09:37:11 +0000 (20:37 +1100)]
Use time_t instead of long.

5 years agoAn attempt at trying to fix the time_t related issues with darkstat.
Remi Locherer [Sat, 25 Jan 2014 07:00:48 +0000 (18:00 +1100)]
An attempt at trying to fix the time_t related issues with darkstat.
Replace some longs with time_t. Fixes darkstat on 32-bit archs.

5 years agoDeveloper helper scripts for compiler warnings and clang analyzer.
Emil Mikulic [Sat, 25 Jan 2014 07:19:56 +0000 (18:19 +1100)]
Developer helper scripts for compiler warnings and clang analyzer.

6 years agoAdd release checklist.
Emil Mikulic [Wed, 14 Aug 2013 09:56:18 +0000 (19:56 +1000)]
Add release checklist.

6 years agoUpdate ChangeLog for 3.0.717. 3.0.717
Emil Mikulic [Wed, 14 Aug 2013 09:15:39 +0000 (19:15 +1000)]
Update ChangeLog for 3.0.717.

6 years agoOrder NEWS by version.
Emil Mikulic [Wed, 14 Aug 2013 09:13:23 +0000 (19:13 +1000)]
Order NEWS by version.

6 years agoFix crash due to str_appendf() not understanding %ld
Emil Mikulic [Wed, 14 Aug 2013 09:07:38 +0000 (19:07 +1000)]
Fix crash due to str_appendf() not understanding %ld

Thanks to James Lay and Tim Bradshaw for reporting this.

6 years agoFake up clock_gettime() on OS X.
Emil Mikulic [Sun, 11 Aug 2013 13:11:09 +0000 (23:11 +1000)]
Fake up clock_gettime() on OS X.

Thanks to Tim Bradshaw for reporting this and testing patches.

6 years agoUpdate ChangeLog for 3.0.716. 3.0.716
Emil Mikulic [Thu, 8 Aug 2013 10:30:38 +0000 (20:30 +1000)]
Update ChangeLog for 3.0.716.

6 years agoWe need at least autoconf 2.64 for PACKAGE_URL.
Emil Mikulic [Tue, 6 Aug 2013 09:58:45 +0000 (19:58 +1000)]
We need at least autoconf 2.64 for PACKAGE_URL.

6 years agoAdd instructions for building darkstat from git.
Emil Mikulic [Tue, 6 Aug 2013 09:23:18 +0000 (19:23 +1000)]
Add instructions for building darkstat from git.

6 years agoCheck for getifaddrs() in libc before ifaddrs.h
Emil Mikulic [Tue, 6 Aug 2013 09:03:00 +0000 (19:03 +1000)]
Check for getifaddrs() in libc before ifaddrs.h

Reported by: Andrej Kralj

He found a platform where the header exists but the library code doesn't.

6 years agoMake configure --enable-warnings use {all,extra}-warnings with GCC.
Emil Mikulic [Tue, 6 Aug 2013 08:40:36 +0000 (18:40 +1000)]
Make configure --enable-warnings use {all,extra}-warnings with GCC.

And -Weverything with clang.

6 years agoImprove the configure script's libpcap instructions.
Emil Mikulic [Sun, 24 Feb 2013 04:26:07 +0000 (15:26 +1100)]
Improve the configure script's libpcap instructions.

Explicitly name the Debian package.

6 years agoUse time_t instead of long in graph_db.c
Emil Mikulic [Mon, 12 Nov 2012 08:01:00 +0000 (19:01 +1100)]
Use time_t instead of long in graph_db.c

6 years agoRun pcap_dispatch() even if the pcap fd isn't in the read set.
Emil Mikulic [Sun, 8 Jul 2012 12:15:37 +0000 (22:15 +1000)]
Run pcap_dispatch() even if the pcap fd isn't in the read set.

Without this, use of the web interface can delay packet capture.

6 years agoChange listen() backlog from -1 to 128.
Emil Mikulic [Sun, 8 Jul 2012 11:45:22 +0000 (21:45 +1000)]
Change listen() backlog from -1 to 128.

Without this change, I get occasional second-long pauses (TCP SYN
retransmit delay) when the darkstat http server is running on
NetBSD 5.1.2, because it interprets -1 as 1 and ignores simultaneous
connection attempts.

6 years agoSet the listening socket non-blocking before we accept() on it.
Emil Mikulic [Sun, 8 Jul 2012 11:41:10 +0000 (21:41 +1000)]
Set the listening socket non-blocking before we accept() on it.

This has not come up as a problem before, but it's a good idea.

6 years agoRemove extraneous include.
Emil Mikulic [Sun, 8 Jul 2012 11:38:59 +0000 (21:38 +1000)]
Remove extraneous include.

6 years agoOnly time the processing part of the event loop.
Emil Mikulic [Sun, 8 Jul 2012 10:11:44 +0000 (20:11 +1000)]
Only time the processing part of the event loop.

It's fine for select() to take a long time if there's no traffic.

7 years agolocalip: don't complain about unknown sa_family.
Emil Mikulic [Sun, 8 Jul 2012 09:45:47 +0000 (19:45 +1000)]
localip: don't complain about unknown sa_family.

There are many possible families and we care about
precisely two of them (IPv4 and IPv6)

7 years agoFreeBSD build warning fixes.
Emil Mikulic [Sun, 8 Jul 2012 09:38:11 +0000 (19:38 +1000)]
FreeBSD build warning fixes.

7 years agoImplement support for multiple capture interfaces.
Emil Mikulic [Sun, 8 Jul 2012 09:24:42 +0000 (19:24 +1000)]
Implement support for multiple capture interfaces.

7 years agoWarn if the event loop or pcap_dispatch are too slow.
Emil Mikulic [Sun, 8 Jul 2012 07:06:11 +0000 (17:06 +1000)]
Warn if the event loop or pcap_dispatch are too slow.

7 years agoUse a monotonic clock where appropriate.
Emil Mikulic [Sun, 8 Jul 2012 06:56:29 +0000 (16:56 +1000)]
Use a monotonic clock where appropriate.

- Host last seen time (although we have to launder it to/from real time
  when dealing with export files)

- Time since localip_update (this fixes a long-standing FIXME)

- HTTP timeouts.

7 years agoSimplify daylog code.
Emil Mikulic [Sat, 7 Jul 2012 09:26:20 +0000 (19:26 +1000)]
Simplify daylog code.

7 years agotest_headers: show progress.
Emil Mikulic [Sat, 7 Jul 2012 08:42:20 +0000 (18:42 +1000)]
test_headers: show progress.

7 years agoRetire pktsummary.time - it isn't used.
Emil Mikulic [Sat, 7 Jul 2012 06:41:50 +0000 (16:41 +1000)]
Retire pktsummary.time - it isn't used.

7 years agoClean up decode module.
Emil Mikulic [Sat, 7 Jul 2012 06:33:47 +0000 (16:33 +1000)]
Clean up decode module.

- cap calls into decode, then acct.
- Decode functions can return 0 on failure.

7 years agoDon't do accounting if decode_ip[v6] fails.
Emil Mikulic [Mon, 2 Jul 2012 16:09:08 +0000 (02:09 +1000)]
Don't do accounting if decode_ip[v6] fails.

Otherwise we get a crash later due to a bogus address family.

Reported by: Mate Juros