Christopher Wellons
4cb4fc6eac
Use CPPFLAGS in the Makefile ( closes #43 )
...
Debian uses CPPFLAGS to pass arguments like -D_FORTIFY_SOURCE=2.
2020-02-16 10:10:14 -05:00
Christopher Wellons
8daa5992f1
Bump to version 1.1
2020-01-31 11:47:27 -05:00
Christopher Wellons
2602caa459
Don't dereference NULL pointer on OOM
...
Fixes #37 .
2019-12-30 13:11:02 -05:00
Christopher Wellons
715f30c3a7
Add public domain dedication to the source header
2019-08-06 20:31:35 -04:00
Christopher Wellons
33dff0cfc9
Balance list begin (.Bl) and end (.El) in man page
...
Ref: #35
2019-08-06 20:10:35 -04:00
Christopher Wellons
f465f2dcbb
Tweak some macro formatting for consistency
2019-08-06 19:57:49 -04:00
Christopher Wellons
edf414caf6
Bump to version 1.0
...
Fixes #28 .
2019-04-29 07:41:07 -04:00
Christopher Wellons
370cb5bdb7
Use correct format specifier when printing totals
...
Fixes #26 .
2019-04-20 08:40:11 -04:00
Christopher Wellons
24bc7639d1
Always set standard output to line-buffered
...
When logging was enabled via the config file, standard output was left
fully buffered. Logs should never be fully buffered.
Thanks to Chang-Li for pointing this out.
2019-04-19 13:01:33 -04:00
Christopher Wellons
6f621b90b1
Tweak SIGUSR1 statistics totals logging
...
* Don't dynamically allocate the struct since that's not necessary.
* Use a more concise log message.
* Include current clients when counting the time.
* Print final statistics message *after* closing all clients.
* Don't include total connections in ACCEPT.
* Mention SIGUSR1 in the new man page, too.
Adjusts #24 .
2019-04-12 18:49:04 -04:00
Christopher Wellons
c50585f759
Rename uepoch() to epochms()
...
It returns milliseconds, not microseconds.
2019-04-12 18:37:45 -04:00
Christopher Wellons
38e35ad4c9
Add note about __EXTENSIONS__ to README (illumos)
2019-04-04 21:44:44 -04:00
Christopher Wellons
494c68b8d7
Use _XOPEN_SOURCE instead of _POSIX_C_SOURCE
...
It seems this is required to get all the IPv6 definitions, though most
systems aren't very picky. NetBSD seems to be one of those picky
systems, though.
2019-03-27 09:40:20 -04:00
Christopher Wellons
9f4bdc123d
Greatly simplify a bunch of things
...
1. If sockets are non-blocking, no need to use poll() on them. Just try
to write regardless and ignore the outcome. This means we don't need the
pollvec stuff anymore.
2. getline(3) is apparently still too new to POSIX that it's hard to use
portably. We don't really need it that badly anyway.
3. Don't use MSG_DONTWAIT. It's non-standard and apparently still hard
to use portably. Set sockets to non-blocking instead.
4. Since we're not polling on client sockets, the queue is a whole lot
simpler.
2019-03-26 20:30:03 -04:00
Christopher Wellons
b1c1599d32
Improve support for Solaris and its derivatives
...
Requires extensions to be enabled due to incomplete support for
POSIX.1-2008. However one of the now-exposed extensions is tragically
named "struct queue". This struct was been renamed to "struct fifo".
Thanks to @yvoinov for reporting this issue and collaborating on a
solution.
Closes #14 , #17 .
2019-03-26 18:23:15 -04:00
Christopher Wellons
e7c93c6664
Add link to main article in README
2019-03-25 09:37:34 -04:00
Christopher Wellons
a6d4565a10
Fix -V typo in usage documentation ( #11 )
2019-03-25 09:26:17 -04:00
Christopher Wellons
09e55cc553
Check for FreeBSD and adjust feature test macros
...
Fixes #2 .
2019-03-25 09:24:44 -04:00
Christopher Wellons
44219a5e05
Add note about RHEL 6 / CentOS 6
...
Fixes #10 .
2019-03-25 09:17:48 -04:00
Christopher Wellons
7fd15308dd
Add -V switch (print version info)
2019-03-24 12:42:08 -04:00
Christopher Wellons
ae76b41294
Add a log parsing utility
2019-02-06 15:18:09 -05:00
Christopher Wellons
a1dda3c70e
Use SO_RCVBUF to reduce local resource usage
2019-02-06 14:26:50 -05:00
Christopher Wellons
c8148970e9
No need for events when using fd = -1
2019-02-05 23:59:16 -05:00
Christopher Wellons
e93c71a881
Fix cast typo
2019-02-05 23:57:48 -05:00
Christopher Wellons
9900764488
Fix some of the queue logic
2019-02-05 23:56:40 -05:00
Christopher Wellons
31b5d6b832
Always clear IP address field
2019-02-05 23:28:06 -05:00
Christopher Wellons
f2128b58f2
Save errno value across logmsg()
...
Need to be able to log messages without affecting errno.
2019-02-05 23:26:46 -05:00
Christopher Wellons
47b901d9d3
Truncate rand16() result to 16 bits
2019-02-05 23:25:48 -05:00
Christopher Wellons
1583f6e5b3
Add missing break when send() fails
2019-02-05 23:25:15 -05:00
Christopher Wellons
2a9c514702
Fix config copy-paste error
2019-02-03 18:53:22 -05:00
Christopher Wellons
5e12d658ce
Flesh out a more detailed sample config
2019-02-03 18:51:37 -05:00
Christopher Wellons
20ec77e6ef
Add LogLevel to the configuration file
2019-02-03 18:44:52 -05:00
Christopher Wellons
6199d648f5
Don't use CLOCK_REALTIME_COARSE
...
The resolution only seems to be around 4ms.
2019-02-03 18:36:22 -05:00
Christopher Wellons
516d0cd78c
Track number of clients using just the queue
2019-02-03 18:32:24 -05:00
Christopher Wellons
dbb2174b65
Remove unnecessary include
2019-02-03 18:13:37 -05:00
Christopher Wellons
e72daae85f
Use a custom PRNG
2019-02-03 18:01:24 -05:00
Christopher Wellons
7693ce54e3
Fix up config parser and allow comments
2019-02-03 17:40:28 -05:00
Christopher Wellons
7dc64226aa
Use RFC3339 dates in the log
2019-02-03 16:03:56 -05:00
Christopher Wellons
5aa75a8833
minor: Adjust macro alignment
2019-02-03 15:46:23 -05:00
Christopher Wellons
500738e0cf
Use vDSO for the clock on Linux
2019-02-03 15:45:31 -05:00
Christopher Wellons
7ac1fbff3b
Always ignore SIGPIPE
...
MSG_DONTWAIT doesn't work quite right on OmniOS / Solaris, so also
disable SIGPIPE.
2019-02-03 15:32:45 -05:00
Christopher Wellons
2bd2b3ca92
Just drop IPV6_V6ONLY (it never works right anyway)
...
This doesn't seem to work as documented on any system.
2019-02-03 15:28:09 -05:00
Christopher Wellons
08a9dfe97e
Check for IPV6_V6ONLY before using it
...
This is necessary for supporting OmniOS (Solaris), which doesn't
actually document how to actually define this flag. This platform also
requires LDLIBS='-lsocket -lnsl' when compiling.
2019-02-03 15:25:25 -05:00
Christopher Wellons
2f418df897
Don't use :port since that doesn't work with IPv6
2019-02-03 13:06:14 -05:00
Christopher Wellons
94d9a91407
Reject extraneous arguments
2019-02-03 13:03:40 -05:00
Christopher Wellons
09bb8be32a
Listen on both ipv6 and ipv4
2019-02-03 12:48:37 -05:00
Christopher Wellons
2f79375360
Explicitly initialize sockaddr_in members
2019-02-03 12:28:47 -05:00
Christopher Wellons
93b94f6b44
Correct for different definitions of sockaddr_in
...
On BSD it doesn't like the braces, and on Linux it prefers braces. Ugh.
2019-02-03 12:10:17 -05:00
Christopher Wellons
ae67a263f9
Tweak the README a bit
2019-02-03 12:04:23 -05:00
Christopher Wellons
8e1d9fc28a
Make it clear when the config file is loaded
2019-02-03 12:00:35 -05:00
Christopher Wellons
7619af17ba
Add sample config file to the README
2019-02-03 11:59:11 -05:00
Christopher Wellons
90ce8a6696
Restart listening socket if port config changes
2019-02-03 11:55:15 -05:00
Christopher Wellons
d9c5d3fcf0
Allow configuration via config file (-f, SIGHUP)
2019-02-03 11:47:20 -05:00
Christopher Wellons
5c6328c6f2
Formalize configuration managment
2019-02-03 11:46:40 -05:00
Christopher Wellons
3a0126bd99
Add note about queue_remove()
2019-02-03 10:06:12 -05:00
Christopher Wellons
d5726be23d
Tighten up integer argument parsing
2019-02-03 09:42:27 -05:00
Christopher Wellons
4bd7b1a3ea
Fix up max clients option
2019-02-03 09:39:10 -05:00
Christopher Wellons
66c549c87c
Add -l to control banner line length
2019-02-03 09:39:10 -05:00
Christopher Wellons
ce7e3e5914
Allow graceful shutdown with SIGTERM
2019-02-03 09:18:38 -05:00
Christopher Wellons
3a1d0048f9
Tweak README
2019-02-03 08:26:42 -05:00
Christopher Wellons
94aa40778c
Make log messages line buffered
2019-02-03 08:18:55 -05:00
Christopher Wellons
112e5b303f
Vastly improve logging
2019-02-03 08:11:52 -05:00
Christopher Wellons
81046bcdec
Reduce line line length
...
If clients have a maximum banner size, this will help to keep them
around for longer.
2019-02-03 08:08:27 -05:00
Christopher Wellons
1f1ce4e26d
Adapt max_clients on EMFILE or ENFILE
2019-02-02 23:19:44 -05:00
Christopher Wellons
891584a361
Fix random underflow
2019-02-02 23:19:23 -05:00
Christopher Wellons
dca3ca646f
Don't forget to double the known capacity
2019-02-02 23:18:56 -05:00
Christopher Wellons
8c37ff055a
Don't use a function named log()
2019-02-02 22:43:41 -05:00
Christopher Wellons
7fbba1e7b0
Initial working code
2019-02-02 22:38:59 -05:00