Commit graph

326 commits

Author SHA1 Message Date
Sami Kerola
98bcdf9378
simplify output format selection, and passing
Use of enum is a lot more readable than passing strings, and comparing
characters, around.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-12-01 23:25:54 +00:00
Sami Kerola
b524296016
use bitmap for booleans and other config that has known size
Bitmaps are more c style than bool coming from c++ land.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-12-01 23:24:14 +00:00
Sami Kerola
5ed9958b69
fix protocol specifier in html output
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-12-01 21:58:52 +00:00
Sami Kerola
0369340710
remove upper limit of sort order definitions
Unlikely to be needed by anyone, but because arbitrary limits are from code
style point of view ugly.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-30 00:50:18 +00:00
Sami Kerola
327691f34a
use more descriptive names in limit bits enum definition
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-29 23:36:19 +00:00
Sami Kerola
4aff49ed80
correct return value FIXME items
Not all markups were quite right.  The output_* functions must return an
int.  The rest were as a matter of fact correct.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-28 21:03:38 +00:00
Sami Kerola
f11ca0bec2
fix typo in README
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-28 20:51:18 +00:00
Sami Kerola
1299737d76
make html output to use Bootstrap and DataTables
This make the table output good looking, and allows users to click table
headings to sort data by column without rerunning the analysis.
Unfortunately this change is breaking change, meaning the old CSS tags are
no longer supported, nor partial html output that printed only the table.

Proposed-by: Aaron Paetznick <aaronp@critd.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-28 20:37:23 +00:00
Sami Kerola
c7917152d3
improve README file instructions
Proposed-by: Derrick Lin <d.lin@garvan.org.au>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-28 11:22:28 +00:00
Sami Kerola
5cede1ff31
add --warn-count and --crit-count options to suppress alarm noise
Alarm criteria based solely on percentage was found to be difficult to be
tricky to setup in environments that has small ranges and big shared-nets
mixed up together.  These two new options should help making alarming more
useful.

Requested-by: Frank Bulk <fbulk@mypremieronline.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-28 00:33:12 +00:00
Sami Kerola
7f3d553c7f
add --snet-alarms option to suppress excess range alarms
Some users may not want to have alarms about ranges that are part of a
shared-network, so allow them to suppress such.

Requested-by: Frank Bulk <fbulk@mypremieronline.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-27 23:42:23 +00:00
Sami Kerola
99b6af70ef
update doxygen.conf file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-25 22:02:41 +00:00
Sami Kerola
2528c4c9d6
make binary exec path dynamic in scripts referring to it
Everything should just work out of the box without poking.  This change
makes that goal to be yet agian one step closer.  In same go make all
autotools related variable substitutions better.

Requested-by: Martijn van Brummelen <martijn@brumit.nl>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-25 21:53:29 +00:00
Sami Kerola
c30c122027
fix couple compiler warnings
src/getdata.c:248:22: warning: 'range_p' may be used uninitialized in this
function [-Wmaybe-uninitialized]
src/other.c:383:1: warning: control reaches end of non-void function
[-Wreturn-type]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-10-26 22:43:31 +00:00
Sami Kerola
535dfc4fc2
portability: Solaris 10 does not have err.h
Use error(3) function, that has gnulib portability fixes, instead of err(3)
and warn(3) family.

Reported-by: Anton Tkachev <antont@bk.ru>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-10-26 22:29:32 +00:00
Sami Kerola
fae20302cf release: 2.27
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-09-05 13:35:44 +01:00
Sami Kerola
167c4b6989 gitignore: update gnulib file list
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-09-05 13:34:41 +01:00
Sami Kerola
d8aef85d01 man: fix character class change
Debian package lint found going back to roman mode was broken.

Reported-by: Martijn van Brummelen <martijn@brumit.nl>
Signed-off-by: Sami Kerola <kerolasa@cloudflare.com>
2015-09-05 13:15:19 +01:00
Sami Kerola
cf26e17fe7 add hint about configure options to README
Proposed-by: Tim Cantin <tcantin@wellesley.edu>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-05-29 09:18:08 +01:00
Sami Kerola
9d1241c006 improve html output
Remove unnecessary html indentation, so that there is less page content
to transfer.  Right align the network names, and IP's so that they are
easier to read.  And ensure quoting is done correctly.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-05-02 19:40:06 +01:00
Sami Kerola
c4e5ef6198 add xml format check
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-05-02 18:51:39 +01:00
Sami Kerola
0d6c61d437 add touched addresses counts to xml and json reports
For some reason missing information has been overlooked for years.
Perhaps there is aren't that many users who are interested of the touched
addresses.

