Commit graph

413 commits

Author SHA1 Message Date
Sami Kerola
7c872ef8d7 build-sys: AC_PROG_CC_C99 is obsolete; use AC_PROG_CC
Reference: http://lists.gnu.org/archive/html/autoconf-commit/2012-10/msg00001.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-09-07 16:56:46 +01:00
Sami Kerola
e8f8c04979 build-sys: update gnulib modules
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-09-07 16:55:31 +01:00
Sami Kerola
47582ed8d8 other: memcmp() is tiny bit quicker than strncmp()
With the large input samples I have use of memcmp makes run to take about
2-3% less time.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-09-02 22:21:32 +01:00
Sami Kerola
06ffa5ed04 xstrstr: speed up analysis by avoiding string comparisons
With large input one should see cut 15% for overall run time.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-08-31 00:30:28 +01:00
Sami Kerola
d70b08244f thanks: Dan Pritts
For good ideas how to improve alarming.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-12 20:01:20 +01:00
Sami Kerola
3944e289c8 docs: add an example how to use limits with alarming
Proposed-by: Dan Pritts <danno@umich.edu>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-12 19:59:50 +01:00
Sami Kerola
57ddd4f785 tests: test small network alarm ignoring
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-12 19:32:27 +01:00
Sami Kerola
28f1e8c54c output: allow user to ignore small ranges and shared networks
Some have configuration which combines small ranges such as one host, and
greater address ranges that are important to monitor.  Especially the one
host ranges tend to cause a lot of false-positive alarms, as they are
immediately 100% full when a machine requests an address.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-12 19:29:44 +01:00
Sami Kerola
4becf97fb3 docs: inform how the limits affect to printing when alarming is in use
Proposed-by: Dan Pritts <danno@umich.edu>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-11 20:47:09 +01:00
Sami Kerola
978ddeddeb tests: fix tests to use the new OK printing limit
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-11 20:37:55 +01:00
Sami Kerola
9f676f5276 output: allow alarming, in case of success, be silent
This will allow runnign dhcpd with cron, and when nothing is wrong emails
will not be sent.

Proposed-by: Dan Pritts <danno@umich.edu>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-11 20:37:37 +01:00
Sami Kerola
c0e7b50bd3 tests: add alarming tests
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-10 22:42:25 +01:00
Sami Kerola
08c9bcc502 output: make output limits to apply to alarm return values
The earlier behavior made alarming nearly impossible to use for shared
networks only, as they often are expected to be whole lot less full than
ranges.  Unfortunately if a alarm level was exceeded either by range or
shared network the exit value changed.  In most of the cases that lead
alarms to be sent, without sensible message.

Reported-by: Dan Pritts <danno@umich.edu>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-10 22:34:47 +01:00
Sami Kerola
7de719a80c build-sys: update configure.ac
Run autoupdate, and fix few items manually such as prefer AS_CASE rather
than shell case clause.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-06-23 13:07:27 +01:00
Sami Kerola
3f3d447ad8 release: 2.23
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-05-11 17:41:24 +01:00
Sami Kerola
824a6aec73 build-sys: update bootstrap from gnulib
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-05-11 17:35:38 +01:00
Sami Kerola
8dba1c749d gnulib: add gnulib modules
Some systems, such as freebsd, does not have program_invocation_short_name
available.  There are also problems finding AF_INET{,6} definitions.

CC: Peter Fraser <p_fraser@hotmail.com>
Reported-by: Ryan Steinmetz <zi@freebsd.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-05-11 17:09:25 +01:00
Sami Kerola
0002aa57e6 release: 2.22
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-24 22:46:21 +01:00
Sami Kerola
30238e9d1c build-sys: use non-recursive build
For reasons see excellent paper 'Recursive Make Considered Harmful' by
Peter Miller.

