darkstat
7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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

7 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.

7 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.

7 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.

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

7 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.

8 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)

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

8 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.

8 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.

8 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.

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

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

8 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.

8 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.

8 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

8 years agoIgnore IPv6 packets with extension headers.
Emil Mikulic [Sun, 1 Jul 2012 15:11:37 +0000 (01:11 +1000)]
Ignore IPv6 packets with extension headers.

Previously we would emit "unknown proto" warnings.

8 years agoSupport multiple local IPs on an interface.
Emil Mikulic [Sun, 1 Jul 2012 14:26:18 +0000 (00:26 +1000)]
Support multiple local IPs on an interface.

8 years agoDon't inline swap64(), to fix a warning.
Emil Mikulic [Tue, 19 Jun 2012 15:35:03 +0000 (01:35 +1000)]
Don't inline swap64(), to fix a warning.

8 years agoAdd ifdefs around decode_linux_sll implementation.
Emil Mikulic [Mon, 11 Jun 2012 10:19:28 +0000 (20:19 +1000)]
Add ifdefs around decode_linux_sll implementation.

Noticed on OpenBSD 5.1

8 years agoFix "assuming signed overflow does not occur" warning.
Emil Mikulic [Mon, 11 Jun 2012 09:48:55 +0000 (19:48 +1000)]
Fix "assuming signed overflow does not occur" warning.

8 years agoDefine ETHERTYPE_IPV6 ourselves.
Emil Mikulic [Mon, 11 Jun 2012 09:35:00 +0000 (19:35 +1000)]
Define ETHERTYPE_IPV6 ourselves.

Instead of trying to get it through <net/if_ether.h>.
Remove the autoconf check for this header.

8 years agoCompatibility fixes for NetBSD 5.1.2
Emil Mikulic [Mon, 11 Jun 2012 09:33:41 +0000 (19:33 +1000)]
Compatibility fixes for NetBSD 5.1.2

8 years agoFix format warning.
Emil Mikulic [Thu, 3 May 2012 15:03:13 +0000 (01:03 +1000)]
Fix format warning.

8 years agoDon't err() if we can't create one socket for http.
Emil Mikulic [Thu, 3 May 2012 14:49:25 +0000 (00:49 +1000)]
Don't err() if we can't create one socket for http.

We try to create several, and error out later if we don't succeed in
creating any.

8 years agoCosmetic: capitalize. work 3.0.715
Emil Mikulic [Thu, 1 Mar 2012 09:59:12 +0000 (20:59 +1100)]
Cosmetic: capitalize.

8 years agoImprove error message when binding http port.
Emil Mikulic [Thu, 1 Mar 2012 09:58:58 +0000 (20:58 +1100)]
Improve error message when binding http port.

8 years agoWe don't use inet_aton anymore, drop the <arpa/inet.h> includes.
Emil Mikulic [Thu, 1 Mar 2012 09:33:22 +0000 (20:33 +1100)]
We don't use inet_aton anymore, drop the <arpa/inet.h> includes.

8 years agoLook for hstrerror in -lresolv.
Emil Mikulic [Thu, 1 Mar 2012 09:32:24 +0000 (20:32 +1100)]
Look for hstrerror in -lresolv.

Suggested by: Bernd Schemmer, for Solaris 10

8 years agoDrop -Wlong-long
Emil Mikulic [Thu, 1 Mar 2012 09:24:12 +0000 (20:24 +1100)]
Drop -Wlong-long

8 years agoTurn a switch() with no default case into an explicit if+assert.
Emil Mikulic [Thu, 1 Mar 2012 09:20:06 +0000 (20:20 +1100)]
Turn a switch() with no default case into an explicit if+assert.

8 years agoInclude bsd/{string,unistd}.h if present.
Emil Mikulic [Thu, 1 Mar 2012 09:19:49 +0000 (20:19 +1100)]
Include bsd/{string,unistd}.h if present.

8 years agoUpdate ChangeLog for darkstat 3.0.715
Emil Mikulic [Mon, 23 Jan 2012 03:47:27 +0000 (19:47 -0800)]
Update ChangeLog for darkstat 3.0.715

8 years agoMake decode_null separate from decode_loop.
Emil Mikulic [Mon, 23 Jan 2012 02:53:44 +0000 (18:53 -0800)]
Make decode_null separate from decode_loop.

This fixes OpenBSD storing family in host-order in the null case.

8 years agoMore diagnostics when socket() fails.
Emil Mikulic [Mon, 23 Jan 2012 01:52:50 +0000 (17:52 -0800)]
More diagnostics when socket() fails.