Proposed-by: Aaron Paetznick <aaronp@critd.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-05-02 18:48:52 +01:00
Sami Kerola
73b357484d output: remove empty element from xml
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-05-02 18:00:10 +01:00
Sami Kerola
735c5db817 docs: remove todo items that will never happen
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-04-01 23:15:38 +01:00
Sami Kerola
34dd1dee6e docs: remove very basic git usage info
This is not a git beginner manual project.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-04-01 23:11:28 +01:00
Sami Kerola
c7379e3e25 release: 2.26
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-11-15 10:03:41 +00:00
Sami Kerola
cfbd69c20b maint: remove unnecessary braces, spaces, update gnulib .gitignore
Improve code readability, and small maintenance.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-11-15 09:44:28 +00:00
Sami Kerola
33894fba74 other: disallow unsigned counter ever to have minus value
src/other.c:398:4: runtime error: unsigned integer overflow: 0 - 1 cannot
be represented in type 'unsigned int'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-11-14 21:57:21 +00:00
Sami Kerola
8e076fcc4f output: avoid division by zero
This correction makes the shared networks alarming to work when all
available leases are used.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-11-14 21:54:27 +00:00
Sami Kerola
0705b0c17f tests: add regression test to avoid shared-net off by one alarming issue
This tests ensures the problem fixed by Wolfgang Steudel cannot reoccur.
See the reference commit for details.

Reference: 5519763ba9
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-11-14 20:13:08 +00:00
Wolfgang Steudel
5519763ba9 alarming: include last shared network in alarming [off by one]
We have defined some shared networks with a couple of address ranges
and wanted to monitor the availability of free IP addresses in the
shared networks.  We were wondering why in some cases there was no
warning, although one shared network's usage was above the threshold.

We found the reason.  In output_alarming() the code was not skipping
"All networks", but missing the last shared network in the list.
Moving "shared_p++" to the beginning of the loop seems to solve the
bug.

Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Wolfgang Steudel <wolfgang.steudel@tu-ilmenau.de>
2014-11-14 19:41:21 +00:00
Sami Kerola
190df198a4 output: prefer thread safe function localtime_r()
While the dhcpd-pools might not be threading there is no reason why
software should use worse function when always correct alternative is
equally easy to use.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-11-09 22:31:30 +00:00
Sami Kerola
e401c2c7e6 other: reduce variable scope
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-11-09 22:25:25 +00:00
Sami Kerola
0d2b30b62d getdata: fix buffer overflow [AddressSanitizer]
==12031==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x61900000a980 at pc 0x0000004bca22 bp 0x7fff580dd6d0 sp 0x7fff580dd6c8
WRITE of size 1 at 0x61900000a980 thread T0
    #0 0x4bca21 in parse_config /home/src/dhcpd-pools/src/getdata.c:323:4
    #1 0x4bb332 in main /home/src/dhcpd-pools/src/dhcpd-pools.c:266:2
    #2 0x7fe03ecc403f in __libc_start_main (/usr/lib/libc.so.6+0x2003f)
    #3 0x4b9c0c in _start (/home/src/dhcpd-pools/dhcpd-pools+0x4b9c0c)

0x61900000a980 is located 0 bytes to the right of 1024-byte region
[0x61900000a580,0x61900000a980) allocated by thread T0 here:
    #0 0x49c58b in __interceptor_malloc (/home/src/dhcpd-pools/dhcpd-pools+0x49c58b)
    #1 0x4cbc0d in xmalloc /home/src/dhcpd-pools/lib/xmalloc.c:41:13
    #2 0x4bbed8 in parse_config /home/src/dhcpd-pools/src/getdata.c:195:9
    #3 0x4bb332 in main /home/src/dhcpd-pools/src/dhcpd-pools.c:266:2
    #4 0x7fe03ecc403f in __libc_start_main (/usr/lib/libc.so.6+0x2003f)

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/src/dhcpd-pools/src/getdata.c:323 parse_config

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-11-02 21:56:43 +00:00
Sami Kerola
bd5877bf4f update bootstrap from gnulib
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-24 20:58:27 +01:00
Sami Kerola
15502d3c97 getdata: fix buffer-overflows reported by address sanitizer
These happen when input configuration or leases files are empty.