References: http://miller.emu.id.au/pmiller/books/rmch/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-24 22:46:04 +01:00
Sami Kerola
0495ea4edf build-sys: fix gnulib function order
gl_EARLY should be called before gl_INIT

References: http://www.gnu.org/software/gnulib/manual/html_node/Initial-import.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-24 21:12:37 +01:00
Sami Kerola
ab535d8ab1 tests: add a test for one ip range
A regression test for commit ffffbc9 fix.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-22 23:16:18 +01:00
Sami Kerola
ffffbc96cc getdata: make single address ranges work
The dhcpd.conf can contain single IP range definitions, such as

range 10.20.30.40;

and they must be understood similar way as the range definiton would have
two IP's that are the same IP, e.g.,

range 10.20.30.40 10.20.30.40;

Reported-by: Joey D. <jobewan@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-22 23:08:21 +01:00
Sami Kerola
b24fc42ec8 getdata: make a lease address detection more robust
The commit 805d353584 did not fix all
possible problem cases.  This commit attempts to address remaining
issues.

Reported-by: Joey D. <jobewan@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-22 22:47:25 +01:00
Sami Kerola
1a7649beb3 tests: check how command works with invalid input
Lack of this check resulted to bug that was shipped to users, which was
fixed in commit 805d353.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-21 14:37:34 +01:00
Sami Kerola
805d353584 getdata: certain input files caused SIGSEGV
When dhcpd.conf file got to be parsed such way that IP version could not
be determined the dhcpd.lease file parsing resulted to SIGSEGV.

Reported-by: Joey D. <jobewan@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-21 14:30:21 +01:00
Sami Kerola
5966360f12 getdata: posix_fadvise() error checking
Helmut reported run of 'make check' failing in debian pbuilder
environment.  The posix_fadvise() functions were failing with a message
such as

 dhcpd-pools: parse_config: fadvise ../tests/confs/complete: Cannot allocate memory

which to me is likely error in how an error is determined.  Relying on
errno value not being mangled by libc is unreliable.  Attempt to fix this
is simple, check return values of these function calls and ignore the
errno.

Reported-by: Helmut Grohne <h.grohne@cygnusnetworks.de>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-21 14:05:59 +01:00
Sami Kerola
90c1a4e4c5 build-sys: reorder gnulib macro in relation to C standard
When ./bootstrap has ran it tells to

  - invoke gl_EARLY in ./configure.ac, right after AC_PROG_CC_C99,

Also AC_USE_SYSTEM_EXTENSIONS is needed to suppress spurious gnulib
warnings.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-09 21:17:52 +01:00
Sami Kerola
3e677d8a24 tests: binding states commit needs to be reflected in expected results
The commit b858a4778b changed a little bit
to which category various binding states fall into.  That has to be
reflected in expected test results.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-09 21:04:24 +01:00
Sami Kerola
7c34231004 build-sys: update git-version-gen from gnulib
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-09 21:04:24 +01:00
Sami Kerola
d2b7d10dbc build-sys: ensure distribution has version file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-09 21:04:23 +01:00
Sami Kerola
327b601ea4 docs: fix spelling mistakes in manual page
Also quote dashes used in EXAMPLEs section.

Reported-by: Helmut Grohne <h.grohne@cygnusnetworks.de>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-09 21:04:23 +01:00
Sami Kerola
5ee1aca2b9 build-sys: add git-version-gen and test.sh to release package
Without this patch autoreconf, when done with release tarball, fails like
this:

$ autoreconf -f -i
sh: 1: build-aux/git-version-gen: not found
configure.ac:12: error: AC_INIT should be called with package and version arguments
/usr/share/aclocal-1.11/init.m4:26: AM_INIT_AUTOMAKE is expanded from...
configure.ac:12: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: /usr/bin/autom4te failed with exit status: 1
autoreconf: aclocal failed with exit status: 1

Further down the road tests start to fail after autoreconf.