9 years agoDetection of multicast IPv4 addresses was looking at the wrong end.
Emil Mikulic [Mon, 12 Sep 2011 10:45:55 +0000 (20:45 +1000)]
Detection of multicast IPv4 addresses was looking at the wrong end.

9 years agoFall back to gethostbyaddr() If getnameinfo() fails.
Emil Mikulic [Sun, 11 Sep 2011 10:30:41 +0000 (20:30 +1000)]
Fall back to gethostbyaddr() If getnameinfo() fails.

Original patch from: Shaun Wallace

9 years agoMake failure to get localip non-fatal.
Emil Mikulic [Sun, 17 Jul 2011 05:50:08 +0000 (15:50 +1000)]
Make failure to get localip non-fatal.

9 years agoSimplify HAVE_ vs HAVE_REAL_
Emil Mikulic [Sun, 17 Jul 2011 05:37:03 +0000 (15:37 +1000)]
Simplify HAVE_ vs HAVE_REAL_

9 years agoClose unlikely race: don't reset before export.
Emil Mikulic [Sun, 17 Jul 2011 05:06:42 +0000 (15:06 +1000)]
Close unlikely race: don't reset before export.

9 years agoifa_addr can be NULL.
Emil Mikulic [Sun, 17 Jul 2011 05:01:35 +0000 (15:01 +1000)]
ifa_addr can be NULL.

9 years agoImplement --local-only
Emil Mikulic [Sun, 17 Jul 2011 04:51:37 +0000 (14:51 +1000)]
Implement --local-only

I've had a couple of requests for restricting accounting to the local net.

9 years agoSplit out newer GCC warning flags into a separate check.
Emil Mikulic [Sun, 26 Jun 2011 12:18:10 +0000 (22:18 +1000)]
Split out newer GCC warning flags into a separate check.

FreeBSD's system compiler is too old to recognize them.

9 years agoBail out early if the request is too large.
Malte S. Stretz [Wed, 22 Jun 2011 20:27:53 +0000 (22:27 +0200)]
Bail out early if the request is too large.

There is no point parsing the request first.

9 years agoRemove an unnecessary define.
Malte S. Stretz [Wed, 22 Jun 2011 20:23:58 +0000 (22:23 +0200)]
Remove an unnecessary define.

9 years agoSome small free() fixups.
Malte S. Stretz [Wed, 22 Jun 2011 20:21:33 +0000 (22:21 +0200)]
Some small free() fixups.

* No need to check for NULL before free().
* Early free() conn->request in the same function where it was
  allocated.

9 years agoFix up includes.
Emil Mikulic [Sun, 26 Jun 2011 06:56:20 +0000 (16:56 +1000)]
Fix up includes.

9 years agoMove *BSD compatibility layer to extra file.
Malte S. Stretz [Mon, 20 Jun 2011 13:32:52 +0000 (15:32 +0200)]
Move *BSD compatibility layer to extra file.

This makes it easier to silence some warnings.

9 years agoFix up pretty printing.
Malte S. Stretz [Mon, 20 Jun 2011 14:01:36 +0000 (16:01 +0200)]
Fix up pretty printing.

* Add *_HOSTCC, *_LINK and *_CIFY macros to avoid confusion.
* Move cruft to the bottom where nobody sees it.

9 years agoOnly update lastseen time for sender, not recipient.
Emil Mikulic [Tue, 21 Jun 2011 12:38:13 +0000 (22:38 +1000)]
Only update lastseen time for sender, not recipient.

Suggested by: Madhu

9 years agolast_seen -> lastseen, for consistency.
Emil Mikulic [Tue, 21 Jun 2011 12:33:24 +0000 (22:33 +1000)]
last_seen -> lastseen, for consistency.

9 years agoMake bind() failure nonfatal.
Emil Mikulic [Tue, 21 Jun 2011 10:15:55 +0000 (20:15 +1000)]
Make bind() failure nonfatal.

9 years agoTune version/usage output.
Malte S. Stretz [Thu, 9 Jun 2011 14:05:43 +0000 (16:05 +0200)]
Tune version/usage output.

9 years agoAbort release if there are uncommitted changes.
Emil Mikulic [Mon, 20 Jun 2011 13:17:32 +0000 (23:17 +1000)]
Abort release if there are uncommitted changes.

9 years agoMake test_headers return an appropriate exit code.
Emil Mikulic [Mon, 20 Jun 2011 13:12:24 +0000 (23:12 +1000)]
Make test_headers return an appropriate exit code.

9 years agoFix release.sh order.
Emil Mikulic [Mon, 20 Jun 2011 13:01:40 +0000 (23:01 +1000)]
Fix release.sh order.