==12876==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x61900000a480 at pc 0x000000487442 bp 0x7fffbc3e16b0 sp 0x7fffbc3e0e70
READ of size 1025 at 0x61900000a480 thread T0
    #0 0x487441 in __interceptor_strlen (/home/src/dhcpd-pools/dhcpd-pools+0x487441)
    #1 0x4bbb10 in parse_leases /home/src/dhcpd-pools/src/getdata.c:112:35
    #2 0x4bb337 in main /home/src/dhcpd-pools/src/dhcpd-pools.c:268:2
    #3 0x7f51909bf03f in __libc_start_main (/usr/lib/libc.so.6+0x2003f)
    #4 0x4b9c0c in _start (/home/src/dhcpd-pools/dhcpd-pools+0x4b9c0c)

0x61900000a480 is located 0 bytes to the right of 1024-byte region
[0x61900000a080,0x61900000a480)
allocated by thread T0 here:
    #0 0x49c58b in __interceptor_malloc (/home/src/dhcpd-pools/dhcpd-pools+0x49c58b)
    #1 0x4cbbcd in xmalloc /home/src/dhcpd-pools/lib/xmalloc.c:41:13
    #2 0x4bb801 in parse_leases /home/src/dhcpd-pools/src/getdata.c:96:9
    #3 0x4bb337 in main /home/src/dhcpd-pools/src/dhcpd-pools.c:268:2
    #4 0x7f51909bf03f in __libc_start_main (/usr/lib/libc.so.6+0x2003f)

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-24 20:57:57 +01:00
Sami Kerola
74c6ef2566 update kernel.org url in README
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-08-09 19:34:18 +01:00
Sami Kerola
e09f655a7b add appropriate sorting function for struct leases_t
The HASH_SORT in analyze needs this.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-08-09 19:28:23 +01:00
Sami Kerola
965875d20b declare global variables only once
Global variable declarations belong near main, and the header has to have
extern reference to them.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-08-09 19:09:04 +01:00
Sami Kerola
4392a5b917 reindent all files
And update the indent.pro to match with the style I like.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-20 18:05:00 +01:00
Sami Kerola
9090cfb1d7 news: add the note about .sig pgp key id
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-31 18:54:01 +01:00
Sami Kerola
6b267387cc release: 2.25
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-31 18:14:23 +01:00
Sami Kerola
6e680ee04f contrib: add release siging key to contrib/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-31 18:13:21 +01:00
Sami Kerola
502daf8306 build-sys: require automake 1.12 to get working test-driver
With older automake versions one can end up after ./bootstrap with
situation where test-driver script is missing, and subsequent compilation
fails.  Requiring automake 1.12 should usually help, but unfortunately
the case Dennis reported is different.

Something goes wrong with 1.13 and autoconf 2.69, in 32 bit RHEL system.
That sort of system seems to require AM_PROG_CC_C_O, and even when that
is added following error happens.  It is yet unknown to me why this is
the case.

parallel-tests: error: required file 'build-aux/test-driver' not found

Reference: http://git.savannah.gnu.org/cgit/automake.git/tree/NEWS?id=v1.12#n113
Reported-by: Dennis Ortsen <dortsen@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-04-13 21:14:42 +01:00
Sami Kerola
0f66becd57 build-sys: update bootstrap script
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-04-13 20:55:34 +01:00
Sami Kerola
eb55946595 output: use symbolic exit values for nagios commands
And ensure the exit values are set no matter how user will limit output.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-24 21:56:34 +00:00
Sami Kerola
5454ab7086 build-sys: update gitinore file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-24 21:38:10 +00:00
Sami Kerola
f3e282f122 output: make nagios output have performance data
Just in case someone wants to graph what is going on.

Reference: http://nagios.sourceforge.net/docs/3_0/pluginapi.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-03-24 21:34:35 +00:00
Sami Kerola
ca0b1c3262 tests: fix testing error
The commit 7fc354827a introduced an symlink
that end up to update simple test causing it to break.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-11-17 18:39:47 +00:00
Sami Kerola
d089a19fb5 generic: use pure and const function attributes when possible
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-11-17 18:25:52 +00:00