Commit graph

373 commits

Author SHA1 Message Date
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
Cheer Xiao
39e1fb9e5a sort: Get rid of global comparer 2013-01-08 22:41:41 +08:00
Cheer Xiao
137c1d37c2 sort: Use a comparer instead of returner
This resolves the FIXME of sorting ranges according to first_ip in IPv6 mode.
2013-01-08 22:41:36 +08:00
Sami Kerola
4051a953bd smatch scan: fix few warnings
dhcpd-pools.h:79:17: warning: comma at end of enumerator list [-pedantic]
hash.c:85 delete_lease() info: redundant null check on lease->ethernet calling free()

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-20 20:04:06 +00:00
Sami Kerola
70c65f4d59 getdata: be consistant with symbolic numbers
The program counts quotes, which is never true/false value, and one of
the symbolic parse state values was missed in bd5ee58.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-09 23:38:37 +00:00
Sami Kerola
51143b6b3c clean up: fix few indentation slips
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-09 23:28:58 +00:00
Sami Kerola
82df7c98d4 clean up: rename get_order() to merge() and mark static
No other function than mergesort_ranges() can use the merge(), so calling
it with rather generic name and making it static seems right to me.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-09 23:26:03 +00:00
Sami Kerola
bd5ee58a3f clean up: convert parsing magic numbers to symbolic values
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-09 23:26:03 +00:00
Sami Kerola
4b014eba1c clean up: use enum as symbolic bit masks
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-09 23:25:57 +00:00
Sami Kerola
d3ee104a59 clean up: move global variables to config structure
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-09 22:56:07 +00:00
Sami Kerola
b59e980cab hash: make delete to use HASH_ITER if it is available
This commit also makes the functions ansi C compliant by adding void to
function argument list.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-09 22:43:32 +00:00
Sami Kerola
a9d2d9c82f clean up: move code to more proper location
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-09 22:40:00 +00:00
Sami Kerola
2008e1a047 clean up: remove unused functions
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-09 22:27:58 +00:00
Sami Kerola
f1411858cb backup counting: fix output regression
The backup count was not printed at all.  This bug was introduced in
version 2.17 (May 2012) when the uthash was taken in use.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-09 22:15:14 +00:00
Sami Kerola
3471c91796 docs: add doxygen tags, configuration file, and autotooling
When ./configure --enable-doxygen is used one can browse internal api
documentation from docs/html directory.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-09 21:06:32 +00:00
Sami Kerola
aa7928b3ab output ethernet: do not crash if ethernet is missing
Real dhcpd.leases file should always have ethernet address markup, but
test data or malformed files might not have.  Even if the check is 99.99%
useless there are the corner cases, and crashing at them is not good.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-07 22:32:28 +00:00
Sami Kerola
fdc560bab9 ouput format: fix active lease printing
Earlier ethernet address collection did not remove duplicated.  Basically
the problem was the same as in problem fixed in commit
ae7747db87, but this time affecting only
the ethernet addresses.  The fix is, as one can see, to make ethernet
collection to share structure with the lease, so that if one is wrong
both are wrong the same way.

Reported-by: Gilles Bouthenot <gilles.bouthenot@univ-fcomte.fr>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-07 21:55:06 +00:00
Sami Kerola
d8aae53968 tests: add json tests, and make fail output loud
Gilles reported the full-json is currently broken, which the new check
demonstrates.  Luckily the issue occurs only when active leases details
are being queried, leaving the count to be correct.  That said bug is a
bug, and that should be corrected.

