Commit graph

441 commits

Author SHA1 Message Date
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
Cheer Xiao
1b56bafaf5 Replace all htonl in getdata.c with ntohl.
They are always the same macro, but the semantics was wrong.
2012-11-20 20:53:30 +00:00
Cheer Xiao
dc83f1ffd4 ignore /gnulib/ 2012-11-20 20:53:29 +00:00
Sami Kerola
0a0fea05ad xstrstr: add function attributes
The pointers arguments are never null, and the function should be
optimized as much as possible.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-12 19:19:18 +00:00
Sami Kerola
34f99d2f08 header: let gnulib do what it is best of
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-12 19:19:17 +00:00
Sami Kerola
acba2e265e (un)likely: use __builtin_expect to inform expected path
Remove also unnecessary comparison in getdata nth_field().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-12 19:19:01 +00:00
Sami Kerola
6f179db03d sort: fix get_order() if else return statement
Another instance of where returns happen in else clause removed.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-10 00:22:32 +00:00
Sami Kerola
6f4104acbc analyze: use gnulib
The gnulib is grippled without config.h in use.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-10 00:09:43 +00:00
Sami Kerola
4341d92d41 getdata: skip strings before nth_field analysis
This will allow nth_field function to begin from first field, and stop
immediately when it ends, which makes function much more simple and quite
a bit quicker.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-10 00:07:09 +00:00
Sami Kerola
b918e9157d getdata: stop looking after interesting field
The nth_field function continued looking for words after they where known
not to be interesting.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-09 22:52:30 +00:00
Sami Kerola
5f59daa692 analyze, getdata: write functions in frequency order
According to test data free is seen most often in leases file.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-09 22:20:04 +00:00
Sami Kerola
72a41d8086 getdata: fix if else return statements
If something is true, and it returns using else is pointless.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-09 21:39:43 +00:00
Sami Kerola
629796cce7 sort: fix if else return statements
If something is true, and it returns using else is pointless.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-09 07:55:48 +00:00
Sami Kerola
18f2835fd5 analyze: sort ranges before analysis
At the other day I where wondering why so much time was spent on analysis
function, when I realized regression.  At the time uthash was introduced
to the project range sorting got to be dropped, which caused same leases
to be walked in analysis time after time.

Now when the regression is removed, and the test cases run about 28% over
all quicker.  The rule of thumb is that the greater the data set the
bigger is the benefit having this fix.  My largest test data is now
roughly 35% faster.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-08 22:02:02 +00:00
Sami Kerola
7a86746710 analyze: use simpler comparison
In some cases the this can make run time to take 2.5% less time.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-07 21:42:18 +00:00
Sami Kerola
5714e95228 release: 2.19
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-06 20:15:59 +00:00
Sami Kerola
31c506ee73 build-sys: update gitignore
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-06 20:09:48 +00:00
Sami Kerola
22bf014ab5 docs: mention gnulib in README file
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-06 19:59:32 +00:00
Sami Kerola
c8a348e93b build-sys: remove files which where added by accident
Sometimes I do not seem to be careful enough when committing.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-06 19:50:54 +00:00
Sami Kerola
b61c93b7a1 performance: add few restict and const key words
This should make the run to be couple percentages quicker.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-05 21:05:42 +00:00
Sami Kerola
dbf3927c39 build-sys: clean gnulib & autotools checks
Add gnulib modules which make sense and remove few.  The stuff gnulib
takes care can be dropped from configure.am.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-05 20:30:53 +00:00
Sami Kerola
ab699e71ad build-sys: add gnulib
This will mean better portability, and a good reason to get rid of
various portability autotools directives which where part of this
project.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-05 00:03:03 +00:00
Sami Kerola
b5e518cd5e docs: clarify man page
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-10-09 22:01:49 +01:00
Sami Kerola
7eb2e42625 build-sys: be conservative about posix_fadvice
Check that function availability before use.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-10-09 21:52:19 +01:00
Sami Kerola
14d7183c3d build-sys: add what autoscan found bein missing
configure.ac: warning: missing AC_CHECK_FUNCS([atexit]) wanted by: src/dhcpd-pools.c:88
configure.ac: warning: missing AC_CHECK_HEADERS([limits.h]) wanted by: src/dhcpd-pools.c:55
configure.ac: warning: missing AC_FUNC_ERROR_AT_LINE wanted by: src/other.c:213
configure.ac: warning: missing AC_FUNC_STRTOD wanted by: src/other.c:148

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-10-09 21:31:43 +01:00
Sami Kerola
b15e63afd2 output: fix sign-compare warning [clang]
output.c:819:17: warning: comparison of integers of different signs:
'int' and ' unsigned int' [-Wsign-compare]
                for (i = 0; i < num_ranges; i++) {
                            ~ ^ ~~~~~~~~~~
output.c:832:17: warning: comparison of integers of different signs:
'int' and ' unsigned int' [-Wsign-compare]
                for (i = 0; i < num_shared_networks; i++) {
                            ~ ^ ~~~~~~~~~~~~~~~~~~~

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-10-08 19:39:26 +01:00
Sami Kerola
e8acaa42c8 build-sys: use AM_CPPFLAGS rather than INCLUDES
The INCLUDES is an older name for the same functionality as AM_CPPFLAGS.

References: http://www.gnu.org/software/automake/manual/html_node/Program-Variables.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-09-30 20:45:35 +01:00
Sami Kerola
6817d234ca style: fix few indentation issues
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-17 17:59:39 +02:00
Sami Kerola
b3e02ce0ba all: fix compiler warninings
Use compiler warnings from coreutils to check nothing complains, and
fix everything that did.

CFLAGS='-Wall -W -Wformat-y2k -Wformat-security -Winit-self
-Wmissing-include-dirs -Wunused -Wunknown-pragmas -Wstrict-aliasing
-Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align
-Wwrite-strings -Wmissing-declarations -Wmissing-noreturn -Wpacked
-Winvalid-pch -Wvolatile-register-var -Wdisabled-optimization
-Woverlength-strings -Wbuiltin-macro-redefined -Wmudflap
-Wpacked-bitfield-compat -Wsync-nand -Wattributes -Wcoverage-mismatch
-Wabi -Wcpp -Wdeprecated -Wdeprecated-declarations -Wdiv-by-zero
-Wendif-labels -Wextra -Wformat-contains-nul -Wformat-extra-args
-Wformat-zero-length -Wformat=2 -Wmultichar -Wnormalized=nfc -Woverflow
-Wpointer-to-int-cast -Wpragmas -Wsuggest-attribute=noreturn
-Wtrampolines -Wno-sign-compare -Wno-unused-parameter
-Wsuggest-attribute=noreturn -Wno-format-nonliteral -Wno-logical-op
-fdiagnostics-show-option -funit-at-a-time'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-17 17:59:39 +02:00
Sami Kerola
37563d8d59 build-sys: create only xz compressed distribution package
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-26 10:10:40 +02:00
Sami Kerola
7600d32b89 contrib: add nagios.conf example
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-26 10:06:27 +02:00
Sami Kerola
a05d793378 docs: add note how to limit alarming scope
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-24 16:51:33 +02:00
Sami Kerola
dd5bc03f12 docs: add examples to manual page
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-24 16:41:22 +02:00