Run test_headers after getting an up-to-date config.h

9 years agoRestore pre-IPv6 localip_update() code for systems without ifaddrs.h
Emil Mikulic [Mon, 20 Jun 2011 12:46:15 +0000 (22:46 +1000)]
Restore pre-IPv6 localip_update() code for systems without ifaddrs.h

Requested by: Prof Abimbola Olowofoyeku for Routertech (uses uclibc)

9 years agoImprove test_headers.sh: MIN shouldn't match RB_MIN
Emil Mikulic [Mon, 20 Jun 2011 12:28:05 +0000 (22:28 +1000)]
Improve test_headers.sh: MIN shouldn't match RB_MIN

9 years agoExplicitly enable IPV6_V6ONLY.
Malte S. Stretz [Thu, 9 Jun 2011 13:00:17 +0000 (15:00 +0200)]
Explicitly enable IPV6_V6ONLY.

It defaults to off on Linux and on on BSD.  Except when it doesn't.
See also <http://www.ipv6style.jp/en/apps/20030829/index.shtml>.

I'd vote for disabling it instead.  But:  OpenBSD doesn't allow this
since is so utterly insecure... dude... just get off my lawn.

See also <http://utcc.utoronto.ca/~cks/space/blog/linux/Ipv6DualBinding>

9 years agoImplement automake-style silent-rules
Emil Mikulic [Mon, 20 Jun 2011 12:17:14 +0000 (22:17 +1000)]
Implement automake-style silent-rules

Prompted by: Malte S. Stretz

9 years agoEnable link-time optimization.
Malte S. Stretz [Tue, 14 Jun 2011 09:00:43 +0000 (11:00 +0200)]
Enable link-time optimization.

Results in a 15% smaller (and probably quicker) binary.

9 years agoSuppress a printf warning by using the proper format.
Malte S. Stretz [Tue, 31 May 2011 23:45:26 +0000 (01:45 +0200)]
Suppress a printf warning by using the proper format.

9 years agoMark MIN and MAX as macros as they have side effects.
Malte S. Stretz [Thu, 9 Jun 2011 14:42:41 +0000 (16:42 +0200)]
Mark MIN and MAX as macros as they have side effects.

9 years agos6_addr32 compatibility for OpenSolaris
Emil Mikulic [Mon, 20 Jun 2011 10:50:17 +0000 (20:50 +1000)]
s6_addr32 compatibility for OpenSolaris

Submitted by: Mats Erik Andersson
Reminded by: Bernd Schemmer

9 years agoUse strtol instead of strtonum.
Emil Mikulic [Thu, 9 Jun 2011 12:21:10 +0000 (22:21 +1000)]
Use strtol instead of strtonum.

9 years agoExplain Linux workaround for binding to all addresses.
Emil Mikulic [Thu, 9 Jun 2011 12:10:35 +0000 (22:10 +1000)]
Explain Linux workaround for binding to all addresses.

Requested by: Malte S. Stretz

9 years agoDon't use AI_ADDRCONFIG.
Emil Mikulic [Thu, 9 Jun 2011 11:55:22 +0000 (21:55 +1000)]
Don't use AI_ADDRCONFIG.

Malte says without this:

It fails with "Address family for hostname not supported: Device or
resource busy" if IPv6 is requested (eg. if no bind address was
specified under Linux) but no interface has IPv6 configured (::1/128
and fe80::/64 do not count).

9 years agoAdd license blurb to darkproxy.php.
Malte S. Stretz [Wed, 8 Jun 2011 12:33:59 +0000 (14:33 +0200)]
Add license blurb to darkproxy.php.

Feel free to do whatever you like with this trivial code.

9 years agoClean up Makefile.in to simplify future patching.
Malte S. Stretz [Tue, 31 May 2011 10:26:05 +0000 (12:26 +0200)]
Clean up Makefile.in to simplify future patching.

* Add STATICHS macro.
* Split clean rule.
* Mark phony targets.

9 years agoIgnore release files.
Malte S. Stretz [Fri, 3 Sep 2010 09:07:31 +0000 (11:07 +0200)]
Ignore release files.

9 years agoFix file name in comment.
Malte S. Stretz [Fri, 3 Sep 2010 09:37:31 +0000 (11:37 +0200)]
Fix file name in comment.

9 years agoMax domain name length is 255, not MAXHOSTNAMELEN
Emil Mikulic [Thu, 9 Jun 2011 11:34:07 +0000 (21:34 +1000)]
Max domain name length is 255, not MAXHOSTNAMELEN

This should fix a build failure on Hurd (!)
Thanks to: Rene Mayorga and the Debian project.