Reported-by: Gilles Bouthenot <gilles.bouthenot@univ-fcomte.fr>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-07 20:25:21 +00:00
Sami Kerola
a768049f3e json output: use defined output file for all printing
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-07 20:12:34 +00:00
Gilles Bouthenot
443b197901 contrib: add munin plugins
Signed-off-by: Gilles Bouthenot <gilles.bouthenot@univ-fcomte.fr>
2012-12-05 18:18:03 +00:00
Gilles Bouthenot
bc654bcc68 json output: bugfix: correct range specify only first ip
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Gilles Bouthenot <gilles.bouthenot@univ-fcomte.fr>
2012-12-05 18:05:08 +00:00
Gilles Bouthenot
e9d196e816 json output: remove useless, empty fields
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Gilles Bouthenot <gilles.bouthenot@univ-fcomte.fr>
2012-12-05 18:04:19 +00:00
Gilles Bouthenot
48a23c94e5 json output: add newline at end
And remove extra empty lines where they are not needed.

Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Gilles Bouthenot <gilles.bouthenot@univ-fcomte.fr>
2012-12-05 18:02:51 +00:00
Sami Kerola
d34259092d build-sys: more clean ups
The gnulib will set AC_GNU_SOURCE equivivelant if necessary.  The awk is
relevant only for contrib stuff, and compiler program was something I had
not understood quite right some years ago when I added it.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-04 22:08:15 +00:00
Gilles Bouthenot
a302bc6829 output: add json format support
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Gilles Bouthenot <gilles.bouthenot@univ-fcomte.fr>
2012-12-04 21:30:09 +00:00
Sami Kerola
179e2ac147 output: remove unnecessary new line printing
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-02 21:36:39 +00:00
Sami Kerola
a2fa69a403 tests: add v6 check
The counting of total maximum address space seems to be broken at the
moment, and the check is expected to fail until a counting fix is
available.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-02 21:33:07 +00:00
Sami Kerola
1424db9427 build-sys: update .gitignore
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-12-02 20:41:06 +00:00
Cheer Xiao
a57d399643 IPv6: add DHCPv6 support
The DHCP version is determined according to the first IP address that
appears in the configuration file.  Caveat; counters are of native long
type.  Since IPv6 address space has 2^128 addresses, they are subject to
overflow.

[Sami Kerola:  This commit also fixed a percent sorting bug, which has
been broken always.  See changes ret_percent() for the fix.]

CC: LI Zimu <lzm@cernet.edu.cn>
CC: Xing Li <xing@cernet.edu.cn>
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Cheer Xiao <xiaqqaix@gmail.com>
2012-12-02 20:35:54 +00:00
Sami Kerola
71bcee14e9 tests: add basic tests
The tests can be ran using 'make check'.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-29 21:02:40 +00:00
Sami Kerola
6684772550 tools: add indent command configuration file
And reindent all files.

Reference: http://www.gnu.org/software/indent/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-28 19:57:19 +00:00
Sami Kerola
761c9560d7 build-sys: remove c++ compiler check
I have no idea why that was there.  My guess is that I had no idea at the
time I added the line what it does.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-28 19:48:10 +00:00
Sami Kerola
3e0faec144 release: 2.20
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-25 18:25:56 +00:00
Sami Kerola
7685d08cf0 man: fix errors in alarm warning and critical options text
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-25 18:23:38 +00:00
Sami Kerola
9df90042e2 build-sys: make alarm warning & critical default configurable
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-25 18:03:19 +00:00
Sami Kerola
7e403b50b4 build-sys: clean up configure.ac
Remove checks that are done in gnulib, and reindent autotools code.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-25 18:03:19 +00:00
Sami Kerola
c66d13774b build-sys: update gitignore
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-25 18:03:19 +00:00
Sami Kerola
c48a8d411f man: use configured dhcpd.conf and dhcpd.leases paths
Making dhcpd.conf and dhcpd.leases file references being dynamic causes
manual contents being replaced at compile time, so make some other data
items dynamic as well.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-25 18:03:13 +00:00
Sami Kerola
822ca33804 getdata & analyze: fix first_ip and last_ip arithmetics
There were too clever tricks done with first and last.  Earlier the aim
was to minimize '<=' and '>=' by fiddling with the numbers at the time
when they were saved.  While the program logic seemed to work there were
some off by one mistakes, resulting to a count error.  Even worse there
is not even that many of such comparisons, so that one cannot really even
justify added complexity.  I really hope this patch is last this kind fix
ever needed.

Reported-by: Cheer Xiao <xiaqqaix@gmail.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-21 21:50:09 +00:00
Sami Kerola
83e12457bc docs: fix spelling mistakes
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-20 21:09:53 +00:00
Cheer Xiao
88d989bbe2 Fix spelling mistakes. 2012-11-20 20:53:30 +00:00