make[4]: Leaving directory `/home/grohne/debian/dhcpd-pools-debian/tests'
make[3]: *** No rule to make target `../tests/test.sh', needed by `check-local'.  Stop.
make[3]: Leaving directory `/home/grohne/debian/dhcpd-pools-debian/tests'
make[2]: *** [check-am] Error 2
make[2]: Leaving directory `/home/grohne/debian/dhcpd-pools-debian/tests'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/home/grohne/debian/dhcpd-pools-debian'

Which is a symptom of not having test.sh in distribution.

Reported-by: Helmut Grohne <h.grohne@cygnusnetworks.de>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-09 21:04:19 +01:00
Cheer Xiao
b858a4778b getdata: treat binding states abandoned, expired and release like free 2013-04-07 20:16:44 +08:00
Sami Kerola
cdf2c81f31 build-sys: update .gitignore
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-05 23:21:49 +01:00
Sami Kerola
c3e492165c cppcheck: fix variable scoping
[src/dhcpd-pools.c:68]: (style) The scope of the variable 'c' can be reduced.
[src/getdata.c:210]: (style) The scope of the variable 'c' can be reduced.
[src/hash.c:102]: (style) The scope of the variable 'l' can be reduced.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-05 23:13:10 +01:00
Sami Kerola
23aae87356 include: add missing declarations to dhcpd-pool.h
This will fix eight warnings similar to the example below.

sort.c:104:5: warning: no previous declaration for 'comp_ip' [-Wmissing-declarations]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-03-08 23:38:25 +00:00
Sami Kerola
8e2da89c88 tests: add complete check including multiple ranges and shared networks
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-16 12:56:22 +00:00
Sami Kerola
f3a476ba52 release: 2.21
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-15 20:30:32 +00:00
Sami Kerola
625c54d834 docs: fix doxygen make distcheck breakage
The docs directory needs to be handled properly, e.g., create Makefile
which nothing, when doxygen is not enabled.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-15 20:28:26 +00:00
Sami Kerola
e50d0a7d38 tests: fix make distcheck
It is best to make dhcpd-pools used from PATH, which makes out of tree
build check to work.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-15 20:28:26 +00:00
Sami Kerola
34f73dbae1 docs: thanks to Cheer Xiao this software has IPv6 support
The prof. Xing Li in Tsinghua University, with LI Zimu, asked Cheer to
make the dhcpd-pools more usable for them which I, as a project
maintainer, could not be more pleased.  Whils making the IPv6 analysis to
work Cheer also fixed various other issues.  Kudos to him, and big thanks
to everyone.

CC: Xing Li <xing@cernet.edu.cn>
CC: LI Zimu <lzm@cernet.edu.cn>
CC: Cheer Xiao <xiaqqaix@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-15 17:41:38 +00:00
Sami Kerola
632e97834b build-sys: update .gitignore files
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-15 17:30:01 +00:00
Sami Kerola
3be3f34bd4 build-sys: allow tests run parallel
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-15 17:27:50 +00:00
Cheer Xiao
478bbe1b44 output: fix doc of output_double 2013-01-09 10:19:06 +08:00
Cheer Xiao
ff7ca8c419 tests: update expected/v6
The range size in the old file was also incorrect.
2013-01-08 23:00:57 +08:00
Cheer Xiao
75d979bb00 sort: let comp_* functions compare double 2013-01-08 22:59:35 +08:00
Cheer Xiao
9c4184bd9a counting: Let get_range_size return double 2013-01-08 22:57:33 +08:00
Cheer Xiao
afd9f77051 sort: let field_selector return NULL at the end 2013-01-08 22:57:07 +08:00
Cheer Xiao
6820c9fc09 fix: Put prototype of field_selector back to dhcpd-pools.h
It's needed in main to check unknown field selectors.
2013-01-08 22:52:54 +08:00
Cheer Xiao
6642335c8a counting & output: Convert all counters to double 2013-01-08 22:47:50 +08:00