9 years agoWhoops, I included sys/types in the wrong file. 3.0.714
Emil Mikulic [Mon, 6 Jun 2011 10:47:56 +0000 (20:47 +1000)]
Whoops, I included sys/types in the wrong file.

Suggested by: Chris Kuethe

9 years agoUpdate ChangeLog.
Emil Mikulic [Sat, 4 Jun 2011 14:17:52 +0000 (00:17 +1000)]
Update ChangeLog.

9 years agomake depend
Emil Mikulic [Sun, 15 May 2011 12:44:44 +0000 (22:44 +1000)]
make depend

9 years agoAutomate release more - run test, make depend.
Emil Mikulic [Sat, 4 Jun 2011 13:58:37 +0000 (23:58 +1000)]
Automate release more - run test, make depend.

Also, use "tar chof" to get ustar format.

9 years agoUpdate date in manpage.
Malte S. Stretz [Wed, 1 Jun 2011 11:31:53 +0000 (13:31 +0200)]
Update date in manpage.

9 years agoBump copyright years.
Emil Mikulic [Sat, 4 Jun 2011 13:29:32 +0000 (23:29 +1000)]
Bump copyright years.

9 years agoHomepage is moving to a sillier domain.
Emil Mikulic [Sat, 4 Jun 2011 13:18:05 +0000 (23:18 +1000)]
Homepage is moving to a sillier domain.

9 years agoFactor and add checks for cdefs.h
Emil Mikulic [Sat, 4 Jun 2011 12:58:23 +0000 (22:58 +1000)]
Factor and add checks for cdefs.h

9 years agoRemove includes of darkstat.h, add cdefs.h where needed.
Emil Mikulic [Sat, 4 Jun 2011 12:58:29 +0000 (22:58 +1000)]
Remove includes of darkstat.h, add cdefs.h where needed.

9 years agocp darkstat.h cdefs.h
Emil Mikulic [Sat, 4 Jun 2011 13:00:37 +0000 (23:00 +1000)]
cp darkstat.h cdefs.h

9 years agoFix warnings.
Emil Mikulic [Sat, 4 Jun 2011 12:40:35 +0000 (22:40 +1000)]
Fix warnings.

9 years agoUse multiple listening sockets, allow multiple bindaddrs.
Emil Mikulic [Sat, 4 Jun 2011 10:21:56 +0000 (20:21 +1000)]
Use multiple listening sockets, allow multiple bindaddrs.

9 years agoBe explicit that per-host pages are directories.
Emil Mikulic [Sat, 4 Jun 2011 11:31:40 +0000 (21:31 +1000)]
Be explicit that per-host pages are directories.

Browsers get confused by double colons in v6 addresses.

9 years agoAdd missing opt.h to release script.
Malte S. Stretz [Wed, 1 Jun 2011 15:44:57 +0000 (17:44 +0200)]
Add missing opt.h to release script.

9 years agoRemove unnecessary header sentinel.
Emil Mikulic [Sat, 4 Jun 2011 08:21:43 +0000 (18:21 +1000)]
Remove unnecessary header sentinel.

9 years agoReplace the --base code with relative paths.
Malte S. Stretz [Wed, 1 Jun 2011 11:30:13 +0000 (13:30 +0200)]
Replace the --base code with relative paths.

Most of the functionality turned out to be overkill since
relative paths work fine, too.  The only broken thing is
lighttpd 1.4 which doesn't support proxying of stuff like
  /darkstat/ -> http://localhost:667/
But this will be fixed properly in mod_proxy_core in 1.5
once (if ever) it is released.

9 years agoAvoid linking against nsl and resolv unless required.
Malte S. Stretz [Tue, 31 May 2011 23:01:10 +0000 (01:01 +0200)]
Avoid linking against nsl and resolv unless required.

9 years agolibbsd provides (a stub for) setproctitle, too.
Malte S. Stretz [Tue, 31 May 2011 22:08:40 +0000 (00:08 +0200)]
libbsd provides (a stub for) setproctitle, too.

9 years agoCheck for missing and extraneous config.h includes.
Emil Mikulic [Sat, 4 Jun 2011 07:59:33 +0000 (17:59 +1000)]
Check for missing and extraneous config.h includes.

9 years agoMake test_headers more automatic.
Emil Mikulic [Sat, 4 Jun 2011 07:52:59 +0000 (17:52 +1000)]
Make test_headers more automatic.

Also make the output prettier.

9 years agoInclude config.h explicitly.
Emil Mikulic [Sat, 4 Jun 2011 06:21:47 +0000 (16:21 +1000)]
Include config.h explicitly.