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

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

9 years agoDrop interface from html_open, use global opt_interface.
Malte S. Stretz [Tue, 31 May 2011 13:27:18 +0000 (15:27 +0200)]
Drop interface from html_open, use global opt_interface.

9 years agoPrefix all global variables to aid debugging.
Malte S. Stretz [Tue, 31 May 2011 13:22:49 +0000 (15:22 +0200)]
Prefix all global variables to aid debugging.

* Also move all options which are set in darkstat.c to a new
  header opt.h and prefix options with opt_.
* Declare all opt_* stuff in darkstat.c.
* Prefix globals from acct.c with acct_.
* Prefix globals from cap.c with cap_.
* Prefix globals from hosts_db.c with hosts_db_.
* Prefix globals from http.c with http_.

9 years agoRename str_append2() to str_appendn().
Malte S. Stretz [Thu, 2 Sep 2010 21:52:58 +0000 (23:52 +0200)]
Rename str_append2() to str_appendn().

Clearifies the difference to str_append (ie. append n bytes), mnemonic:
str_appendn is to str_append what strncat is to strcat.

9 years agoChange example to discourage use of hyphen (-rc1)
Emil Mikulic [Mon, 30 May 2011 11:44:32 +0000 (21:44 +1000)]
Change example to discourage use of hyphen (-rc1)

Ports doesn't like hyphens there.

9 years agoUse PACKAGE_URL.
Emil Mikulic [Mon, 30 May 2011 11:38:10 +0000 (21:38 +1000)]
Use PACKAGE_URL.

- Use PACKAGE_strings directly instead of through %s indirection.
- Reduce duplication by removing URL from AUTHORS and README.

9 years agoAdd homepage URL to AC_INIT.
Malte S. Stretz [Fri, 3 Sep 2010 09:06:23 +0000 (11:06 +0200)]
Add homepage URL to AC_INIT.

This sets PACKAGE_URL in config.h.

9 years agoUse sed to set the version number.
Malte S. Stretz [Fri, 3 Sep 2010 09:05:25 +0000 (11:05 +0200)]
Use sed to set the version number.

9 years agoUse separate output function, fix eval.
Malte S. Stretz [Fri, 3 Sep 2010 09:04:31 +0000 (11:04 +0200)]
Use separate output function, fix eval.

9 years agoAdd sys/types.h includes for OpenBSD.
Emil Mikulic [Mon, 30 May 2011 11:29:22 +0000 (21:29 +1000)]
Add sys/types.h includes for OpenBSD.

Suggested by: Chris Kuethe

9 years agoSimplify how the http socket is bound.
Emil Mikulic [Sun, 29 May 2011 05:15:59 +0000 (15:15 +1000)]
Simplify how the http socket is bound.

- Use dual-stack socket for wildcard.
- Sadly, AI_V4MAPPED doesn't work on FreeBSD 8.2

9 years agoRetire DARKSTAT_USES_HOSTENT conditional code.
Emil Mikulic [Tue, 24 May 2011 12:29:38 +0000 (22:29 +1000)]
Retire DARKSTAT_USES_HOSTENT conditional code.

9 years agoShow base_url in "listening on" output.
Emil Mikulic [Mon, 23 May 2011 13:50:07 +0000 (23:50 +1000)]
Show base_url in "listening on" output.

9 years agoPut fewer slashes into the slashed_url.
Emil Mikulic [Mon, 23 May 2011 13:44:52 +0000 (23:44 +1000)]
Put fewer slashes into the slashed_url.

9 years agoAdd addr module and autogenerated files to release tarball.
Emil Mikulic [Sun, 15 May 2011 14:16:28 +0000 (00:16 +1000)]
Add addr module and autogenerated files to release tarball.

9 years agoreply_sent is zero in poll_send_header_and_reply
Emil Mikulic [Sun, 15 May 2011 14:00:59 +0000 (00:00 +1000)]
reply_sent is zero in poll_send_header_and_reply

Found by: Clang Static Analyzer

9 years agoFormat string fixes, problem caught by _printflike_
Emil Mikulic [Sun, 15 May 2011 13:38:34 +0000 (23:38 +1000)]
Format string fixes, problem caught by _printflike_

9 years agoFix warnings, bring in restrict keyword, modernize strl{cpy,cat}
Emil Mikulic [Sun, 15 May 2011 13:04:39 +0000 (23:04 +1000)]
Fix warnings, bring in restrict keyword, modernize strl{cpy,cat}

9 years agoHandle getnameinfo() failing in timeout code.
Emil Mikulic [Sun, 15 May 2011 12:32:10 +0000 (22:32 +1000)]
Handle getnameinfo() failing in timeout code.

9 years agoPortability fixes for FreeBSD - include the right headers.
Emil Mikulic [Sun, 15 May 2011 12:12:08 +0000 (22:12 +1000)]
Portability fixes for FreeBSD - include the right headers.

9 years agoClean up un-needed date variables, include str.
Emil Mikulic [Sun, 15 May 2011 12:40:01 +0000 (22:40 +1000)]
Clean up un-needed date variables, include str.

9 years agoDon't leak base_url memory.
Emil Mikulic [Sun, 15 May 2011 10:25:55 +0000 (20:25 +1000)]
Don't leak base_url memory.

9 years agoFixes for non-default base_url.
Emil Mikulic [Sun, 15 May 2011 10:15:36 +0000 (20:15 +1000)]
Fixes for non-default base_url.

* use relative path to graphs.xml

* use correct absolute path for hosts
  (relative paths are confused by colons in IPv6 addresses)