From 631bf0bf7cb3af35f532ff124138a414c22ae610 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 8 Nov 2013 19:19:27 +0000 Subject: [PATCH 001/224] build-sys: use more strict method to check __builtin_expect The problem with the detection of gcc's __builtin_expect, the autoconf set up uses EX_COMPILE_IFELSE which only compiles the test code with gcc -c, it does not link so a missing __builtin_expect is treated as a missing symbol and is not detected. Reported-by: Conor McCarthy Signed-off-by: Sami Kerola --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ae5bd63..e062c58 100644 --- a/configure.ac +++ b/configure.ac @@ -70,7 +70,7 @@ AC_CHECK_FUNCS([\ ]) AC_MSG_CHECKING([if the compiler supports __builtin_expect]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ +AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return __builtin_expect(1, 1) ? 1 : 0 ]])],[ have_builtin_expect=yes From 48caf5fb42385916be29efe67764577d0ec0bb6f Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 8 Nov 2013 19:21:19 +0000 Subject: [PATCH 002/224] getdata: add missing HAVE_POSIX_FADVISE protection Reported-by: Conor McCarthy Signed-off-by: Sami Kerola --- src/getdata.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/getdata.c b/src/getdata.c index f9fa61f..e93bbad 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -202,16 +202,18 @@ void parse_config(int is_include, const char *restrict config_file, if (dhcpd_config == NULL) { err(EXIT_FAILURE, "parse_config: %s", config_file); } -#ifdef POSIX_FADV_NOREUSE - if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_NOREUSE) != 0) { - err(EXIT_FAILURE, "parse_config: fadvise %s", config_file); - } -#endif /* POSIX_FADV_NOREUSE */ -#ifdef POSIX_FADV_SEQUENTIAL - if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) { - err(EXIT_FAILURE, "parse_config: fadvise %s", config_file); - } -#endif /* POSIX_FADV_SEQUENTIAL */ +#ifdef HAVE_POSIX_FADVISE +# ifdef POSIX_FADV_NOREUSE +if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_NOREUSE) != 0) { + err(EXIT_FAILURE, "parse_config: fadvise %s", config_file); +} +# endif /* POSIX_FADV_NOREUSE */ +# ifdef POSIX_FADV_SEQUENTIAL +if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) { + err(EXIT_FAILURE, "parse_config: fadvise %s", config_file); +} +# endif /* POSIX_FADV_SEQUENTIAL */ +#endif /* HAVE_POSIX_FADVISE */ /* Very hairy stuff begins. */ while (unlikely(!feof(dhcpd_config))) { From 7fc354827a4598adb008bc94f94d40fff111cd61 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 8 Nov 2013 19:33:13 +0000 Subject: [PATCH 003/224] getdata: fix consecutive range definition regression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The added test demonstrates the issue. If a did not end with whitespace it was skipped. Reported-by: Fredrik Lysén Signed-off-by: Sami Kerola --- src/getdata.c | 1 + tests/Makemodule.am | 1 + tests/confs/one-line | 1 + tests/expected/one-line | 1 + tests/expected/simple | 3 ++- tests/leases/one-line | 1 + tests/one-line | 1 + 7 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/confs/one-line create mode 120000 tests/expected/one-line create mode 120000 tests/leases/one-line create mode 120000 tests/one-line diff --git a/src/getdata.c b/src/getdata.c index e93bbad..cd99013 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -263,6 +263,7 @@ if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) { * * ...to be interpreted correctly. */ c = ' '; + break; } else if (argument == ITS_A_RANGE_SECOND_IP && i == 0) { range_p->last_ip = range_p->first_ip; goto newrange; diff --git a/tests/Makemodule.am b/tests/Makemodule.am index d309b9b..f58a38f 100644 --- a/tests/Makemodule.am +++ b/tests/Makemodule.am @@ -14,6 +14,7 @@ TESTS = \ tests/full-json \ tests/leading0 \ tests/one-ip \ + tests/one-line \ tests/same-twice \ tests/simple \ tests/v6 diff --git a/tests/confs/one-line b/tests/confs/one-line new file mode 100644 index 0000000..2e25692 --- /dev/null +++ b/tests/confs/one-line @@ -0,0 +1 @@ +pool {range 10.0.0.1 10.0.0.5;range 10.0.0.6 10.0.0.10;} diff --git a/tests/expected/one-line b/tests/expected/one-line new file mode 120000 index 0000000..8fd3246 --- /dev/null +++ b/tests/expected/one-line @@ -0,0 +1 @@ +simple \ No newline at end of file diff --git a/tests/expected/simple b/tests/expected/simple index da14b05..f1af1ed 100644 --- a/tests/expected/simple +++ b/tests/expected/simple @@ -1,6 +1,7 @@ Ranges: shared net name first ip last ip max cur percent touch t+c t+c perc -All networks 10.0.0.1 - 10.0.0.10 10 10 100.000 0 10 100.000 +All networks 10.0.0.1 - 10.0.0.5 5 5 100.000 0 5 100.000 +All networks 10.0.0.6 - 10.0.0.10 5 5 100.000 0 5 100.000 Shared networks: name max cur percent touch t+c t+c perc diff --git a/tests/leases/one-line b/tests/leases/one-line new file mode 120000 index 0000000..8fd3246 --- /dev/null +++ b/tests/leases/one-line @@ -0,0 +1 @@ +simple \ No newline at end of file diff --git a/tests/one-line b/tests/one-line new file mode 120000 index 0000000..61a58b0 --- /dev/null +++ b/tests/one-line @@ -0,0 +1 @@ +test.sh \ No newline at end of file From 6b88e8d872f718c7932acfa3d8b225499205237b Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 8 Nov 2013 20:50:26 +0000 Subject: [PATCH 004/224] man: add tip analysis of include files can be useful MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported-by: Fredrik Lysén Signed-off-by: Sami Kerola --- man/dhcpd-pools.1.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/man/dhcpd-pools.1.in b/man/dhcpd-pools.1.in index 144eebb..28b2fc5 100644 --- a/man/dhcpd-pools.1.in +++ b/man/dhcpd-pools.1.in @@ -49,7 +49,9 @@ only if there is failover configuration. .SH OPTIONS .TP \fB\-c\fR, \fB\-\-config\fR=\fIFILE\fR -Path to the dhcpd.conf file. +Path to the dhcpd.conf file. If the dhcpd.conf has include files they +can be analysed separately, that can be useful when trying to understand +or monitor subset of data. .TP \fB\-l\fR, \fB\-\-leases\fR=\fIFILE\fR Path to the dhcpd.leases file. From affb3d70a3b13e23d85697340c91800e279bdcb9 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 8 Nov 2013 21:01:21 +0000 Subject: [PATCH 005/224] =?UTF-8?q?thanks:=20add=20Fredrik=20Lys=C3=A9n=20?= =?UTF-8?q?&=20Conor=20McCarthy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sami Kerola --- THANKS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/THANKS b/THANKS index 64c70f5..8c18c15 100644 --- a/THANKS +++ b/THANKS @@ -29,3 +29,5 @@ Helmut Grohne Joey D. Ryan Steinmetz Dan Pritts +Fredrik Lysén +Conor McCarthy From d089a19fb52e8c598ea5c316fa9be08b7758e3f4 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 17 Nov 2013 18:11:28 +0000 Subject: [PATCH 006/224] generic: use pure and const function attributes when possible Signed-off-by: Sami Kerola --- src/dhcpd-pools.h | 76 +++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/src/dhcpd-pools.h b/src/dhcpd-pools.h index 29d5e4c..b27b85b 100644 --- a/src/dhcpd-pools.h +++ b/src/dhcpd-pools.h @@ -64,6 +64,28 @@ # define unlikely(x) (x) # endif +/* The __attribute__ feature is available in gcc versions 2.5 and later. + * The attribute __pure__ was added in gcc 2.96. */ +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _DP_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _DP_ATTRIBUTE_PURE /* empty */ +# endif + +/* The __const__ attribute was added in gcc 2.95. */ +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +# define _DP_ATTRIBUTE_CONST __attribute__ ((__const__)) +# else +# define _DP_ATTRIBUTE_CONST /* empty */ +# endif + +/* The attribute __hot__ was added in gcc 4.3. */ +# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +# define _DP_ATTRIBUTE_HOT __attribute__ ((__hot__)) +# else +# define _DP_ATTRIBUTE_HOT /* empty */ +# endif + /*! \union ipaddr_t * \brief Memory space for a binary IP address saving. */ union ipaddr_t { @@ -201,41 +223,29 @@ void flip_ranges(struct range_t *__restrict ranges, __attribute__ ((nonnull(1, 2))); /* support functions */ int (*parse_ipaddr)(const char *restrict src, union ipaddr_t *restrict dst); -int parse_ipaddr_init(const char *restrict src, union ipaddr_t *restrict dst); +int parse_ipaddr_init(const char *restrict src, union ipaddr_t *restrict dst) _DP_ATTRIBUTE_CONST; int parse_ipaddr_v4(const char *restrict src, union ipaddr_t *restrict dst); int parse_ipaddr_v6(const char *restrict src, union ipaddr_t *restrict dst); void (*copy_ipaddr)(union ipaddr_t *restrict dst, const union ipaddr_t *restrict src); -void copy_ipaddr_init(union ipaddr_t *restrict dst, const union ipaddr_t *restrict src); +void copy_ipaddr_init(union ipaddr_t *restrict dst, const union ipaddr_t *restrict src) _DP_ATTRIBUTE_CONST; void copy_ipaddr_v4(union ipaddr_t *restrict dst, const union ipaddr_t *restrict src); void copy_ipaddr_v6(union ipaddr_t *restrict dst, const union ipaddr_t *restrict src); const char *(*ntop_ipaddr)(const union ipaddr_t *ip); -const char *ntop_ipaddr_init(const union ipaddr_t *ip); +const char *ntop_ipaddr_init(const union ipaddr_t *ip) _DP_ATTRIBUTE_CONST; const char *ntop_ipaddr_v4(const union ipaddr_t *ip); const char *ntop_ipaddr_v6(const union ipaddr_t *ip); double (*get_range_size)(const struct range_t *r); -double get_range_size_init(const struct range_t *r); -double get_range_size_v4(const struct range_t *r); -double get_range_size_v6(const struct range_t *r); +double get_range_size_init(const struct range_t *r) _DP_ATTRIBUTE_CONST; +double get_range_size_v4(const struct range_t *r) _DP_ATTRIBUTE_PURE; +double get_range_size_v6(const struct range_t *r) _DP_ATTRIBUTE_PURE; int (*xstrstr)(const char *__restrict str); -int xstrstr_init(const char *__restrict str) -# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) - __attribute__ ((__hot__)) -# endif - ; -int xstrstr_v4(const char *__restrict str) -# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) - __attribute__ ((__hot__)) -# endif - ; -int xstrstr_v6(const char *__restrict str) -# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) - __attribute__ ((__hot__)) -# endif - ; +int xstrstr_init(const char *__restrict str) _DP_ATTRIBUTE_CONST; +int xstrstr_v4(const char *__restrict str) _DP_ATTRIBUTE_HOT _DP_ATTRIBUTE_PURE; +int xstrstr_v6(const char *__restrict str) _DP_ATTRIBUTE_HOT _DP_ATTRIBUTE_PURE; double strtod_or_err(const char *__restrict str, const char *__restrict errmesg); @@ -244,25 +254,25 @@ void usage(int status) __attribute__ ((noreturn)); /* qsort required functions... */ /* ...for ranges and... */ int (*ipcomp)(const union ipaddr_t *restrict a, const union ipaddr_t *restrict b); -int ipcomp_init(const union ipaddr_t *restrict a, const union ipaddr_t *restrict b); -int ipcomp_v4(const union ipaddr_t *restrict a, const union ipaddr_t *restrict b); -int ipcomp_v6(const union ipaddr_t *restrict a, const union ipaddr_t *restrict b); +int ipcomp_init(const union ipaddr_t *restrict a, const union ipaddr_t *restrict b) _DP_ATTRIBUTE_CONST; +int ipcomp_v4(const union ipaddr_t *restrict a, const union ipaddr_t *restrict b) _DP_ATTRIBUTE_PURE; +int ipcomp_v6(const union ipaddr_t *restrict a, const union ipaddr_t *restrict b) _DP_ATTRIBUTE_PURE; -int comp_cur(struct range_t *r1, struct range_t *r2); -int comp_double(double f1, double f2); +int comp_cur(struct range_t *r1, struct range_t *r2) _DP_ATTRIBUTE_PURE; +int comp_double(double f1, double f2) _DP_ATTRIBUTE_CONST; int comp_ip(struct range_t *r1, struct range_t *r2); int comp_max(struct range_t *r1, struct range_t *r2); int comp_percent(struct range_t *r1, struct range_t *r2); -int comp_tc(struct range_t *r1, struct range_t *r2); +int comp_tc(struct range_t *r1, struct range_t *r2) _DP_ATTRIBUTE_PURE; int comp_tcperc(struct range_t *r1, struct range_t *r2); -int comp_touched(struct range_t *r1, struct range_t *r2); +int comp_touched(struct range_t *r1, struct range_t *r2) _DP_ATTRIBUTE_PURE; int rangecomp(const void *__restrict r1, const void *__restrict r2) __attribute__ ((nonnull(1, 2))); /* sort function pointer and functions */ typedef int (*comparer_t) (struct range_t *r1, struct range_t *r2); comparer_t field_selector(char c); double ret_percent(struct range_t r); -double ret_tc(struct range_t r); +double ret_tc(struct range_t r) _DP_ATTRIBUTE_CONST; double ret_tcperc(struct range_t r); void mergesort_ranges(struct range_t *__restrict orig, int size, struct range_t *__restrict temp) @@ -279,14 +289,14 @@ int output_alarming(void); void clean_up(void); /* Hash functions */ void (*add_lease)(union ipaddr_t *ip, enum ltype type); -void add_lease_init(union ipaddr_t *ip, enum ltype type); +void add_lease_init(union ipaddr_t *ip, enum ltype type) _DP_ATTRIBUTE_CONST; void add_lease_v4(union ipaddr_t *ip, enum ltype type); void add_lease_v6(union ipaddr_t *ip, enum ltype type); struct leases_t *(*find_lease)(union ipaddr_t *ip); -struct leases_t *find_lease_init(union ipaddr_t *ip); -struct leases_t *find_lease_v4(union ipaddr_t *ip); -struct leases_t *find_lease_v6(union ipaddr_t *ip); +struct leases_t *find_lease_init(union ipaddr_t *ip) _DP_ATTRIBUTE_CONST; +struct leases_t *find_lease_v4(union ipaddr_t *ip) _DP_ATTRIBUTE_PURE; +struct leases_t *find_lease_v6(union ipaddr_t *ip) _DP_ATTRIBUTE_PURE; void delete_lease(struct leases_t *lease); void delete_all_leases(void); From ca0b1c326246fc609390b6390ff4cc0e5d8caabc Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 17 Nov 2013 18:39:47 +0000 Subject: [PATCH 007/224] tests: fix testing error The commit 7fc354827a4598adb008bc94f94d40fff111cd61 introduced an symlink that end up to update simple test causing it to break. Signed-off-by: Sami Kerola --- tests/expected/one-line | 12 +++++++++++- tests/expected/simple | 3 +-- 2 files changed, 12 insertions(+), 3 deletions(-) mode change 120000 => 100644 tests/expected/one-line diff --git a/tests/expected/one-line b/tests/expected/one-line deleted file mode 120000 index 8fd3246..0000000 --- a/tests/expected/one-line +++ /dev/null @@ -1 +0,0 @@ -simple \ No newline at end of file diff --git a/tests/expected/one-line b/tests/expected/one-line new file mode 100644 index 0000000..f1af1ed --- /dev/null +++ b/tests/expected/one-line @@ -0,0 +1,11 @@ +Ranges: +shared net name first ip last ip max cur percent touch t+c t+c perc +All networks 10.0.0.1 - 10.0.0.5 5 5 100.000 0 5 100.000 +All networks 10.0.0.6 - 10.0.0.10 5 5 100.000 0 5 100.000 + +Shared networks: +name max cur percent touch t+c t+c perc + +Sum of all ranges: +name max cur percent touch t+c t+c perc +All networks 10 10 100.000 0 10 100.000 diff --git a/tests/expected/simple b/tests/expected/simple index f1af1ed..da14b05 100644 --- a/tests/expected/simple +++ b/tests/expected/simple @@ -1,7 +1,6 @@ Ranges: shared net name first ip last ip max cur percent touch t+c t+c perc -All networks 10.0.0.1 - 10.0.0.5 5 5 100.000 0 5 100.000 -All networks 10.0.0.6 - 10.0.0.10 5 5 100.000 0 5 100.000 +All networks 10.0.0.1 - 10.0.0.10 10 10 100.000 0 10 100.000 Shared networks: name max cur percent touch t+c t+c perc From f3e282f12296728cfc2d174b9d67713294976417 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Mon, 24 Mar 2014 21:07:55 +0000 Subject: [PATCH 008/224] 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 --- src/output.c | 28 ++++++++++++++++++++-------- tests/expected/alarm-critical | 3 ++- tests/expected/alarm-critical-ranges | 3 ++- tests/expected/alarm-critical-snets | 2 +- tests/expected/alarm-ignore | 3 ++- tests/expected/alarm-ok | 3 ++- tests/expected/alarm-shared-ok | 2 +- tests/expected/alarm-warning | 3 ++- tests/expected/alarm-warning-ranges | 3 ++- tests/expected/alarm-warning-snets | 2 +- 10 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/output.c b/src/output.c index bc94b74..112819d 100644 --- a/src/output.c +++ b/src/output.c @@ -1072,32 +1072,44 @@ int output_alarming(void) } if ((0 < rc && config.output_limit[1] & BIT1) || (0 < sc && config.output_limit[1] & BIT2)) { ret_val = 2; - fprintf(outfile, "CRITICAL: %s: ", + fprintf(outfile, "CRITICAL: %s:", program_name); } else if ((0 < rw && config.output_limit[1] & BIT1) || (0 < sw && config.output_limit[1] & BIT2)) { ret_val = 1; - fprintf(outfile, "WARNING: %s: ", + fprintf(outfile, "WARNING: %s:", program_name); } else { ret_val = 0; if (config.output_limit[1] & BIT3) - fprintf(outfile, "OK: "); + fprintf(outfile, "OK:"); else return ret_val; } if (config.output_limit[0] & BIT1) { - fprintf(outfile, "Ranges; crit: %d warn: %d ok: %d ", rc, rw, + fprintf(outfile, " Ranges - crit: %d warn: %d ok: %d", rc, rw, ro); if (ri != 0) { - fprintf(outfile, "ignored: %d ", ri); + fprintf(outfile, " ignored: %d", ri); } - + fprintf(outfile, "; | range_crit=%d range_warn=%d range_ok=%d", rc, rw, + ro); + if (ri != 0) { + fprintf(outfile, " range_ignored=%d", ri); + } + fprintf(outfile, "\n"); + } else { + fprintf(outfile, " "); } if (config.output_limit[0] & BIT2) { - fprintf(outfile, "Shared nets; crit: %d warn: %d ok: %d", sc, + fprintf(outfile, "Shared nets - crit: %d warn: %d ok: %d", sc, sw, so); if (si != 0) { - fprintf(outfile, "ignored: %d ", si); + fprintf(outfile, " ignored: %d", si); + } + fprintf(outfile, "; | snet_crit=%d snet_warn=%d snet_ok=%d", sc, + sw, so); + if (si != 0) { + fprintf(outfile, " snet_ignored=%d\n", si); } } fprintf(outfile, "\n"); diff --git a/tests/expected/alarm-critical b/tests/expected/alarm-critical index fe0b242..1a26624 100644 --- a/tests/expected/alarm-critical +++ b/tests/expected/alarm-critical @@ -1,2 +1,3 @@ -CRITICAL: dhcpd-pools: Ranges; crit: 1 warn: 0 ok: 4 Shared nets; crit: 1 warn: 0 ok: 1 +CRITICAL: dhcpd-pools: Ranges - crit: 1 warn: 0 ok: 4; | range_crit=1 range_warn=0 range_ok=4 +Shared nets - crit: 1 warn: 0 ok: 1; | snet_crit=1 snet_warn=0 snet_ok=1 2 diff --git a/tests/expected/alarm-critical-ranges b/tests/expected/alarm-critical-ranges index fcb1833..ce1ca4d 100644 --- a/tests/expected/alarm-critical-ranges +++ b/tests/expected/alarm-critical-ranges @@ -1,2 +1,3 @@ -CRITICAL: dhcpd-pools: Ranges; crit: 1 warn: 0 ok: 4 +CRITICAL: dhcpd-pools: Ranges - crit: 1 warn: 0 ok: 4; | range_crit=1 range_warn=0 range_ok=4 + 2 diff --git a/tests/expected/alarm-critical-snets b/tests/expected/alarm-critical-snets index 8f2c02b..b85e2ee 100644 --- a/tests/expected/alarm-critical-snets +++ b/tests/expected/alarm-critical-snets @@ -1,2 +1,2 @@ -CRITICAL: dhcpd-pools: Shared nets; crit: 1 warn: 0 ok: 1 +CRITICAL: dhcpd-pools: Shared nets - crit: 1 warn: 0 ok: 1; | snet_crit=1 snet_warn=0 snet_ok=1 2 diff --git a/tests/expected/alarm-ignore b/tests/expected/alarm-ignore index 18ca9c6..6a20168 100644 --- a/tests/expected/alarm-ignore +++ b/tests/expected/alarm-ignore @@ -1 +1,2 @@ -OK: Ranges; crit: 0 warn: 0 ok: 0 ignored: 1 Shared nets; crit: 0 warn: 0 ok: 0 +OK: Ranges - crit: 0 warn: 0 ok: 0 ignored: 1; | range_crit=0 range_warn=0 range_ok=0 range_ignored=1 +Shared nets - crit: 0 warn: 0 ok: 0; | snet_crit=0 snet_warn=0 snet_ok=0 diff --git a/tests/expected/alarm-ok b/tests/expected/alarm-ok index 7137c5b..2c48043 100644 --- a/tests/expected/alarm-ok +++ b/tests/expected/alarm-ok @@ -1,2 +1,3 @@ -OK: Ranges; crit: 0 warn: 0 ok: 5 Shared nets; crit: 0 warn: 0 ok: 2 +OK: Ranges - crit: 0 warn: 0 ok: 5; | range_crit=0 range_warn=0 range_ok=5 +Shared nets - crit: 0 warn: 0 ok: 2; | snet_crit=0 snet_warn=0 snet_ok=2 0 diff --git a/tests/expected/alarm-shared-ok b/tests/expected/alarm-shared-ok index fb71df9..d34ec23 100644 --- a/tests/expected/alarm-shared-ok +++ b/tests/expected/alarm-shared-ok @@ -1,2 +1,2 @@ -OK: Shared nets; crit: 0 warn: 0 ok: 2 +OK: Shared nets - crit: 0 warn: 0 ok: 2; | snet_crit=0 snet_warn=0 snet_ok=2 0 diff --git a/tests/expected/alarm-warning b/tests/expected/alarm-warning index 1471296..0c597c1 100644 --- a/tests/expected/alarm-warning +++ b/tests/expected/alarm-warning @@ -1,2 +1,3 @@ -WARNING: dhcpd-pools: Ranges; crit: 0 warn: 1 ok: 4 Shared nets; crit: 0 warn: 1 ok: 1 +WARNING: dhcpd-pools: Ranges - crit: 0 warn: 1 ok: 4; | range_crit=0 range_warn=1 range_ok=4 +Shared nets - crit: 0 warn: 1 ok: 1; | snet_crit=0 snet_warn=1 snet_ok=1 1 diff --git a/tests/expected/alarm-warning-ranges b/tests/expected/alarm-warning-ranges index 82d97d9..94b1b98 100644 --- a/tests/expected/alarm-warning-ranges +++ b/tests/expected/alarm-warning-ranges @@ -1,2 +1,3 @@ -WARNING: dhcpd-pools: Ranges; crit: 0 warn: 1 ok: 4 +WARNING: dhcpd-pools: Ranges - crit: 0 warn: 1 ok: 4; | range_crit=0 range_warn=1 range_ok=4 + 1 diff --git a/tests/expected/alarm-warning-snets b/tests/expected/alarm-warning-snets index 636d947..39ad2f0 100644 --- a/tests/expected/alarm-warning-snets +++ b/tests/expected/alarm-warning-snets @@ -1,2 +1,2 @@ -WARNING: dhcpd-pools: Shared nets; crit: 0 warn: 1 ok: 1 +WARNING: dhcpd-pools: Shared nets - crit: 0 warn: 1 ok: 1; | snet_crit=0 snet_warn=1 snet_ok=1 1 From 5454ab70869cb1483a8f76a1a676ec844e655e93 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Mon, 24 Mar 2014 21:38:10 +0000 Subject: [PATCH 009/224] build-sys: update gitinore file Signed-off-by: Sami Kerola --- lib/.gitignore | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/.gitignore b/lib/.gitignore index f22ede0..8208f92 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -1,14 +1,14 @@ -/*.o /*.lo +/*.o /.deps/ /.gitignore~ /.libs/ -/arpa/ /Makefile /Makefile.am /Makefile.in /_Exit.c /arg-nonnull.h +/arpa/ /arpa_inet.in.h /atexit.c /c++defs.h @@ -57,6 +57,7 @@ /getopt1.c /getopt_int.h /gettext.h +/gettimeofday.c /inet_pton.c /intprops.h /langinfo.h @@ -99,6 +100,7 @@ /stdio.in.h /stdlib.h /stdlib.in.h +/stpncpy.c /str-two-way.h /strdup.c /streq.h @@ -115,6 +117,7 @@ /sys_socket.c /sys_socket.in.h /sys_stat.in.h +/sys_time.in.h /sys_types.in.h /sys_uio.in.h /time.h @@ -139,4 +142,3 @@ /xprintf.h /xstrtod.c /xstrtod.h -/stpncpy.c From eb559465952e3369a48bd1c8fab7a10b94f39848 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Mon, 24 Mar 2014 21:56:34 +0000 Subject: [PATCH 010/224] 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 --- src/dhcpd-pools.h | 7 +++++++ src/output.c | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/dhcpd-pools.h b/src/dhcpd-pools.h index b27b85b..90582b5 100644 --- a/src/dhcpd-pools.h +++ b/src/dhcpd-pools.h @@ -191,6 +191,13 @@ enum limbits { BIT3 = 0x4 }; +/*! \def STATE_OK + * \brief Nagios alarm exit value. + */ +#define STATE_OK 0 +#define STATE_WARNING 1 +#define STATE_CRITICAL 2 + /* Global variables */ /* \var prefix_length Length of each prefix. */ int prefix_length[2][NUM_OF_PREFIX]; diff --git a/src/output.c b/src/output.c index 112819d..6720e13 100644 --- a/src/output.c +++ b/src/output.c @@ -1070,16 +1070,21 @@ int output_alarming(void) shared_p++; } } + + if (sc || rc) + ret_val = STATE_CRITICAL; + else if (sw || rw) + ret_val = STATE_WARNING; + else + ret_val = STATE_OK; + if ((0 < rc && config.output_limit[1] & BIT1) || (0 < sc && config.output_limit[1] & BIT2)) { - ret_val = 2; fprintf(outfile, "CRITICAL: %s:", program_name); } else if ((0 < rw && config.output_limit[1] & BIT1) || (0 < sw && config.output_limit[1] & BIT2)) { - ret_val = 1; fprintf(outfile, "WARNING: %s:", program_name); } else { - ret_val = 0; if (config.output_limit[1] & BIT3) fprintf(outfile, "OK:"); else From 0f66becd571e14abea140a55ec7f30481330a963 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 13 Apr 2014 20:55:34 +0100 Subject: [PATCH 011/224] build-sys: update bootstrap script Signed-off-by: Sami Kerola --- bootstrap | 93 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 38 deletions(-) diff --git a/bootstrap b/bootstrap index c69b99f..8c68fea 100755 --- a/bootstrap +++ b/bootstrap @@ -1,10 +1,10 @@ #! /bin/sh # Print a version string. -scriptversion=2013-05-08.20; # UTC +scriptversion=2013-12-05.23; # UTC # Bootstrap this package from checked-out sources. -# Copyright (C) 2003-2013 Free Software Foundation, Inc. +# Copyright (C) 2003-2014 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -210,12 +210,16 @@ bootstrap_sync=false # Use git to update gnulib sources use_git=true +check_exists() { + ($1 --version /dev/null 2>&1 + test $? -lt 126 +} + # find_tool ENVVAR NAMES... # ------------------------- # Search for a required program. Use the value of ENVVAR, if set, -# otherwise find the first of the NAMES that can be run (i.e., -# supports --version). If found, set ENVVAR to the program name, -# die otherwise. +# otherwise find the first of the NAMES that can be run. +# If found, set ENVVAR to the program name, die otherwise. # # FIXME: code duplication, see also gnu-web-doc-update. find_tool () @@ -225,27 +229,21 @@ find_tool () find_tool_names=$@ eval "find_tool_res=\$$find_tool_envvar" if test x"$find_tool_res" = x; then - for i - do - if ($i --version /dev/null 2>&1; then - find_tool_res=$i - break + for i; do + if check_exists $i; then + find_tool_res=$i + break fi done - else - find_tool_error_prefix="\$$find_tool_envvar: " fi - test x"$find_tool_res" != x \ - || die "one of these is required: $find_tool_names" - ($find_tool_res --version /dev/null 2>&1 \ - || die "${find_tool_error_prefix}cannot run $find_tool_res --version" + if test x"$find_tool_res" = x; then + warn_ "one of these is required: $find_tool_names;" + die "alternatively set $find_tool_envvar to a compatible tool" + fi eval "$find_tool_envvar=\$find_tool_res" eval "export $find_tool_envvar" } -# Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6. -find_tool SHA1SUM sha1sum gsha1sum shasum - # Override the default configuration, if necessary. # Make sure that bootstrap.conf is sourced from the current directory # if we were invoked as "sh bootstrap". @@ -257,12 +255,12 @@ esac # Extra files from gnulib, which override files from other sources. test -z "${gnulib_extra_files}" && \ gnulib_extra_files=" - $build_aux/install-sh - $build_aux/mdate-sh - $build_aux/texinfo.tex - $build_aux/depcomp - $build_aux/config.guess - $build_aux/config.sub + build-aux/install-sh + build-aux/mdate-sh + build-aux/texinfo.tex + build-aux/depcomp + build-aux/config.guess + build-aux/config.sub doc/INSTALL " @@ -327,7 +325,7 @@ insert_if_absent() { die "Error: Duplicate entries in $file: " $duplicate_entries fi linesold=$(gitignore_entries $file | wc -l) - linesnew=$(echo "$str" | gitignore_entries - $file | sort -u | wc -l) + linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l) if [ $linesold != $linesnew ] ; then { echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \ || die "insert_if_absent $file $str: failed" @@ -470,8 +468,7 @@ check_versions() { if [ "$req_ver" = "-" ]; then # Merely require app to exist; not all prereq apps are well-behaved # so we have to rely on $? rather than get_version. - $app --version >/dev/null 2>&1 - if [ 126 -le $? ]; then + if ! check_exists $app; then warn_ "Error: '$app' not found" ret=1 fi @@ -504,6 +501,12 @@ print_versions() { # can't depend on column -t } +# Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6. +# Also find the compatible sha1 utility on the BSDs +if test x"$SKIP_PO" = x; then + find_tool SHA1SUM sha1sum gsha1sum shasum sha1 +fi + use_libtool=0 # We'd like to use grep -E, to see if any of LT_INIT, # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac, @@ -549,13 +552,21 @@ if ! printf "$buildreq" | check_versions; then fi fi +# Warn the user if autom4te appears to be broken; this causes known +# issues with at least gettext 0.18.3. +probe=$(echo 'm4_quote([hi])' | autom4te -l M4sugar -t 'm4_quote:$%' -) +if test "x$probe" != xhi; then + warn_ "WARNING: your autom4te wrapper eats stdin;" + warn_ "if bootstrap fails, consider upgrading your autotools" +fi + echo "$0: Bootstrapping from checked-out $package sources..." # See if we can use gnulib's git-merge-changelog merge driver. -if test -d .git && (git --version) >/dev/null 2>/dev/null ; then +if $use_git && test -d .git && check_exists git; then if git config merge.merge-changelog.driver >/dev/null ; then : - elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then + elif check_exists git-merge-changelog; then echo "$0: initializing git-merge-changelog driver" git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver' git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B' @@ -575,13 +586,17 @@ git_modules_config () { test -f .gitmodules && git config --file .gitmodules "$@" } -gnulib_path=$(git_modules_config submodule.gnulib.path) -test -z "$gnulib_path" && gnulib_path=gnulib +if $use_git; then + gnulib_path=$(git_modules_config submodule.gnulib.path) + test -z "$gnulib_path" && gnulib_path=gnulib +fi -# Get gnulib files. +# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a +# submodule, for use in the rest of the script. case ${GNULIB_SRCDIR--} in -) + # Note that $use_git is necessarily true in this case. if git_modules_config submodule.gnulib.url >/dev/null; then echo "$0: getting gnulib files..." git submodule init || exit $? @@ -602,8 +617,8 @@ case ${GNULIB_SRCDIR--} in GNULIB_SRCDIR=$gnulib_path ;; *) - # Use GNULIB_SRCDIR as a reference. - if test -d "$GNULIB_SRCDIR"/.git && \ + # Use GNULIB_SRCDIR directly or as a reference. + if $use_git && test -d "$GNULIB_SRCDIR"/.git && \ git_modules_config submodule.gnulib.url >/dev/null; then echo "$0: getting gnulib files..." if git submodule -h|grep -- --reference > /dev/null; then @@ -629,6 +644,9 @@ case ${GNULIB_SRCDIR--} in ;; esac +# $GNULIB_SRCDIR now points to the version of gnulib to use, and +# we no longer need to use git or $gnulib_path below here. + if $bootstrap_sync; then cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || { echo "$0: updating bootstrap and restarting..." @@ -686,11 +704,10 @@ update_po_files() { cksum_file="$ref_po_dir/$po.s1" if ! test -f "$cksum_file" || ! test -f "$po_dir/$po.po" || - ! $SHA1SUM -c --status "$cksum_file" \ - < "$new_po" > /dev/null; then + ! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then echo "$me: updated $po_dir/$po.po..." cp "$new_po" "$po_dir/$po.po" \ - && $SHA1SUM < "$new_po" > "$cksum_file" + && $SHA1SUM < "$new_po" > "$cksum_file" || return fi done } From 502daf83065596aad3d48c29e3150783e7302d82 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 13 Apr 2014 21:07:54 +0100 Subject: [PATCH 012/224] 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 Signed-off-by: Sami Kerola --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e062c58..cfa9271 100644 --- a/configure.ac +++ b/configure.ac @@ -13,7 +13,7 @@ AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([ -Wall -Wextra-portability - 1.10 + 1.12 foreign dist-xz no-dist-gzip From 6e680ee04fa84472695f7eabc8ea1ae90433d314 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 31 May 2014 18:13:21 +0100 Subject: [PATCH 013/224] contrib: add release siging key to contrib/ Signed-off-by: Sami Kerola --- contrib/kerolasa.gpg | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 contrib/kerolasa.gpg diff --git a/contrib/kerolasa.gpg b/contrib/kerolasa.gpg new file mode 100644 index 0000000..47d1ed6 --- /dev/null +++ b/contrib/kerolasa.gpg @@ -0,0 +1,52 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v2.0.22 (GNU/Linux) + +mQINBFLH/jcBEADNgkgZAr7b/qvHzNkme8eSplDA8UHhcCFQmBnQ8HYFEYBi1Y5a +GhICcuisRSuZIPLtqRF8ntoOXsOHOUxnn5hVR62HxMLgOC1PQMw8TzREobbkAxMp +Vg66c6JXD2+jEGuAbhRk1XyWJHaCN2ewT06ToqGi7jhlw6nz1AHyohhyxeRlyMff +a4daTIRREnh2qouImSOE0E8ETAb0eOnFOsweHhmbpC/RDzuY7Ns8YcNH3FbWT1Kl +4W9vOstB1JcgSz38/tnzoMG2Mf2jI8LgR+6xiHTb7i6bgyWiBOxcJWouTVam6SC0 +Bc5cAe8EqHT6NMEjtNjDEzmb3ZFpFUnNKgKK5Wzghf17HAvYwpjYxNNoQl9jNIkf +XroquAyDDXW0IkNdGDARjJGW17r38oRH/R3q79DZNlqV/DPk4YLb0EAKzRAdBYGm +v8Bj+uLXc4JT9kTB5E8DT2ZR+61E4eT/zk4rpZ5j6tTktLNaSG58VYc+oQlPkPsB +ntraDsORpa5cK9uPUbHIHN1qd4gi35O4UDSqS023XnStQqsUD4vlzICedPDypn28 +h9q2nlNQHSDjIRnZFD+z9IHfVoBNTfm5/UH7NKBAvSS6rP5zsgi2fittt5AFdbmQ +VBOtpYp5vbcdSt8gNdJRy8FRaiQ/2n74xF1Zso/PGni1xRmseS+qBGI95QARAQAB +tDtTYW1pIEtlcm9sYSAoaHR0cDovL3d3dy5pa2kuZmkva2Vyb2xhc2EvKSA8a2Vy +b2xhc2FAaWtpLmZpPokCPwQTAQIAKQUCUsf+NwIbAwUJCWYBgAcLCQgHAwIBBhUI +AgkKCwQWAgMBAh4BAheAAAoJEKlVMkX96bc5aBwP/3XE1ZW3pp6B337vW5VfPY8v ++8h2JMdL/PfCLqDHbQm6fYgtT+EFbVE3JotXcocSqvl3xjA2LERROoN9a+jdaS9O ++WDWdIxVjnpMheb502ZnTbwFuh1OVasvqT7x4e9Tmq31S/0VFjTFLm8M+anuoUsn +9lfy5jeGnULMT0G737uySmm8M7hP5lSXHhFaiQi2R95wo8titvZ9ckGFJH3/u5qV +8aU34yzIw3MnKG52FeieYjSVfEaso9FrO8thMFIJclHSGzd5fw9CbPggFzMR0zHc +wJl+AEshAIG13+P88wcJ4sqfZGltdjm0vSgcmWgkmrZyDhvyA4Hnb2Rc3faqh3VC +/qU7p82yhoJ9M12xz4PIXQbodPDu/q8Ckzt8zh6h8ROUkqqZ90M2Yc3QoX82qOzR +tMokbhhwtYcgyAZHw0CLvJuJvAME41zjH1Wq9wY+gXHewTppi9Yqbd8E1LJaCvr7 +pMhKr9f08lBoUD5G/M54HGMKW+1R0yvxR9C2lR8P5JfVfTmD9E/g8WbmzZuy1dm1 +sL3fzjmnc3yNNt9MgfJgHQu2W15myNAzK/sEXGjuXJSqn/dpCoxiqQooEc2qokN/ +wQp5g70We305+BZB1fQcjE7wBmF4OEtEcI3p4lSrffyxcsqFFds0ikDU024lA46D +V1nSGsKLk7fme3itszWmuQINBFLH/jcBEADGsDuJyhEGExcInkb4Zy8HlSNaT0nF +xpQK+tI5RlqyC11TnxdUDCQwPPRh/hdNs7RDQ6lHhmXydD04+Sjjn0nkQCxd8TlB +TwOU6BV4vPF7BonskTMHb6mXxOo+6f7+J5q4beQ7XzRSoFqLZ0kiump7B4m6L4WS +qZmcfi8f6EOQZHK1HsTB2jE+cwaPm7vNeNaKXYM6hHojZ7XnDavv4vMxfLRGGx5e +6wNcZexD4t4pkMwmA+A576t5CnIm8JVB2HLj2YZN6DfIfYQ9EcMYSYVLg/EuivPa +MZIoIa9ki5TbeQDANluJqAG+i+CSoIfJX1V1p0WoeSEKJnGBhVFmajU+nek1lCqe +M/VXQF4dWbFCQm8/eKl1M9PY77dwT90xRZDeigM6o6CoB+6rfePAnwsmtA21LyQ9 +WMTCH9qii9SvlWkfCvLK3HnC/2d1ctwsF8yoc6KF+Qwj7RV23/iHYqjxB8OcOAyH +uv+k0sD9o0MLlzAExOftLPkwyWS8ePs7rJVLSA42N3diUYx5TO3NzmU8ifn4hGxb +F9J/sIYQUfCxH9V+DBe2vhVSZ/bQKpVUZTE8KxINL32JvTR3HbEwHKIe0xIFnDOM +GrWP7icPEsaSKj/0vEq/Is/R2nJWfD0Vzs7vil9zYU16vHQtZrv/5SzavzDRFGxL +m7/jDfrzMuNRdQARAQABiQIlBBgBAgAPBQJSx/43AhsMBQkJZgGAAAoJEKlVMkX9 +6bc5cYEQAI8xVRdoza/MY9KFJCRiobii4GjxAJqIXXvbY8mM7rvmiLnzfr5msLzS +op7Epse6tkI8QvYXbY+EjXke27J8rM/zqXyqdKJfcqKVzq6fIQyVVsz9o0hwvuSj +kcSgCV2b8XHKbNygSnNh2VJ5YY/zL2x5tsySa3tLukh46ydKWRQqOSMIxMT0TnCO +iTMr5INwGnX68rB0kEuCSUdkzDuyulW2T0oN7Yx4ASgrJixwSu/UNMO/fXvkG0NY +IWeXQcnn0C8zQv/PAfzJ9O+24Md4m6tzVuDpblSRB6E8xQhusysRc4BEHB/G3Ege +3JR/tumT6solJD7pfFDYkC9rAKhTKK9h1b2VpEGxN9o8qwwjtNljLakEYXuWNpCm +ZxKAR4Agg3UY8CGmgsTKyjsfB9iO2+LXCS9uQMAtIHbnr++mPASBEKD6rP8QIyf1 +2fbI9JRNGWcXQVZBGXWmu4UaKOrXBTVzooj2yG7kZmKO0FoIaCqqTUs2/KhnFj2E +Fvym2j1OMrYxOM/pT6w3cv3CwGb1ILOX0qrTQiEpOExSMa21Mi4678jXt6F6NPWG +/lwlgE1WM9i9jIcua+NU5ZJiqQ/rjuSRMB/WFrQy66/jb9wWNp/G6DXrANgdgoC9 +Dq5oviB+dqSXlU5b0atG4ru506mXCHKmOC+wu0oRlGQ/X6iuuDfS +=U+eW +-----END PGP PUBLIC KEY BLOCK----- From 6b267387ccb380ceb452353d1e277f1345186e36 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 31 May 2014 18:06:33 +0100 Subject: [PATCH 014/224] release: 2.25 Signed-off-by: Sami Kerola --- NEWS | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/NEWS b/NEWS index b30ab7b..2f6e6ee 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,24 @@ See the end for copying conditions. Please send dhcpd-pools bug reports to kerolasa@iki.fi. + +Version 2.25 +$ git shortlog v2.24..v2.25 +Sami Kerola (14): + build-sys: use more strict method to check __builtin_expect + getdata: add missing HAVE_POSIX_FADVISE protection + getdata: fix consecutive range definition regression + man: add tip analysis of include files can be useful + thanks: add Fredrik Lysén & Conor McCarthy + generic: use pure and const function attributes when possible + tests: fix testing error + output: make nagios output have performance data + build-sys: update gitinore file + output: use symbolic exit values for nagios commands + build-sys: update bootstrap script + build-sys: require automake 1.12 to get working test-driver + contrib: add release siging key to contrib/ + release: 2.25 Version 2.24 $ git shortlog v2.23..v2.24 From 9090cfb1d7faf51f832c4fde2285a80223d09603 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 31 May 2014 18:54:01 +0100 Subject: [PATCH 015/224] news: add the note about .sig pgp key id Signed-off-by: Sami Kerola --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 2f6e6ee..905dc0e 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ See the end for copying conditions. Please send dhcpd-pools bug reports to kerolasa@iki.fi. +gpg: Signature is crated using RSA key ID FDE9B739. Version 2.25 $ git shortlog v2.24..v2.25 From 4392a5b917ba8813971bcfb21dc5431386b796c1 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 20 Jul 2014 18:05:00 +0100 Subject: [PATCH 016/224] reindent all files And update the indent.pro to match with the style I like. Signed-off-by: Sami Kerola --- src/.indent.pro | 12 ++- src/analyze.c | 6 +- src/defaults.h | 2 +- src/dhcpd-pools.c | 31 +++---- src/dhcpd-pools.h | 52 ++++++------ src/getdata.c | 47 +++++------ src/hash.c | 5 +- src/other.c | 20 ++--- src/output.c | 202 ++++++++++++++++------------------------------ src/sort.c | 20 ++--- 10 files changed, 156 insertions(+), 241 deletions(-) diff --git a/src/.indent.pro b/src/.indent.pro index 34e832f..fb2aa48 100644 --- a/src/.indent.pro +++ b/src/.indent.pro @@ -1,2 +1,10 @@ --linux -Tuintmax_t -TFILE -Tsize_t -Toff_t -Ttime_t -ppi1 - +-linux +-TFILE +-Tipaddr_t +-Toff_t +-Trange_t +-Tsize_t +-Ttime_t +-Tuintmax_t +-l100 +-ppi1 diff --git a/src/analyze.c b/src/analyze.c index 71c48d0..2ec8626 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -69,13 +69,11 @@ int do_counting(void) /* Walk through ranges */ for (i = 0; i < num_ranges; i++) { - for (; l != NULL && ipcomp(&range_p->first_ip, &l->ip) < 0; - l = l->hh.prev) + for (; l != NULL && ipcomp(&range_p->first_ip, &l->ip) < 0; l = l->hh.prev) /* rewind */ ; if (l == NULL) l = leases; - for (; l != NULL && ipcomp(&l->ip, &range_p->last_ip) <= 0; - l = l->hh.next) { + for (; l != NULL && ipcomp(&l->ip, &range_p->last_ip) <= 0; l = l->hh.next) { if (ipcomp(&l->ip, &range_p->first_ip) < 0) { /* should not be necessary */ continue; diff --git a/src/defaults.h b/src/defaults.h index 3b4f882..c39149a 100644 --- a/src/defaults.h +++ b/src/defaults.h @@ -41,7 +41,7 @@ #ifndef DEFAULTS_H # define DEFAULTS_H 1 -#include "dhcpd-pools.h" +# include "dhcpd-pools.h" /*! \var MAXLEN * \brief Maximum expected line length in dhcpd.conf and dhcpd.leases diff --git a/src/dhcpd-pools.c b/src/dhcpd-pools.c index 12c26ae..5c7a48a 100644 --- a/src/dhcpd-pools.c +++ b/src/dhcpd-pools.c @@ -129,8 +129,7 @@ int main(int argc, char **argv) /* Parse command line options */ while (1) { int c; - c = getopt_long(argc, argv, "c:l:f:o:s:rL:vh", - long_options, &option_index); + c = getopt_long(argc, argv, "c:l:f:o:s:rL:vh", long_options, &option_index); if (c == EOF) break; @@ -152,8 +151,7 @@ int main(int argc, char **argv) /* Output sorting option */ sorts = strlen(optarg); if (5 < sorts) { - warnx - ("main: only first 5 sort orders will be used"); + warnx("main: only first 5 sort orders will be used"); strncpy(config.sort, optarg, (size_t)5); sorts = 5; } else { @@ -175,29 +173,24 @@ int main(int argc, char **argv) /* Specification what will be printed */ for (i = 0; i < 2; i++) { if (optarg[i] >= '0' && optarg[i] < '8') { - config.output_limit[i] = - optarg[i] - '0'; + config.output_limit[i] = optarg[i] - '0'; } else { clean_up(); errx(EXIT_FAILURE, - "main: output mask `%s' is illegal", - optarg); + "main: output mask `%s' is illegal", optarg); } } break; case OPT_WARN: strcpy(config.output_format, "a"); - config.warning = - strtod_or_err(optarg, "illegal argument"); + config.warning = strtod_or_err(optarg, "illegal argument"); break; case OPT_CRIT: strcpy(config.output_format, "a"); - config.critical = - strtod_or_err(optarg, "illegal argument"); + config.critical = strtod_or_err(optarg, "illegal argument"); break; case OPT_MINSIZE: - config.minsize = - strtod_or_err(optarg, "illegal argument"); + config.minsize = strtod_or_err(optarg, "illegal argument"); break; case 'v': /* Print version */ @@ -206,9 +199,7 @@ int main(int argc, char **argv) /* Print help */ usage(EXIT_SUCCESS); default: - errx(EXIT_FAILURE, - "Try `%s --help' for more information.", - program_name); + errx(EXIT_FAILURE, "Try `%s --help' for more information.", program_name); } } @@ -244,8 +235,7 @@ int main(int argc, char **argv) break; default: clean_up(); - errx(EXIT_FAILURE, "main: unknown output format `%c'", - config.output_format[0]); + errx(EXIT_FAILURE, "main: unknown output format `%c'", config.output_format[0]); } /* Do the job */ @@ -278,8 +268,7 @@ int prepare_memory(void) config.dhcp_version = VERSION_UNKNOWN; RANGES = 64; num_ranges = num_shared_networks = 0; - shared_networks = - xmalloc(sizeof(struct shared_network_t) * SHARED_NETWORKS); + shared_networks = xmalloc(sizeof(struct shared_network_t) * SHARED_NETWORKS); ranges = xmalloc(sizeof(struct range_t) * RANGES); diff --git a/src/dhcpd-pools.h b/src/dhcpd-pools.h index 90582b5..e7ccc97 100644 --- a/src/dhcpd-pools.h +++ b/src/dhcpd-pools.h @@ -194,9 +194,9 @@ enum limbits { /*! \def STATE_OK * \brief Nagios alarm exit value. */ -#define STATE_OK 0 -#define STATE_WARNING 1 -#define STATE_CRITICAL 2 +# define STATE_OK 0 +# define STATE_WARNING 1 +# define STATE_CRITICAL 2 /* Global variables */ /* \var prefix_length Length of each prefix. */ @@ -220,50 +220,53 @@ unsigned int RANGES; int prepare_memory(void); void set_ipv_functions(int version); int parse_leases(void); -void parse_config(int, const char *__restrict, - struct shared_network_t *__restrict) +void parse_config(int, const char *__restrict, struct shared_network_t *__restrict) __attribute__ ((nonnull(2, 3))); int prepare_data(void); int do_counting(void); -void flip_ranges(struct range_t *__restrict ranges, - struct range_t *__restrict tmp_ranges) +void flip_ranges(struct range_t *__restrict ranges, struct range_t *__restrict tmp_ranges) __attribute__ ((nonnull(1, 2))); /* support functions */ -int (*parse_ipaddr)(const char *restrict src, union ipaddr_t *restrict dst); +int (*parse_ipaddr) (const char *restrict src, union ipaddr_t *restrict dst); int parse_ipaddr_init(const char *restrict src, union ipaddr_t *restrict dst) _DP_ATTRIBUTE_CONST; int parse_ipaddr_v4(const char *restrict src, union ipaddr_t *restrict dst); int parse_ipaddr_v6(const char *restrict src, union ipaddr_t *restrict dst); -void (*copy_ipaddr)(union ipaddr_t *restrict dst, const union ipaddr_t *restrict src); -void copy_ipaddr_init(union ipaddr_t *restrict dst, const union ipaddr_t *restrict src) _DP_ATTRIBUTE_CONST; +void (*copy_ipaddr) (union ipaddr_t *restrict dst, const union ipaddr_t *restrict src); +void copy_ipaddr_init(union ipaddr_t *restrict dst, + const union ipaddr_t *restrict src) _DP_ATTRIBUTE_CONST; void copy_ipaddr_v4(union ipaddr_t *restrict dst, const union ipaddr_t *restrict src); void copy_ipaddr_v6(union ipaddr_t *restrict dst, const union ipaddr_t *restrict src); -const char *(*ntop_ipaddr)(const union ipaddr_t *ip); +const char *(*ntop_ipaddr) (const union ipaddr_t *ip); const char *ntop_ipaddr_init(const union ipaddr_t *ip) _DP_ATTRIBUTE_CONST; const char *ntop_ipaddr_v4(const union ipaddr_t *ip); const char *ntop_ipaddr_v6(const union ipaddr_t *ip); -double (*get_range_size)(const struct range_t *r); +double (*get_range_size) (const struct range_t *r); double get_range_size_init(const struct range_t *r) _DP_ATTRIBUTE_CONST; double get_range_size_v4(const struct range_t *r) _DP_ATTRIBUTE_PURE; double get_range_size_v6(const struct range_t *r) _DP_ATTRIBUTE_PURE; -int (*xstrstr)(const char *__restrict str); +int (*xstrstr) (const char *__restrict str); int xstrstr_init(const char *__restrict str) _DP_ATTRIBUTE_CONST; -int xstrstr_v4(const char *__restrict str) _DP_ATTRIBUTE_HOT _DP_ATTRIBUTE_PURE; -int xstrstr_v6(const char *__restrict str) _DP_ATTRIBUTE_HOT _DP_ATTRIBUTE_PURE; +int xstrstr_v4(const char *__restrict str) +_DP_ATTRIBUTE_HOT _DP_ATTRIBUTE_PURE; +int xstrstr_v6(const char *__restrict str) +_DP_ATTRIBUTE_HOT _DP_ATTRIBUTE_PURE; -double strtod_or_err(const char *__restrict str, - const char *__restrict errmesg); +double strtod_or_err(const char *__restrict str, const char *__restrict errmesg); void print_version(void) __attribute__ ((noreturn)); void usage(int status) __attribute__ ((noreturn)); /* qsort required functions... */ /* ...for ranges and... */ -int (*ipcomp)(const union ipaddr_t *restrict a, const union ipaddr_t *restrict b); -int ipcomp_init(const union ipaddr_t *restrict a, const union ipaddr_t *restrict b) _DP_ATTRIBUTE_CONST; -int ipcomp_v4(const union ipaddr_t *restrict a, const union ipaddr_t *restrict b) _DP_ATTRIBUTE_PURE; -int ipcomp_v6(const union ipaddr_t *restrict a, const union ipaddr_t *restrict b) _DP_ATTRIBUTE_PURE; +int (*ipcomp) (const union ipaddr_t *restrict a, const union ipaddr_t *restrict b); +int ipcomp_init(const union ipaddr_t *restrict a, + const union ipaddr_t *restrict b) _DP_ATTRIBUTE_CONST; +int ipcomp_v4(const union ipaddr_t *restrict a, + const union ipaddr_t *restrict b) _DP_ATTRIBUTE_PURE; +int ipcomp_v6(const union ipaddr_t *restrict a, + const union ipaddr_t *restrict b) _DP_ATTRIBUTE_PURE; int comp_cur(struct range_t *r1, struct range_t *r2) _DP_ATTRIBUTE_PURE; int comp_double(double f1, double f2) _DP_ATTRIBUTE_CONST; @@ -281,8 +284,7 @@ comparer_t field_selector(char c); double ret_percent(struct range_t r); double ret_tc(struct range_t r) _DP_ATTRIBUTE_CONST; double ret_tcperc(struct range_t r); -void mergesort_ranges(struct range_t *__restrict orig, int size, - struct range_t *__restrict temp) +void mergesort_ranges(struct range_t *__restrict orig, int size, struct range_t *__restrict temp) __attribute__ ((nonnull(1, 3))); /* output function pointer and functions */ int (*output_analysis) (void); @@ -295,12 +297,12 @@ int output_alarming(void); /* Memory release, file closing etc */ void clean_up(void); /* Hash functions */ -void (*add_lease)(union ipaddr_t *ip, enum ltype type); +void (*add_lease) (union ipaddr_t *ip, enum ltype type); void add_lease_init(union ipaddr_t *ip, enum ltype type) _DP_ATTRIBUTE_CONST; void add_lease_v4(union ipaddr_t *ip, enum ltype type); void add_lease_v6(union ipaddr_t *ip, enum ltype type); -struct leases_t *(*find_lease)(union ipaddr_t *ip); +struct leases_t *(*find_lease) (union ipaddr_t *ip); struct leases_t *find_lease_init(union ipaddr_t *ip) _DP_ATTRIBUTE_CONST; struct leases_t *find_lease_v4(union ipaddr_t *ip) _DP_ATTRIBUTE_PURE; struct leases_t *find_lease_v6(union ipaddr_t *ip) _DP_ATTRIBUTE_PURE; diff --git a/src/getdata.c b/src/getdata.c index cd99013..56d5088 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -75,14 +75,12 @@ int parse_leases(void) #ifdef HAVE_POSIX_FADVISE # ifdef POSIX_FADV_NOREUSE if (posix_fadvise(fileno(dhcpd_leases), 0, 0, POSIX_FADV_NOREUSE) != 0) { - err(EXIT_FAILURE, "parse_leases: fadvise %s", - config.dhcpdlease_file); + err(EXIT_FAILURE, "parse_leases: fadvise %s", config.dhcpdlease_file); } # endif /* POSIX_FADV_NOREUSE */ # ifdef POSIX_FADV_SEQUENTIAL if (posix_fadvise(fileno(dhcpd_leases), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) { - err(EXIT_FAILURE, "parse_leases: fadvise %s", - config.dhcpdlease_file); + err(EXIT_FAILURE, "parse_leases: fadvise %s", config.dhcpdlease_file); } # endif /* POSIX_FADV_SEQUENTIAL */ #endif /* HAVE_POSIX_FADVISE */ @@ -103,13 +101,15 @@ int parse_leases(void) while (!feof(dhcpd_leases)) { if (!fgets(line, MAXLEN, dhcpd_leases) && ferror(dhcpd_leases)) { - err(EXIT_FAILURE, "parse_leases: %s", - config.dhcpdlease_file); + err(EXIT_FAILURE, "parse_leases: %s", config.dhcpdlease_file); } - switch(xstrstr(line)) { - /* It's a lease, save IP */ + switch (xstrstr(line)) { + /* It's a lease, save IP */ case PREFIX_LEASE: - stop = memccpy(ipstring, line + (config.dhcp_version == VERSION_4 ? 6 : 9), ' ', strlen(line)); + stop = + memccpy(ipstring, + line + (config.dhcp_version == + VERSION_4 ? 6 : 9), ' ', strlen(line)); if (stop != NULL) { --stop; *stop = '\0'; @@ -150,7 +150,7 @@ int parse_leases(void) } break; default: - /* do nothing */; + /* do nothing */ ; } } #undef HAS_PREFIX @@ -204,14 +204,14 @@ void parse_config(int is_include, const char *restrict config_file, } #ifdef HAVE_POSIX_FADVISE # ifdef POSIX_FADV_NOREUSE -if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_NOREUSE) != 0) { - err(EXIT_FAILURE, "parse_config: fadvise %s", config_file); -} + if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_NOREUSE) != 0) { + err(EXIT_FAILURE, "parse_config: fadvise %s", config_file); + } # endif /* POSIX_FADV_NOREUSE */ # ifdef POSIX_FADV_SEQUENTIAL -if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) { - err(EXIT_FAILURE, "parse_config: fadvise %s", config_file); -} + if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) { + err(EXIT_FAILURE, "parse_config: fadvise %s", config_file); + } # endif /* POSIX_FADV_SEQUENTIAL */ #endif /* HAVE_POSIX_FADVISE */ @@ -248,8 +248,7 @@ if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) { } if (comment == false && argument != ITS_A_RANGE_FIRST_IP - && argument != ITS_A_RANGE_SECOND_IP - && argument != ITS_AN_INCLUCE) { + && argument != ITS_A_RANGE_SECOND_IP && argument != ITS_AN_INCLUCE) { newclause = true; i = 0; } else if (argument == ITS_A_RANGE_FIRST_IP && one_ip_range == true) { @@ -308,9 +307,7 @@ if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) { } /* Either inside comment or Nth word of clause. */ - if (comment == true - || (newclause == false - && argument == ITS_NOTHING_INTERESTING)) { + if (comment == true || (newclause == false && argument == ITS_NOTHING_INTERESTING)) { continue; } /* Strip white spaces before new clause word. */ @@ -370,10 +367,7 @@ if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) { num_ranges++; if (RANGES < num_ranges + 1) { RANGES *= 2; - ranges = - xrealloc(ranges, - sizeof(struct - range_t) * RANGES); + ranges = xrealloc(ranges, sizeof(struct range_t) * RANGES); range_p = ranges + num_ranges; } newclause = true; @@ -393,8 +387,7 @@ if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) { case ITS_A_SHAREDNET: /* printf ("shared-network named: %s\n", word); */ num_shared_networks++; - shared_p = - shared_networks + num_shared_networks; + shared_p = shared_networks + num_shared_networks; shared_p->name = xstrdup(word); shared_p->available = 0; shared_p->used = 0; diff --git a/src/hash.c b/src/hash.c index 2f38550..4b42610 100644 --- a/src/hash.c +++ b/src/hash.c @@ -47,7 +47,8 @@ /*! \brief Add a lease to hash array. * \param addr Binary IP to be added in leases hash. * \param type Lease state of the IP. */ -void add_lease_init(union ipaddr_t *addr __attribute__((unused)), enum ltype type __attribute__((unused))) +void add_lease_init(union ipaddr_t *addr + __attribute__ ((unused)), enum ltype type __attribute__ ((unused))) { } @@ -75,7 +76,7 @@ void add_lease_v6(union ipaddr_t *addr, enum ltype type) * \param addr Binary IP searched from leases hash. * \return A lease structure about requested IP, or NULL. */ -struct leases_t *find_lease_init(union ipaddr_t *addr __attribute__((unused))) +struct leases_t *find_lease_init(union ipaddr_t *addr __attribute__ ((unused))) { return NULL; } diff --git a/src/other.c b/src/other.c index b59e5fd..fabb6d8 100644 --- a/src/other.c +++ b/src/other.c @@ -146,19 +146,17 @@ int parse_ipaddr_v6(const char *restrict src, union ipaddr_t *restrict dst) * * \param dst Destination for a binary IP address. * \param src Sourse of an IP address. */ -void copy_ipaddr_init(union ipaddr_t *restrict dst __attribute__((unused)), - const union ipaddr_t *restrict src __attribute__((unused))) +void copy_ipaddr_init(union ipaddr_t *restrict dst __attribute__ ((unused)), + const union ipaddr_t *restrict src __attribute__ ((unused))) { } -void copy_ipaddr_v4(union ipaddr_t *restrict dst, - const union ipaddr_t *restrict src) +void copy_ipaddr_v4(union ipaddr_t *restrict dst, const union ipaddr_t *restrict src) { dst->v4 = src->v4; } -void copy_ipaddr_v6(union ipaddr_t *restrict dst, - const union ipaddr_t *restrict src) +void copy_ipaddr_v6(union ipaddr_t *restrict dst, const union ipaddr_t *restrict src) { memcpy(&dst->v6, &src->v6, sizeof(src->v6)); } @@ -171,7 +169,7 @@ void copy_ipaddr_v6(union ipaddr_t *restrict dst, * \param ip Binary IP address. * \return Printable address. */ -const char *ntop_ipaddr_init(const union ipaddr_t *ip __attribute__((unused))) +const char *ntop_ipaddr_init(const union ipaddr_t *ip __attribute__ ((unused))) { static char buffer = '\0'; return &buffer; @@ -187,8 +185,7 @@ const char *ntop_ipaddr_v4(const union ipaddr_t *ip) const char *ntop_ipaddr_v6(const union ipaddr_t *ip) { - static char - buffer[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; + static char buffer[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; struct in6_addr addr; memcpy(addr.s6_addr, ip->v6, sizeof(addr.s6_addr)); return inet_ntop(AF_INET6, &addr, buffer, sizeof(buffer)); @@ -200,7 +197,7 @@ const char *ntop_ipaddr_v6(const union ipaddr_t *ip) * and last IP in the range. * \return Size of a range. */ -double get_range_size_init(const struct range_t *r __attribute__((unused))) +double get_range_size_init(const struct range_t *r __attribute__ ((unused))) { return 0; } @@ -389,8 +386,7 @@ double strtod_or_err(const char *restrict str, const char *restrict errmesg) * * \param flip_me The range that needs to be inverted. * \param tmp_ranges Temporary memory area for the flip. */ -void flip_ranges(struct range_t *restrict flip_me, - struct range_t *restrict tmp_ranges) +void flip_ranges(struct range_t *restrict flip_me, struct range_t *restrict tmp_ranges) { unsigned int i = num_ranges - 1, j; diff --git a/src/output.c b/src/output.c index 6720e13..e713056 100644 --- a/src/output.c +++ b/src/output.c @@ -90,8 +90,7 @@ int output_txt(void) max_ipaddr_length, "first ip", max_ipaddr_length, - "last ip", - "max", "cur", "percent", "touch", "t+c", "t+c perc"); + "last ip", "max", "cur", "percent", "touch", "t+c", "t+c perc"); if (config.backups_found == true) { fprintf(outfile, " bu bu perc"); } @@ -100,8 +99,7 @@ int output_txt(void) if (config.output_limit[1] & BIT1) { for (i = 0; i < num_ranges; i++) { if (range_p->shared_net) { - fprintf(outfile, "%-20s", - range_p->shared_net->name); + fprintf(outfile, "%-20s", range_p->shared_net->name); } else { fprintf(outfile, "not_defined "); } @@ -109,8 +107,7 @@ int output_txt(void) * separate since ntop_ipaddr always returns the * same buffer */ fprintf(outfile, "%-*s", - max_ipaddr_length, - ntop_ipaddr(&range_p->first_ip)); + max_ipaddr_length, ntop_ipaddr(&range_p->first_ip)); fprintf(outfile, " - %-*s %5g %5g %10.3f %5g %5g %9.3f", max_ipaddr_length, @@ -120,14 +117,11 @@ int output_txt(void) (float)(100 * range_p->count) / range_size, range_p->touched, range_p->touched + range_p->count, - (float)(100 * - (range_p->touched + - range_p->count)) / range_size); + (float)(100 * (range_p->touched + range_p->count)) / range_size); if (config.backups_found == true) { fprintf(outfile, "%7g %8.3f", range_p->backups, - (float)(100 * range_p->backups) / - range_size); + (float)(100 * range_p->backups) / range_size); } fprintf(outfile, "\n"); range_p++; @@ -158,13 +152,11 @@ int output_txt(void) shared_p->touched + shared_p->used, (float)(100 * (shared_p->touched + - shared_p->used)) / - shared_p->available); + shared_p->used)) / shared_p->available); if (config.backups_found == true) { fprintf(outfile, "%7g %8.3f", shared_p->backups, - (float)(100 * shared_p->backups) / - shared_p->available); + (float)(100 * shared_p->backups) / shared_p->available); } fprintf(outfile, "\n"); @@ -194,8 +186,7 @@ int output_txt(void) shared_networks->touched + shared_networks->used, (float)(100 * (shared_networks->touched + - shared_networks->used)) / - shared_networks->available); + shared_networks->used)) / shared_networks->available); if (config.backups_found == true) { fprintf(outfile, "%7g %8.3f", @@ -257,8 +248,7 @@ int output_xml(void) if (l->ethernet != NULL) { fputs(l->ethernet, outfile); } - fputs("\n\n", - outfile); + fputs("\n\n", outfile); } } } @@ -268,25 +258,19 @@ int output_xml(void) fprintf(outfile, "\n"); if (range_p->shared_net) { fprintf(outfile, - "\t%s\n", - range_p->shared_net->name); + "\t%s\n", range_p->shared_net->name); } else { fprintf(outfile, "\t\n"); } fprintf(outfile, "\t\n"); fprintf(outfile, "\t\n"); - fprintf(outfile, "\t%s ", - ntop_ipaddr(&range_p->first_ip)); - fprintf(outfile, "- %s\n", - ntop_ipaddr(&range_p->last_ip)); + fprintf(outfile, "\t%s ", ntop_ipaddr(&range_p->first_ip)); + fprintf(outfile, "- %s\n", ntop_ipaddr(&range_p->last_ip)); fprintf(outfile, "\t\n"); - fprintf(outfile, "\t%g\n", - range_size); - fprintf(outfile, "\t%g\n", - range_p->count); - fprintf(outfile, "\t%g\n", - range_size - range_p->count); + fprintf(outfile, "\t%g\n", range_size); + fprintf(outfile, "\t%g\n", range_p->count); + fprintf(outfile, "\t%g\n", range_size - range_p->count); range_p++; range_size = get_range_size(range_p); fprintf(outfile, "\n"); @@ -297,12 +281,9 @@ int output_xml(void) for (i = 0; i < num_shared_networks; i++) { shared_p++; fprintf(outfile, "\n"); - fprintf(outfile, "\t%s\n", - shared_p->name); - fprintf(outfile, "\t%g\n", - shared_p->available); - fprintf(outfile, "\t%g\n", - shared_p->used); + fprintf(outfile, "\t%s\n", shared_p->name); + fprintf(outfile, "\t%g\n", shared_p->available); + fprintf(outfile, "\t%g\n", shared_p->used); fprintf(outfile, "\t%g\n", shared_p->available - shared_p->used); fprintf(outfile, "\n"); @@ -311,10 +292,8 @@ int output_xml(void) if (config.output_limit[0] & BIT3) { fprintf(outfile, "\n"); - fprintf(outfile, "\t%s\n", - shared_networks->name); - fprintf(outfile, "\t%g\n", - shared_networks->available); + fprintf(outfile, "\t%s\n", shared_networks->name); + fprintf(outfile, "\t%g\n", shared_networks->available); fprintf(outfile, "\t%g\n", shared_networks->used); fprintf(outfile, "\t%g\n", shared_networks->available - shared_networks->used); @@ -353,8 +332,7 @@ int output_json(void) if (config.output_file[0]) { outfile = fopen(config.output_file, "w+"); if (outfile == NULL) { - err(EXIT_FAILURE, "output_json: %s", - config.output_file); + err(EXIT_FAILURE, "output_json: %s", config.output_file); } } else { outfile = stdout; @@ -400,20 +378,16 @@ int output_json(void) fprintf(outfile, "{ "); if (range_p->shared_net) { fprintf(outfile, - "\"location\":\"%s\", ", - range_p->shared_net->name); + "\"location\":\"%s\", ", range_p->shared_net->name); } else { fprintf(outfile, "\"location\":\"\", "); } - fprintf(outfile, "\"range\":\"%s", - ntop_ipaddr(&range_p->first_ip)); - fprintf(outfile, " - %s\", ", - ntop_ipaddr(&range_p->last_ip)); + fprintf(outfile, "\"range\":\"%s", ntop_ipaddr(&range_p->first_ip)); + fprintf(outfile, " - %s\", ", ntop_ipaddr(&range_p->last_ip)); fprintf(outfile, "\"defined\":%g, ", range_size); fprintf(outfile, "\"used\":%g, ", range_p->count); - fprintf(outfile, "\"free\":%g ", - range_size - range_p->count); + fprintf(outfile, "\"free\":%g ", range_size - range_p->count); range_p++; range_size = get_range_size(range_p); if (i + 1 < num_ranges) @@ -434,13 +408,10 @@ int output_json(void) fprintf(outfile, " "); shared_p++; fprintf(outfile, "{ "); - fprintf(outfile, "\"location\":\"%s\", ", - shared_p->name); - fprintf(outfile, "\"defined\":%g, ", - shared_p->available); + fprintf(outfile, "\"location\":\"%s\", ", shared_p->name); + fprintf(outfile, "\"defined\":%g, ", shared_p->available); fprintf(outfile, "\"used\":%g, ", shared_p->used); - fprintf(outfile, "\"free\":%g ", - shared_p->available - shared_p->used); + fprintf(outfile, "\"free\":%g ", shared_p->available - shared_p->used); if (i + 1 < num_shared_networks) fprintf(outfile, "},\n"); else @@ -455,12 +426,9 @@ int output_json(void) fprintf(outfile, ",\n"); } fprintf(outfile, " \"summary\": {\n"); - fprintf(outfile, " \"location\":\"%s\",\n", - shared_networks->name); - fprintf(outfile, " \"defined\":%g,\n", - shared_networks->available); - fprintf(outfile, " \"used\":%g,\n", - shared_networks->used); + fprintf(outfile, " \"location\":\"%s\",\n", shared_networks->name); + fprintf(outfile, " \"defined\":%g,\n", shared_networks->available); + fprintf(outfile, " \"used\":%g,\n", shared_networks->used); fprintf(outfile, " \"free\":%g\n", shared_networks->available - shared_networks->used); fprintf(outfile, " }"); /* end of summary */ @@ -618,8 +586,7 @@ static void output_line(FILE *restrict f, char const *restrict type, * \param type HMTL tag name. * \param d Actual payload of the printout. */ -static void output_double(FILE *restrict f, char const *restrict type, - double d) +static void output_double(FILE *restrict f, char const *restrict type, double d) { fprintf(f, " <%s class=ralign>%g\n", type, d, type); } @@ -684,8 +651,7 @@ int output_html(void) if (config.output_file[0]) { outfile = fopen(config.output_file, "w+"); if (outfile == NULL) { - err(EXIT_FAILURE, "output_html: %s", - config.output_file); + err(EXIT_FAILURE, "output_html: %s", config.output_file); } } else { outfile = stdout; @@ -720,34 +686,24 @@ int output_html(void) for (i = 0; i < num_ranges; i++) { newrow(outfile); if (range_p->shared_net) { - output_line(outfile, "td", "calign", - range_p->shared_net->name); + output_line(outfile, "td", "calign", range_p->shared_net->name); } else { - output_line(outfile, "td", "calign", - "not_defined"); + output_line(outfile, "td", "calign", "not_defined"); } - output_line(outfile, "td", "calign", - ntop_ipaddr(&range_p->first_ip)); - output_line(outfile, "td", "calign", - ntop_ipaddr(&range_p->last_ip)); + output_line(outfile, "td", "calign", ntop_ipaddr(&range_p->first_ip)); + output_line(outfile, "td", "calign", ntop_ipaddr(&range_p->last_ip)); output_double(outfile, "td", range_size); output_double(outfile, "td", range_p->count); - output_float(outfile, "td", - (float)(100 * range_p->count) / - range_size); + output_float(outfile, "td", (float)(100 * range_p->count) / range_size); output_double(outfile, "td", range_p->touched); - output_double(outfile, "td", - range_p->touched + range_p->count); + output_double(outfile, "td", range_p->touched + range_p->count); output_float(outfile, "td", (float)(100 * - (range_p->touched + - range_p->count)) / range_size); + (range_p->touched + range_p->count)) / range_size); if (config.backups_found == true) { output_double(outfile, "td", range_p->backups); output_float(outfile, "td", - (float)(100 * - range_p->backups) / - range_size); + (float)(100 * range_p->backups) / range_size); } endrow(outfile); range_p++; @@ -780,22 +736,18 @@ int output_html(void) output_double(outfile, "td", shared_p->available); output_double(outfile, "td", shared_p->used); output_float(outfile, "td", - (float)(100 * shared_p->used) / - shared_p->available); + (float)(100 * shared_p->used) / shared_p->available); output_double(outfile, "td", shared_p->touched); - output_double(outfile, "td", - shared_p->touched + shared_p->used); + output_double(outfile, "td", shared_p->touched + shared_p->used); output_float(outfile, "td", (float)(100 * (shared_p->touched + - shared_p->used)) / - shared_p->available); + shared_p->used)) / shared_p->available); if (config.backups_found == true) { output_double(outfile, "td", shared_p->backups); output_float(outfile, "td", (float)(100 * - shared_p->backups) / - shared_p->available); + shared_p->backups) / shared_p->available); } endrow(outfile); @@ -824,16 +776,13 @@ int output_html(void) output_double(outfile, "td", shared_networks->available); output_double(outfile, "td", shared_networks->used); output_float(outfile, "td", - (float)(100 * shared_networks->used) / - shared_networks->available); + (float)(100 * shared_networks->used) / shared_networks->available); output_double(outfile, "td", shared_networks->touched); - output_double(outfile, "td", - shared_networks->touched + shared_networks->used); + output_double(outfile, "td", shared_networks->touched + shared_networks->used); output_float(outfile, "td", (float)(100 * (shared_networks->touched + - shared_networks->used)) / - shared_networks->available); + shared_networks->used)) / shared_networks->available); if (config.backups_found == true) { output_double(outfile, "td", shared_networks->backups); output_float(outfile, "td", @@ -897,13 +846,11 @@ int output_csv(void) if (config.output_limit[1] & BIT1) { for (i = 0; i < num_ranges; i++) { if (range_p->shared_net) { - fprintf(outfile, "\"%s\",", - range_p->shared_net->name); + fprintf(outfile, "\"%s\",", range_p->shared_net->name); } else { fprintf(outfile, "\"not_defined\","); } - fprintf(outfile, "\"%s\",", - ntop_ipaddr(&range_p->first_ip)); + fprintf(outfile, "\"%s\",", ntop_ipaddr(&range_p->first_ip)); fprintf(outfile, "\"%s\",\"%g\",\"%g\",\"%.3f\",\"%g\",\"%g\",\"%.3f\"", ntop_ipaddr(&range_p->last_ip), range_size, @@ -911,14 +858,11 @@ int output_csv(void) (float)(100 * range_p->count) / range_size, range_p->touched, range_p->touched + range_p->count, - (float)(100 * - (range_p->touched + - range_p->count)) / range_size); + (float)(100 * (range_p->touched + range_p->count)) / range_size); if (config.backups_found == true) { fprintf(outfile, ",\"%g\",\"%.3f\"", range_p->backups, - (float)(100 * range_p->backups) / - range_size); + (float)(100 * range_p->backups) / range_size); } fprintf(outfile, "\n"); @@ -949,13 +893,11 @@ int output_csv(void) shared_p->touched + shared_p->used, (float)(100 * (shared_p->touched + - shared_p->used)) / - shared_p->available); + shared_p->used)) / shared_p->available); if (config.backups_found == true) { fprintf(outfile, ",\"%g\",\"%.3f\"", shared_p->backups, - (float)(100 * shared_p->backups) / - shared_p->available); + (float)(100 * shared_p->backups) / shared_p->available); } fprintf(outfile, "\n"); @@ -983,8 +925,7 @@ int output_csv(void) shared_networks->touched + shared_networks->used, (float)(100 * (shared_networks->touched + - shared_networks->used)) / - shared_networks->available); + shared_networks->used)) / shared_networks->available); if (config.backups_found == true) { fprintf(outfile, "%7g %8.3f", shared_networks->backups, @@ -1028,8 +969,7 @@ int output_alarming(void) if (config.output_file[0]) { outfile = fopen(config.output_file, "w+"); if (outfile == NULL) { - err(EXIT_FAILURE, "output_alarming: %s", - config.output_file); + err(EXIT_FAILURE, "output_alarming: %s", config.output_file); } } else { outfile = stdout; @@ -1038,8 +978,7 @@ int output_alarming(void) if (config.output_limit[1] & BIT1) { for (i = 0; i < num_ranges; i++) { if (config.minsize < range_size) { - perc = - (float)(100 * range_p->count) / range_size; + perc = (float)(100 * range_p->count) / range_size; if (config.critical < perc) rc++; else if (config.warning < perc) @@ -1056,8 +995,7 @@ int output_alarming(void) if (config.output_limit[1] & BIT2) { for (i = 0; i < num_shared_networks; i++) { if (config.minsize < shared_p->available) { - perc = (float)(100 * shared_p->used) / - shared_p->available; + perc = (float)(100 * shared_p->used) / shared_p->available; if (config.critical < perc) sc++; else if (config.warning < perc) @@ -1078,12 +1016,12 @@ int output_alarming(void) else ret_val = STATE_OK; - if ((0 < rc && config.output_limit[1] & BIT1) || (0 < sc && config.output_limit[1] & BIT2)) { - fprintf(outfile, "CRITICAL: %s:", - program_name); - } else if ((0 < rw && config.output_limit[1] & BIT1) || (0 < sw && config.output_limit[1] & BIT2)) { - fprintf(outfile, "WARNING: %s:", - program_name); + if ((0 < rc && config.output_limit[1] & BIT1) + || (0 < sc && config.output_limit[1] & BIT2)) { + fprintf(outfile, "CRITICAL: %s:", program_name); + } else if ((0 < rw && config.output_limit[1] & BIT1) + || (0 < sw && config.output_limit[1] & BIT2)) { + fprintf(outfile, "WARNING: %s:", program_name); } else { if (config.output_limit[1] & BIT3) fprintf(outfile, "OK:"); @@ -1091,13 +1029,11 @@ int output_alarming(void) return ret_val; } if (config.output_limit[0] & BIT1) { - fprintf(outfile, " Ranges - crit: %d warn: %d ok: %d", rc, rw, - ro); + fprintf(outfile, " Ranges - crit: %d warn: %d ok: %d", rc, rw, ro); if (ri != 0) { fprintf(outfile, " ignored: %d", ri); } - fprintf(outfile, "; | range_crit=%d range_warn=%d range_ok=%d", rc, rw, - ro); + fprintf(outfile, "; | range_crit=%d range_warn=%d range_ok=%d", rc, rw, ro); if (ri != 0) { fprintf(outfile, " range_ignored=%d", ri); } @@ -1106,13 +1042,11 @@ int output_alarming(void) fprintf(outfile, " "); } if (config.output_limit[0] & BIT2) { - fprintf(outfile, "Shared nets - crit: %d warn: %d ok: %d", sc, - sw, so); + fprintf(outfile, "Shared nets - crit: %d warn: %d ok: %d", sc, sw, so); if (si != 0) { fprintf(outfile, " ignored: %d", si); } - fprintf(outfile, "; | snet_crit=%d snet_warn=%d snet_ok=%d", sc, - sw, so); + fprintf(outfile, "; | snet_crit=%d snet_warn=%d snet_ok=%d", sc, sw, so); if (si != 0) { fprintf(outfile, " snet_ignored=%d\n", si); } diff --git a/src/sort.c b/src/sort.c index a48b905..bafc290 100644 --- a/src/sort.c +++ b/src/sort.c @@ -54,14 +54,13 @@ * \param b Binary IP address. * \return If a < b return -1, if a < b return 1, when they are equal return 0. */ -int ipcomp_init(const union ipaddr_t *restrict a __attribute__((unused)), - const union ipaddr_t *restrict b __attribute__((unused))) +int ipcomp_init(const union ipaddr_t *restrict a __attribute__ ((unused)), + const union ipaddr_t *restrict b __attribute__ ((unused))) { return 0; } -int ipcomp_v4(const union ipaddr_t *restrict a, - const union ipaddr_t *restrict b) +int ipcomp_v4(const union ipaddr_t *restrict a, const union ipaddr_t *restrict b) { if (a->v4 < b->v4) return -1; @@ -70,8 +69,7 @@ int ipcomp_v4(const union ipaddr_t *restrict a, return 0; } -int ipcomp_v6(const union ipaddr_t *restrict a, - const union ipaddr_t *restrict b) +int ipcomp_v6(const union ipaddr_t *restrict a, const union ipaddr_t *restrict b) { return memcmp(&a->v6, &b->v6, sizeof(a->v6)); } @@ -215,8 +213,7 @@ comparer_t field_selector(char c) default: clean_up(); warnx("field_selector: unknown sort order `%c'", c); - errx(EXIT_FAILURE, "Try `%s --help' for more information.", - program_name); + errx(EXIT_FAILURE, "Try `%s --help' for more information.", program_name); } return NULL; } @@ -236,9 +233,7 @@ static int merge(struct range_t *restrict left, struct range_t *restrict right) for (i = 0; i < len; i++) { /* Handling strings is case of it's own */ if (config.sort[i] == 'n') { - ret = - strcmp(left->shared_net->name, - right->shared_net->name); + ret = strcmp(left->shared_net->name, right->shared_net->name); if (0 < ret) return (0); if (ret < 0) @@ -269,8 +264,7 @@ static int merge(struct range_t *restrict left, struct range_t *restrict right) * \param temp Temporary memory space, needed when a values has to be * flipped. */ -void mergesort_ranges(struct range_t *restrict orig, int size, - struct range_t *restrict temp) +void mergesort_ranges(struct range_t *restrict orig, int size, struct range_t *restrict temp) { int left, right, i; struct range_t hold; From 965875d20b01d467e6352863a9788112a488ec4c Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 9 Aug 2014 18:58:25 +0100 Subject: [PATCH 017/224] 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 --- src/dhcpd-pools.c | 21 ++++++ src/dhcpd-pools.h | 158 +++++++++++++++++++++++----------------------- 2 files changed, 101 insertions(+), 78 deletions(-) diff --git a/src/dhcpd-pools.c b/src/dhcpd-pools.c index 5c7a48a..279db9a 100644 --- a/src/dhcpd-pools.c +++ b/src/dhcpd-pools.c @@ -54,6 +54,27 @@ #include "progname.h" #include "xalloc.h" +/* Global variables */ +int prefix_length[2][NUM_OF_PREFIX]; +struct configuration_t config; +struct shared_network_t *shared_networks; +unsigned int num_shared_networks; +struct range_t *ranges; +unsigned int num_ranges; +struct leases_t *leases; +unsigned int RANGES; + +/* Function pointers */ +int (*parse_ipaddr) (const char *restrict src, union ipaddr_t *restrict dst); +void (*copy_ipaddr) (union ipaddr_t *restrict dst, const union ipaddr_t *restrict src); +const char *(*ntop_ipaddr) (const union ipaddr_t *ip); +double (*get_range_size) (const struct range_t *r); +int (*xstrstr) (const char *__restrict str); +int (*ipcomp) (const union ipaddr_t *restrict a, const union ipaddr_t *restrict b); +int (*output_analysis) (void); +void (*add_lease) (union ipaddr_t *ip, enum ltype type); +struct leases_t *(*find_lease) (union ipaddr_t *ip); + /*! \brief Start of execution. Parse options, and call other other * functions one after another. At the moment adding threading support * would be difficult, but there does not seem to be valid reason to diff --git a/src/dhcpd-pools.h b/src/dhcpd-pools.h index e7ccc97..f6dfd95 100644 --- a/src/dhcpd-pools.h +++ b/src/dhcpd-pools.h @@ -200,114 +200,116 @@ enum limbits { /* Global variables */ /* \var prefix_length Length of each prefix. */ -int prefix_length[2][NUM_OF_PREFIX]; +extern int prefix_length[2][NUM_OF_PREFIX]; /* \var config Runtime configuration. */ -struct configuration_t config; +extern struct configuration_t config; /* \var shared_networks Pointer holding shared network count results. */ -struct shared_network_t *shared_networks; +extern struct shared_network_t *shared_networks; /* \var num_shared_networks Number of shared networks found. */ -unsigned int num_shared_networks; +extern unsigned int num_shared_networks; /* \var ranges Pointer holding range count results. */ -struct range_t *ranges; +extern struct range_t *ranges; /* \var num_ranges Number of ranges found. */ -unsigned int num_ranges; +extern unsigned int num_ranges; /* \var leases Pointer holding all leases. */ -struct leases_t *leases; +extern struct leases_t *leases; /*! \var RANGES Maximum number of ranges. */ -unsigned int RANGES; +extern unsigned int RANGES; /* Function prototypes */ -int prepare_memory(void); -void set_ipv_functions(int version); -int parse_leases(void); -void parse_config(int, const char *__restrict, struct shared_network_t *__restrict) +extern int prepare_memory(void); +extern void set_ipv_functions(int version); +extern int parse_leases(void); +extern void parse_config(int, const char *__restrict, struct shared_network_t *__restrict) __attribute__ ((nonnull(2, 3))); -int prepare_data(void); -int do_counting(void); -void flip_ranges(struct range_t *__restrict ranges, struct range_t *__restrict tmp_ranges) +extern int prepare_data(void); +extern int do_counting(void); +extern void flip_ranges(struct range_t *__restrict ranges, struct range_t *__restrict tmp_ranges) __attribute__ ((nonnull(1, 2))); /* support functions */ -int (*parse_ipaddr) (const char *restrict src, union ipaddr_t *restrict dst); -int parse_ipaddr_init(const char *restrict src, union ipaddr_t *restrict dst) _DP_ATTRIBUTE_CONST; -int parse_ipaddr_v4(const char *restrict src, union ipaddr_t *restrict dst); -int parse_ipaddr_v6(const char *restrict src, union ipaddr_t *restrict dst); +extern int (*parse_ipaddr) (const char *restrict src, union ipaddr_t *restrict dst); +extern int parse_ipaddr_init(const char *restrict src, + union ipaddr_t *restrict dst) _DP_ATTRIBUTE_CONST; +extern int parse_ipaddr_v4(const char *restrict src, union ipaddr_t *restrict dst); +extern int parse_ipaddr_v6(const char *restrict src, union ipaddr_t *restrict dst); -void (*copy_ipaddr) (union ipaddr_t *restrict dst, const union ipaddr_t *restrict src); -void copy_ipaddr_init(union ipaddr_t *restrict dst, - const union ipaddr_t *restrict src) _DP_ATTRIBUTE_CONST; -void copy_ipaddr_v4(union ipaddr_t *restrict dst, const union ipaddr_t *restrict src); -void copy_ipaddr_v6(union ipaddr_t *restrict dst, const union ipaddr_t *restrict src); +extern void (*copy_ipaddr) (union ipaddr_t *restrict dst, const union ipaddr_t *restrict src); +extern void copy_ipaddr_init(union ipaddr_t *restrict dst, + const union ipaddr_t *restrict src) _DP_ATTRIBUTE_CONST; +extern void copy_ipaddr_v4(union ipaddr_t *restrict dst, const union ipaddr_t *restrict src); +extern void copy_ipaddr_v6(union ipaddr_t *restrict dst, const union ipaddr_t *restrict src); -const char *(*ntop_ipaddr) (const union ipaddr_t *ip); -const char *ntop_ipaddr_init(const union ipaddr_t *ip) _DP_ATTRIBUTE_CONST; -const char *ntop_ipaddr_v4(const union ipaddr_t *ip); -const char *ntop_ipaddr_v6(const union ipaddr_t *ip); +extern const char *(*ntop_ipaddr) (const union ipaddr_t *ip); +extern const char *ntop_ipaddr_init(const union ipaddr_t *ip) _DP_ATTRIBUTE_CONST; +extern const char *ntop_ipaddr_v4(const union ipaddr_t *ip); +extern const char *ntop_ipaddr_v6(const union ipaddr_t *ip); -double (*get_range_size) (const struct range_t *r); -double get_range_size_init(const struct range_t *r) _DP_ATTRIBUTE_CONST; -double get_range_size_v4(const struct range_t *r) _DP_ATTRIBUTE_PURE; -double get_range_size_v6(const struct range_t *r) _DP_ATTRIBUTE_PURE; +extern double (*get_range_size) (const struct range_t *r); +extern double get_range_size_init(const struct range_t *r) _DP_ATTRIBUTE_CONST; +extern double get_range_size_v4(const struct range_t *r) _DP_ATTRIBUTE_PURE; +extern double get_range_size_v6(const struct range_t *r) _DP_ATTRIBUTE_PURE; -int (*xstrstr) (const char *__restrict str); -int xstrstr_init(const char *__restrict str) _DP_ATTRIBUTE_CONST; -int xstrstr_v4(const char *__restrict str) +extern int (*xstrstr) (const char *__restrict str); +extern int xstrstr_init(const char *__restrict str) _DP_ATTRIBUTE_CONST; +extern int xstrstr_v4(const char *__restrict str) _DP_ATTRIBUTE_HOT _DP_ATTRIBUTE_PURE; -int xstrstr_v6(const char *__restrict str) +extern int xstrstr_v6(const char *__restrict str) _DP_ATTRIBUTE_HOT _DP_ATTRIBUTE_PURE; -double strtod_or_err(const char *__restrict str, const char *__restrict errmesg); -void print_version(void) __attribute__ ((noreturn)); -void usage(int status) __attribute__ ((noreturn)); +extern double strtod_or_err(const char *__restrict str, const char *__restrict errmesg); +extern void print_version(void) __attribute__ ((noreturn)); +extern void usage(int status) __attribute__ ((noreturn)); /* qsort required functions... */ /* ...for ranges and... */ -int (*ipcomp) (const union ipaddr_t *restrict a, const union ipaddr_t *restrict b); -int ipcomp_init(const union ipaddr_t *restrict a, - const union ipaddr_t *restrict b) _DP_ATTRIBUTE_CONST; -int ipcomp_v4(const union ipaddr_t *restrict a, - const union ipaddr_t *restrict b) _DP_ATTRIBUTE_PURE; -int ipcomp_v6(const union ipaddr_t *restrict a, - const union ipaddr_t *restrict b) _DP_ATTRIBUTE_PURE; +extern int (*ipcomp) (const union ipaddr_t *restrict a, const union ipaddr_t *restrict b); +extern int ipcomp_init(const union ipaddr_t *restrict a, + const union ipaddr_t *restrict b) _DP_ATTRIBUTE_CONST; +extern int ipcomp_v4(const union ipaddr_t *restrict a, + const union ipaddr_t *restrict b) _DP_ATTRIBUTE_PURE; +extern int ipcomp_v6(const union ipaddr_t *restrict a, + const union ipaddr_t *restrict b) _DP_ATTRIBUTE_PURE; -int comp_cur(struct range_t *r1, struct range_t *r2) _DP_ATTRIBUTE_PURE; -int comp_double(double f1, double f2) _DP_ATTRIBUTE_CONST; -int comp_ip(struct range_t *r1, struct range_t *r2); -int comp_max(struct range_t *r1, struct range_t *r2); -int comp_percent(struct range_t *r1, struct range_t *r2); -int comp_tc(struct range_t *r1, struct range_t *r2) _DP_ATTRIBUTE_PURE; -int comp_tcperc(struct range_t *r1, struct range_t *r2); -int comp_touched(struct range_t *r1, struct range_t *r2) _DP_ATTRIBUTE_PURE; -int rangecomp(const void *__restrict r1, const void *__restrict r2) +extern int comp_cur(struct range_t *r1, struct range_t *r2) _DP_ATTRIBUTE_PURE; +extern int comp_double(double f1, double f2) _DP_ATTRIBUTE_CONST; +extern int comp_ip(struct range_t *r1, struct range_t *r2); +extern int comp_max(struct range_t *r1, struct range_t *r2); +extern int comp_percent(struct range_t *r1, struct range_t *r2); +extern int comp_tc(struct range_t *r1, struct range_t *r2) _DP_ATTRIBUTE_PURE; +extern int comp_tcperc(struct range_t *r1, struct range_t *r2); +extern int comp_touched(struct range_t *r1, struct range_t *r2) _DP_ATTRIBUTE_PURE; +extern int rangecomp(const void *__restrict r1, const void *__restrict r2) __attribute__ ((nonnull(1, 2))); /* sort function pointer and functions */ typedef int (*comparer_t) (struct range_t *r1, struct range_t *r2); -comparer_t field_selector(char c); -double ret_percent(struct range_t r); -double ret_tc(struct range_t r) _DP_ATTRIBUTE_CONST; -double ret_tcperc(struct range_t r); -void mergesort_ranges(struct range_t *__restrict orig, int size, struct range_t *__restrict temp) +extern comparer_t field_selector(char c); +extern double ret_percent(struct range_t r); +extern double ret_tc(struct range_t r) _DP_ATTRIBUTE_CONST; +extern double ret_tcperc(struct range_t r); +extern void mergesort_ranges(struct range_t *__restrict orig, int size, + struct range_t *__restrict temp) __attribute__ ((nonnull(1, 3))); /* output function pointer and functions */ -int (*output_analysis) (void); -int output_txt(void); -int output_html(void); -int output_xml(void); -int output_json(void); -int output_csv(void); -int output_alarming(void); +extern int (*output_analysis) (void); +extern int output_txt(void); +extern int output_html(void); +extern int output_xml(void); +extern int output_json(void); +extern int output_csv(void); +extern int output_alarming(void); /* Memory release, file closing etc */ -void clean_up(void); +extern void clean_up(void); /* Hash functions */ -void (*add_lease) (union ipaddr_t *ip, enum ltype type); -void add_lease_init(union ipaddr_t *ip, enum ltype type) _DP_ATTRIBUTE_CONST; -void add_lease_v4(union ipaddr_t *ip, enum ltype type); -void add_lease_v6(union ipaddr_t *ip, enum ltype type); +extern void (*add_lease) (union ipaddr_t *ip, enum ltype type); +extern void add_lease_init(union ipaddr_t *ip, enum ltype type) _DP_ATTRIBUTE_CONST; +extern void add_lease_v4(union ipaddr_t *ip, enum ltype type); +extern void add_lease_v6(union ipaddr_t *ip, enum ltype type); -struct leases_t *(*find_lease) (union ipaddr_t *ip); -struct leases_t *find_lease_init(union ipaddr_t *ip) _DP_ATTRIBUTE_CONST; -struct leases_t *find_lease_v4(union ipaddr_t *ip) _DP_ATTRIBUTE_PURE; -struct leases_t *find_lease_v6(union ipaddr_t *ip) _DP_ATTRIBUTE_PURE; +extern struct leases_t *(*find_lease) (union ipaddr_t *ip); +extern struct leases_t *find_lease_init(union ipaddr_t *ip) _DP_ATTRIBUTE_CONST; +extern struct leases_t *find_lease_v4(union ipaddr_t *ip) _DP_ATTRIBUTE_PURE; +extern struct leases_t *find_lease_v6(union ipaddr_t *ip) _DP_ATTRIBUTE_PURE; -void delete_lease(struct leases_t *lease); -void delete_all_leases(void); +extern void delete_lease(struct leases_t *lease); +extern void delete_all_leases(void); #endif /* DHCPD_POOLS_H */ From e09f655a7be0daffade2f33129577e034c3c84d9 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 9 Aug 2014 19:26:29 +0100 Subject: [PATCH 018/224] add appropriate sorting function for struct leases_t The HASH_SORT in analyze needs this. Signed-off-by: Sami Kerola --- src/.indent.pro | 1 + src/analyze.c | 2 +- src/dhcpd-pools.c | 1 + src/dhcpd-pools.h | 7 +++++++ src/other.c | 3 +++ src/sort.c | 25 +++++++++++++++++++++++++ 6 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/.indent.pro b/src/.indent.pro index fb2aa48..16702c4 100644 --- a/src/.indent.pro +++ b/src/.indent.pro @@ -1,6 +1,7 @@ -linux -TFILE -Tipaddr_t +-Tleases_t -Toff_t -Trange_t -Tsize_t diff --git a/src/analyze.c b/src/analyze.c index 2ec8626..9c05a43 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -51,7 +51,7 @@ int prepare_data(void) { /* Sort leases */ - HASH_SORT(leases, ipcomp); + HASH_SORT(leases, leasecomp); /* Sort ranges */ qsort(ranges, (size_t)num_ranges, sizeof(struct range_t), &rangecomp); return 0; diff --git a/src/dhcpd-pools.c b/src/dhcpd-pools.c index 279db9a..974eaf6 100644 --- a/src/dhcpd-pools.c +++ b/src/dhcpd-pools.c @@ -71,6 +71,7 @@ const char *(*ntop_ipaddr) (const union ipaddr_t *ip); double (*get_range_size) (const struct range_t *r); int (*xstrstr) (const char *__restrict str); int (*ipcomp) (const union ipaddr_t *restrict a, const union ipaddr_t *restrict b); +int (*leasecomp) (const struct leases_t *restrict a, const struct leases_t *restrict b); int (*output_analysis) (void); void (*add_lease) (union ipaddr_t *ip, enum ltype type); struct leases_t *(*find_lease) (union ipaddr_t *ip); diff --git a/src/dhcpd-pools.h b/src/dhcpd-pools.h index f6dfd95..4c61273 100644 --- a/src/dhcpd-pools.h +++ b/src/dhcpd-pools.h @@ -269,6 +269,13 @@ extern int ipcomp_v4(const union ipaddr_t *restrict a, extern int ipcomp_v6(const union ipaddr_t *restrict a, const union ipaddr_t *restrict b) _DP_ATTRIBUTE_PURE; +extern int (*leasecomp) (const struct leases_t *restrict a, const struct leases_t *restrict b); +extern int leasecomp_init(const struct leases_t *restrict a + __attribute__ ((unused)), + const struct leases_t *restrict b __attribute__ ((unused))); +extern int leasecomp_v4(const struct leases_t *restrict a, const struct leases_t *restrict b); +extern int leasecomp_v6(const struct leases_t *restrict a, const struct leases_t *restrict b); + extern int comp_cur(struct range_t *r1, struct range_t *r2) _DP_ATTRIBUTE_PURE; extern int comp_double(double f1, double f2) _DP_ATTRIBUTE_CONST; extern int comp_ip(struct range_t *r1, struct range_t *r2); diff --git a/src/other.c b/src/other.c index fabb6d8..a983a5c 100644 --- a/src/other.c +++ b/src/other.c @@ -69,6 +69,7 @@ void set_ipv_functions(int version) find_lease = find_lease_v4; get_range_size = get_range_size_v4; ipcomp = ipcomp_v4; + leasecomp = leasecomp_v4; ntop_ipaddr = ntop_ipaddr_v4; parse_ipaddr = parse_ipaddr_v4; xstrstr = xstrstr_v4; @@ -81,6 +82,7 @@ void set_ipv_functions(int version) find_lease = find_lease_v6; get_range_size = get_range_size_v6; ipcomp = ipcomp_v6; + leasecomp = leasecomp_v6; ntop_ipaddr = ntop_ipaddr_v6; parse_ipaddr = parse_ipaddr_v6; xstrstr = xstrstr_v6; @@ -93,6 +95,7 @@ void set_ipv_functions(int version) find_lease = find_lease_init; get_range_size = get_range_size_init; ipcomp = ipcomp_init; + leasecomp = leasecomp_init; ntop_ipaddr = ntop_ipaddr_init; parse_ipaddr = parse_ipaddr_init; xstrstr = xstrstr_init; diff --git a/src/sort.c b/src/sort.c index bafc290..666b11e 100644 --- a/src/sort.c +++ b/src/sort.c @@ -74,6 +74,31 @@ int ipcomp_v6(const union ipaddr_t *restrict a, const union ipaddr_t *restrict b return memcmp(&a->v6, &b->v6, sizeof(a->v6)); } +/*! \brief Compare IP address in leases_t structure, with IPv4/v6 determination. + * \param a Binary IP address. + * \param b Binary IP address. + * \return If a < b return -1, if a < b return 1, when they are equal return 0. + */ +int leasecomp_init(const struct leases_t *restrict a __attribute__ ((unused)), + const struct leases_t *restrict b __attribute__ ((unused))) +{ + return 0; +} + +int leasecomp_v4(const struct leases_t *restrict a, const struct leases_t *restrict b) +{ + if (a->ip.v4 < b->ip.v4) + return -1; + if (a->ip.v4 > b->ip.v4) + return 1; + return 0; +} + +int leasecomp_v6(const struct leases_t *restrict a, const struct leases_t *restrict b) +{ + return memcmp(&a->ip.v6, &b->ip.v6, sizeof(a->ip.v6)); +} + /*! \brief Compare IP address in leases. Suitable for sorting range table. * \param r1 A range structure. * \param r2 A range structure. From 74c6ef25662819fdc56a913896c5c893dac3ca79 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 9 Aug 2014 19:34:18 +0100 Subject: [PATCH 019/224] update kernel.org url in README Signed-off-by: Sami Kerola --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 0e8ffa4..2c1fd7b 100644 --- a/README +++ b/README @@ -190,7 +190,7 @@ CODING STYLE: * The preferred coding style is based on the linux kernel Documentation/CodingStyle. For more details see: - http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=Documentation/CodingStyle + http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/CodingStyle * Source code is pretty printed by using two, and only the two, indent command switches -kr -i8 From 15502d3c972332823dd379a6f6649a95f785030b Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 24 Oct 2014 20:56:41 +0100 Subject: [PATCH 020/224] 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 --- src/getdata.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/getdata.c b/src/getdata.c index 56d5088..976f0c1 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -94,7 +94,9 @@ int parse_leases(void) } line = xmalloc(sizeof(char) * MAXLEN); + line[0] = '\0'; ipstring = xmalloc(sizeof(char) * MAXLEN); + ipstring[0] = '\0'; if (config.output_format[0] == 'X' || config.output_format[0] == 'J') { ethernets = true; } From bd5877bf4f9883eb05de109999473df193a8feb6 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 24 Oct 2014 20:58:27 +0100 Subject: [PATCH 021/224] update bootstrap from gnulib Signed-off-by: Sami Kerola --- bootstrap | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/bootstrap b/bootstrap index 8c68fea..60ff8cd 100755 --- a/bootstrap +++ b/bootstrap @@ -211,7 +211,17 @@ bootstrap_sync=false use_git=true check_exists() { - ($1 --version /dev/null 2>&1 + if test "$1" = "--verbose"; then + ($2 --version /dev/null 2>&1 + if test $? -ge 126; then + # If not found, run with diagnostics as one may be + # presented with env variables to set to find the right version + ($2 --version /dev/null 2>&1 + fi + test $? -lt 126 } @@ -409,7 +419,7 @@ sort_ver() { # sort -V is not generally available get_version() { app=$1 - $app --version >/dev/null 2>&1 || return 1 + $app --version >/dev/null 2>&1 || { $app --version; return 1; } $app --version 2>&1 | sed -n '# Move version to start of line. @@ -468,7 +478,7 @@ check_versions() { if [ "$req_ver" = "-" ]; then # Merely require app to exist; not all prereq apps are well-behaved # so we have to rely on $? rather than get_version. - if ! check_exists $app; then + if ! check_exists --verbose $app; then warn_ "Error: '$app' not found" ret=1 fi @@ -599,8 +609,8 @@ case ${GNULIB_SRCDIR--} in # Note that $use_git is necessarily true in this case. if git_modules_config submodule.gnulib.url >/dev/null; then echo "$0: getting gnulib files..." - git submodule init || exit $? - git submodule update || exit $? + git submodule init -- "$gnulib_path" || exit $? + git submodule update -- "$gnulib_path" || exit $? elif [ ! -d "$gnulib_path" ]; then echo "$0: getting gnulib files..." @@ -629,13 +639,14 @@ case ${GNULIB_SRCDIR--} in # This fallback allows at least git 1.5.5. if test -f "$gnulib_path"/gnulib-tool; then # Since file already exists, assume submodule init already complete. - git submodule update || exit $? + git submodule update -- "$gnulib_path" || exit $? else # Older git can't clone into an empty directory. rmdir "$gnulib_path" 2>/dev/null git clone --reference "$GNULIB_SRCDIR" \ "$(git_modules_config submodule.gnulib.url)" "$gnulib_path" \ - && git submodule init && git submodule update \ + && git submodule init -- "$gnulib_path" \ + && git submodule update -- "$gnulib_path" \ || exit $? fi fi From 0d2b30b62d176b32ac2a8475139fab4cf03bf67d Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 2 Nov 2014 21:56:43 +0000 Subject: [PATCH 022/224] 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 --- src/getdata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/getdata.c b/src/getdata.c index 976f0c1..0f5e8ae 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -325,7 +325,7 @@ void parse_config(int is_include, const char *restrict config_file, /* Long word which is almost causing overflow. None * of words are this long which the program is * searching. */ - if (MAXLEN < i) { + if (MAXLEN == i) { newclause = false; i = 0; continue; From e401c2c7e6e61e01b66dc1783ad813ce96ff1ddc Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 9 Nov 2014 22:25:25 +0000 Subject: [PATCH 023/224] other: reduce variable scope Signed-off-by: Sami Kerola --- src/other.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/other.c b/src/other.c index a983a5c..b5ff78b 100644 --- a/src/other.c +++ b/src/other.c @@ -404,8 +404,6 @@ void flip_ranges(struct range_t *restrict flip_me, struct range_t *restrict tmp_ /*! \brief Free memory, flush buffers etc. */ void clean_up(void) { - unsigned int i; - /* Just in case there something in buffers */ if (fflush(NULL)) { warn("clean_up: fflush"); @@ -416,6 +414,7 @@ void clean_up(void) free(ranges); delete_all_leases(); if (shared_networks) { + unsigned int i; num_shared_networks++; for (i = 0; i < num_shared_networks; i++) { free((shared_networks + i)->name); From 190df198a4e2c10f80f705bb3488c09bb9a453b3 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 9 Nov 2014 22:31:30 +0000 Subject: [PATCH 024/224] 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 --- src/output.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/output.c b/src/output.c index e713056..dc79bab 100644 --- a/src/output.c +++ b/src/output.c @@ -458,16 +458,16 @@ int output_json(void) static void html_header(FILE *restrict f) { char outstr[200]; - struct tm *tmp; + struct tm *tmp, result; struct stat statbuf; stat(config.dhcpdlease_file, &statbuf); - tmp = localtime(&statbuf.st_mtime); + tmp = localtime_r(&statbuf.st_mtime, &result); if (tmp == NULL) { err(EXIT_FAILURE, "html_header: localtime"); } - if (strftime(outstr, sizeof(outstr), nl_langinfo(D_T_FMT), tmp) == 0) { + if (strftime(outstr, sizeof(outstr), nl_langinfo(D_T_FMT), &result) == 0) { errx(EXIT_FAILURE, "html_header: strftime returned 0"); } From 5519763ba9c567f6eb04764b0696da628565a585 Mon Sep 17 00:00:00 2001 From: Wolfgang Steudel Date: Thu, 13 Nov 2014 09:45:59 +0000 Subject: [PATCH 025/224] 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 Signed-off-by: Wolfgang Steudel --- THANKS | 1 + src/output.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/THANKS b/THANKS index 8c18c15..949078f 100644 --- a/THANKS +++ b/THANKS @@ -31,3 +31,4 @@ Ryan Steinmetz Dan Pritts Fredrik Lysén Conor McCarthy +Wolfgang Steudel diff --git a/src/output.c b/src/output.c index dc79bab..9268b32 100644 --- a/src/output.c +++ b/src/output.c @@ -994,6 +994,7 @@ int output_alarming(void) } if (config.output_limit[1] & BIT2) { for (i = 0; i < num_shared_networks; i++) { + shared_p++; if (config.minsize < shared_p->available) { perc = (float)(100 * shared_p->used) / shared_p->available; if (config.critical < perc) @@ -1005,7 +1006,6 @@ int output_alarming(void) } else { si++; } - shared_p++; } } From 0705b0c17f0cf39808d8a48c5484a325a1d34294 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 14 Nov 2014 20:06:59 +0000 Subject: [PATCH 026/224] 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: 5519763ba9c567f6eb04764b0696da628565a585 Signed-off-by: Sami Kerola --- tests/Makemodule.am | 1 + tests/confs/shnet-alarm | 31 +++++++++ tests/expected/shnet-alarm | 3 + tests/leases/shnet-alarm | 136 +++++++++++++++++++++++++++++++++++++ tests/shnet-alarm | 16 +++++ 5 files changed, 187 insertions(+) create mode 100644 tests/confs/shnet-alarm create mode 100644 tests/expected/shnet-alarm create mode 100644 tests/leases/shnet-alarm create mode 100755 tests/shnet-alarm diff --git a/tests/Makemodule.am b/tests/Makemodule.am index f58a38f..fdb48be 100644 --- a/tests/Makemodule.am +++ b/tests/Makemodule.am @@ -8,6 +8,7 @@ TESTS = \ tests/alarm-warning \ tests/alarm-warning-ranges \ tests/alarm-warning-snets \ + tests/shnet-alarm \ tests/bootp \ tests/complete \ tests/empty \ diff --git a/tests/confs/shnet-alarm b/tests/confs/shnet-alarm new file mode 100644 index 0000000..0ef9eb0 --- /dev/null +++ b/tests/confs/shnet-alarm @@ -0,0 +1,31 @@ +shared-network example1 { + subnet 10.0.0.0 netmask 255.255.255.0 { + pool { + range 10.0.0.1 10.0.0.20; + } + } + subnet 10.1.0.0 netmask 255.255.255.0 { + pool { + range 10.1.0.1 10.1.0.20; + } + } +} + +shared-network example2 { + subnet 10.2.0.0 netmask 255.255.255.0 { + pool { + range 10.2.0.1 10.2.0.20; + } + } + subnet 10.3.0.0 netmask 255.255.255.0 { + pool { + range 10.3.0.1 10.3.0.20; + } + } +} + +subnet 10.4.0.0 netmask 255.255.255.0 { + pool { + range 10.4.0.1 10.4.0.20; + } +} diff --git a/tests/expected/shnet-alarm b/tests/expected/shnet-alarm new file mode 100644 index 0000000..250b77f --- /dev/null +++ b/tests/expected/shnet-alarm @@ -0,0 +1,3 @@ +CRITICAL: dhcpd-pools: Ranges - crit: 2 warn: 0 ok: 3; | range_crit=2 range_warn=0 range_ok=3 +Shared nets - crit: 1 warn: 0 ok: 1; | snet_crit=1 snet_warn=0 snet_ok=1 +2 diff --git a/tests/leases/shnet-alarm b/tests/leases/shnet-alarm new file mode 100644 index 0000000..d78db2c --- /dev/null +++ b/tests/leases/shnet-alarm @@ -0,0 +1,136 @@ +lease 10.0.0.1 { + binding state active; + hardware ethernet 00:00:00:00:00:09; +} + +lease 10.1.0.1 { + binding state active; + hardware ethernet 00:00:00:00:00:00; +} + +lease 10.2.0.0 { + binding state active; + hardware ethernet 00:00:00:00:00:00; +} +lease 10.2.0.1 { + binding state active; + hardware ethernet 00:00:00:00:00:01; +} +lease 10.2.0.2 { + binding state active; + hardware ethernet 00:00:00:00:00:02; +} +lease 10.2.0.3 { + binding state active; + hardware ethernet 00:00:00:00:00:03; +} +lease 10.2.0.4 { + binding state active; + hardware ethernet 00:00:00:00:00:04; +} +lease 10.2.0.5 { + binding state active; + hardware ethernet 00:00:00:00:00:05; +} + +lease 10.3.0.0 { + binding state active; + hardware ethernet 00:00:00:00:00:00; +} +lease 10.3.0.1 { + binding state active; + hardware ethernet 00:00:00:00:00:01; +} +lease 10.3.0.2 { + binding state active; + hardware ethernet 00:00:00:00:00:02; +} +lease 10.3.0.3 { + binding state active; + hardware ethernet 00:00:00:00:00:03; +} +lease 10.3.0.4 { + binding state active; + hardware ethernet 00:00:00:00:00:04; +} +lease 10.3.0.5 { + binding state active; + hardware ethernet 00:00:00:00:00:05; +} +lease 10.3.0.6 { + binding state active; + hardware ethernet 00:00:00:00:00:06; +} +lease 10.3.0.7 { + binding state active; + hardware ethernet 00:00:00:00:00:07; +} +lease 10.3.0.8 { + binding state active; + hardware ethernet 00:00:00:00:00:08; +} +lease 10.3.0.9 { + binding state active; + hardware ethernet 00:00:00:00:00:09; +} + +lease 10.4.0.0 { + binding state active; + hardware ethernet 00:00:00:00:00:00; +} +lease 10.4.0.1 { + binding state active; + hardware ethernet 00:00:00:00:00:01; +} +lease 10.4.0.2 { + binding state active; + hardware ethernet 00:00:00:00:00:02; +} +lease 10.4.0.3 { + binding state active; + hardware ethernet 00:00:00:00:00:03; +} +lease 10.4.0.4 { + binding state active; + hardware ethernet 00:00:00:00:00:04; +} +lease 10.4.0.5 { + binding state active; + hardware ethernet 00:00:00:00:00:05; +} +lease 10.4.0.6 { + binding state active; + hardware ethernet 00:00:00:00:00:00; +} +lease 10.4.0.7 { + binding state active; + hardware ethernet 00:00:00:00:00:01; +} +lease 10.4.0.8 { + binding state active; + hardware ethernet 00:00:00:00:00:02; +} +lease 10.4.0.9 { + binding state active; + hardware ethernet 00:00:00:00:00:03; +} +lease 10.4.0.10 { + binding state active; + hardware ethernet 00:00:00:00:00:04; +} +lease 10.4.0.11 { + binding state active; + hardware ethernet 00:00:00:00:00:05; +} +lease 10.4.0.12 { + binding state active; + hardware ethernet 00:00:00:00:00:06; +} +lease 10.4.0.13 { + binding state active; + hardware ethernet 00:00:00:00:00:07; +} +lease 10.4.0.14 { + binding state active; + hardware ethernet 00:00:00:00:00:08; +} diff --git a/tests/shnet-alarm b/tests/shnet-alarm new file mode 100755 index 0000000..24bb088 --- /dev/null +++ b/tests/shnet-alarm @@ -0,0 +1,16 @@ +#!/bin/sh +# +# Alarm critical ranges only. + +IAM=$(basename $0) + +if [ ! -d tests/outputs ]; then + mkdir tests/outputs +fi + +dhcpd-pools --critical=30 -c $top_srcdir/tests/confs/shnet-alarm \ + -l $top_srcdir/tests/leases/shnet-alarm -o tests/outputs/$IAM +echo $? >> tests/outputs/$IAM + +diff -u $top_srcdir/tests/expected/$IAM tests/outputs/$IAM +exit $? From 8e076fcc4fb4ff3746a354d29047665e29880f1c Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 14 Nov 2014 21:48:22 +0000 Subject: [PATCH 027/224] 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 --- bootstrap.conf | 1 + src/output.c | 96 ++++++++++++++++++++++++++++++-------------------- 2 files changed, 59 insertions(+), 38 deletions(-) diff --git a/bootstrap.conf b/bootstrap.conf index bb1840d..b815859 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -27,6 +27,7 @@ gnulib_modules=" fopen getopt-gnu inet_pton + isnan langinfo netinet_in progname diff --git a/src/output.c b/src/output.c index 9268b32..679a089 100644 --- a/src/output.c +++ b/src/output.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -147,12 +148,12 @@ int output_txt(void) "%-20s %5g %5g %10.3f %7g %6g %9.3f", shared_p->name, shared_p->available, shared_p->used, - (float)(100 * shared_p->used) / - shared_p->available, shared_p->touched, - shared_p->touched + shared_p->used, - (float)(100 * - (shared_p->touched + - shared_p->used)) / shared_p->available); + shared_p->available == + 0 ? -NAN : (float)(100 * shared_p->used) / shared_p->available, + shared_p->touched, shared_p->touched + shared_p->used, + shared_p->available == + 0 ? -NAN : ((float)(100 * (shared_p->touched + shared_p->used)) / + shared_p->available)); if (config.backups_found == true) { fprintf(outfile, "%7g %8.3f", shared_p->backups, @@ -180,17 +181,18 @@ int output_txt(void) shared_networks->name, shared_networks->available, shared_networks->used, - (float)(100 * shared_networks->used) / - shared_networks->available, - shared_networks->touched, + shared_networks->available == + 0 ? -NAN : (float)(100 * shared_networks->used) / + shared_networks->available, shared_networks->touched, shared_networks->touched + shared_networks->used, - (float)(100 * - (shared_networks->touched + - shared_networks->used)) / shared_networks->available); + shared_networks->available == + 0 ? -NAN : (float)(100 * + (shared_networks->touched + + shared_networks->used)) / shared_networks->available); if (config.backups_found == true) { fprintf(outfile, "%7g %8.3f", - shared_networks->backups, + shared_networks->available == 0 ? -NAN : shared_networks->backups, (float)(100 * shared_networks->backups) / shared_networks->available); } @@ -736,18 +738,23 @@ int output_html(void) output_double(outfile, "td", shared_p->available); output_double(outfile, "td", shared_p->used); output_float(outfile, "td", - (float)(100 * shared_p->used) / shared_p->available); + shared_p->available == + 0 ? -NAN : (float)(100 * shared_p->used) / + shared_p->available); output_double(outfile, "td", shared_p->touched); output_double(outfile, "td", shared_p->touched + shared_p->used); output_float(outfile, "td", - (float)(100 * - (shared_p->touched + - shared_p->used)) / shared_p->available); + shared_p->available == 0 ? -NAN : (float)(100 * + (shared_p->touched + + shared_p->used)) / + shared_p->available); if (config.backups_found == true) { output_double(outfile, "td", shared_p->backups); output_float(outfile, "td", - (float)(100 * - shared_p->backups) / shared_p->available); + shared_p->available == 0 ? -NAN : (float)(100 * + shared_p-> + backups) / + shared_p->available); } endrow(outfile); @@ -776,18 +783,24 @@ int output_html(void) output_double(outfile, "td", shared_networks->available); output_double(outfile, "td", shared_networks->used); output_float(outfile, "td", - (float)(100 * shared_networks->used) / shared_networks->available); + shared_networks->available == + 0 ? -NAN : (float)(100 * shared_networks->used) / + shared_networks->available); output_double(outfile, "td", shared_networks->touched); output_double(outfile, "td", shared_networks->touched + shared_networks->used); output_float(outfile, "td", - (float)(100 * - (shared_networks->touched + - shared_networks->used)) / shared_networks->available); + shared_networks->available == 0 ? -NAN : (float)(100 * + (shared_networks-> + touched + + shared_networks-> + used)) / + shared_networks->available); if (config.backups_found == true) { output_double(outfile, "td", shared_networks->backups); output_float(outfile, "td", - (float)(100 * - shared_networks->backups) / + shared_networks->available == 0 ? -NAN : (float)(100 * + shared_networks-> + backups) / shared_networks->available); } endrow(outfile); @@ -888,16 +901,19 @@ int output_csv(void) "\"%s\",\"%g\",\"%g\",\"%.3f\",\"%g\",\"%g\",\"%.3f\"", shared_p->name, shared_p->available, shared_p->used, - (float)(100 * shared_p->used) / + shared_p->available == 0 ? -NAN : (float)(100 * shared_p->used) / shared_p->available, shared_p->touched, shared_p->touched + shared_p->used, - (float)(100 * - (shared_p->touched + - shared_p->used)) / shared_p->available); + shared_p->available == 0 ? -NAN : (float)(100 * + (shared_p->touched + + shared_p->used)) / + shared_p->available); if (config.backups_found == true) { fprintf(outfile, ",\"%g\",\"%.3f\"", shared_p->backups, - (float)(100 * shared_p->backups) / shared_p->available); + shared_p->available == + 0 ? -NAN : (float)(100 * shared_p->backups) / + shared_p->available); } fprintf(outfile, "\n"); @@ -919,17 +935,19 @@ int output_csv(void) "\"%s\",\"%g\",\"%g\",\"%.3f\",\"%g\",\"%g\",\"%.3f\"", shared_networks->name, shared_networks->available, shared_networks->used, - (float)(100 * shared_networks->used) / - shared_networks->available, - shared_networks->touched, + shared_networks->available == + 0 ? -NAN : (float)(100 * shared_networks->used) / + shared_networks->available, shared_networks->touched, shared_networks->touched + shared_networks->used, - (float)(100 * - (shared_networks->touched + - shared_networks->used)) / shared_networks->available); + shared_networks->available == + 0 ? -NAN : (float)(100 * + (shared_networks->touched + + shared_networks->used)) / shared_networks->available); if (config.backups_found == true) { fprintf(outfile, "%7g %8.3f", shared_networks->backups, - (float)(100 * shared_networks->backups) / + shared_networks->available == + 0 ? -NAN : (float)(100 * shared_networks->backups) / shared_networks->available); } fprintf(outfile, "\n"); @@ -996,7 +1014,9 @@ int output_alarming(void) for (i = 0; i < num_shared_networks; i++) { shared_p++; if (config.minsize < shared_p->available) { - perc = (float)(100 * shared_p->used) / shared_p->available; + perc = + shared_p->available == + 0 ? 100 : (float)(100 * shared_p->used) / shared_p->available; if (config.critical < perc) sc++; else if (config.warning < perc) From 33894fba74b8fc78d445b46f87fb83f5f96dc308 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 14 Nov 2014 21:55:17 +0000 Subject: [PATCH 028/224] 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 --- src/other.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/other.c b/src/other.c index b5ff78b..f81e506 100644 --- a/src/other.c +++ b/src/other.c @@ -393,9 +393,8 @@ void flip_ranges(struct range_t *restrict flip_me, struct range_t *restrict tmp_ { unsigned int i = num_ranges - 1, j; - for (j = 0; j < num_ranges; j++) { + for (j = 0; j < num_ranges; j++, i--) { *(tmp_ranges + j) = *(flip_me + i); - i--; } memcpy(flip_me, tmp_ranges, num_ranges * sizeof(struct range_t)); From cfbd69c20b0a7de5028f0f4435876a3d44441355 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 15 Nov 2014 09:27:41 +0000 Subject: [PATCH 029/224] maint: remove unnecessary braces, spaces, update gnulib .gitignore Improve code readability, and small maintenance. Signed-off-by: Sami Kerola --- lib/.gitignore | 11 ++++++ src/.indent.pro | 2 + src/analyze.c | 17 ++------- src/dhcpd-pools.c | 33 ++++------------ src/getdata.c | 96 +++++++++++++++-------------------------------- src/hash.c | 6 +++ src/other.c | 47 ++++++++++++----------- src/sort.c | 15 ++------ 8 files changed, 86 insertions(+), 141 deletions(-) diff --git a/lib/.gitignore b/lib/.gitignore index 8208f92..928a516 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -40,6 +40,9 @@ /fd-hook.h /fdopen.c /fflush.c +/float+.h +/float.c +/float.in.h /fopen.c /fpending.c /fpending.h @@ -60,6 +63,11 @@ /gettimeofday.c /inet_pton.c /intprops.h +/isnan.c +/isnand.c +/isnanf.c +/isnanl.c +/itold.c /langinfo.h /langinfo.in.h /libdhcpd_pools.la @@ -67,6 +75,9 @@ /localcharset.h /lseek.c /malloc.c +/math.c +/math.h +/math.in.h /mbrtowc.c /mbsinit.c /memchr.c diff --git a/src/.indent.pro b/src/.indent.pro index 16702c4..3d15003 100644 --- a/src/.indent.pro +++ b/src/.indent.pro @@ -9,3 +9,5 @@ -Tuintmax_t -l100 -ppi1 +-bad +-sob diff --git a/src/analyze.c b/src/analyze.c index 9c05a43..4c39b62 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -65,19 +65,16 @@ int do_counting(void) const struct leases_t *restrict l = leases; unsigned long i, k, block_size; - range_p = ranges; - /* Walk through ranges */ + range_p = ranges; for (i = 0; i < num_ranges; i++) { for (; l != NULL && ipcomp(&range_p->first_ip, &l->ip) < 0; l = l->hh.prev) /* rewind */ ; if (l == NULL) l = leases; for (; l != NULL && ipcomp(&l->ip, &range_p->last_ip) <= 0; l = l->hh.next) { - if (ipcomp(&l->ip, &range_p->first_ip) < 0) { - /* should not be necessary */ - continue; - } + if (ipcomp(&l->ip, &range_p->first_ip) < 0) + continue; /* cannot happen? */ /* IP in range */ switch (l->type) { case FREE: @@ -90,7 +87,6 @@ int do_counting(void) range_p->backups++; break; } - if (range_p->shared_net) { switch (l->type) { case FREE: @@ -105,16 +101,12 @@ int do_counting(void) } } } - /* Size of range, shared net & all networks */ block_size = get_range_size(range_p); - if (range_p->shared_net) { + if (range_p->shared_net) range_p->shared_net->available += block_size; - } - range_p++; } - /* FIXME: During count of other shared networks default network * and all networks got mixed together semantically. The below * fixes the problem, but is not elegant. */ @@ -129,6 +121,5 @@ int do_counting(void) shared_networks->backups += range_p->backups; range_p++; } - return 0; } diff --git a/src/dhcpd-pools.c b/src/dhcpd-pools.c index 974eaf6..bfb312b 100644 --- a/src/dhcpd-pools.c +++ b/src/dhcpd-pools.c @@ -99,7 +99,6 @@ int main(int argc, char **argv) }; int ret_val; - /* Options for getopt_long */ static struct option const long_options[] = { {"config", required_argument, NULL, 'c'}, {"leases", required_argument, NULL, 'l'}, @@ -118,20 +117,17 @@ int main(int argc, char **argv) atexit(close_stdout); set_program_name(argv[0]); - /* FIXME: These allocations should be fully dynamic, e.g., grow * if needed. */ config.dhcpdconf_file = xmalloc(sizeof(char) * MAXLEN); config.dhcpdlease_file = xmalloc(sizeof(char) * MAXLEN); config.output_file = xmalloc(sizeof(char) * MAXLEN); - /* Make sure string has zero length if there is no * command line option */ config.output_file[0] = '\0'; /* Alarming defaults. */ config.warning = ALARM_WARN; config.critical = ALARM_CRIT; - /* File location defaults */ strncpy(config.dhcpdconf_file, DHCPDCONF_FILE, MAXLEN - 1); strncpy(config.dhcpdlease_file, DHCPDLEASE_FILE, MAXLEN - 1); @@ -140,22 +136,18 @@ int main(int argc, char **argv) tmp++; config.output_limit[1] = (*tmp - '0'); config.fullhtml = false; - /* Make sure some output format is selected by default */ strncpy(config.output_format, OUTPUT_FORMAT, (size_t)1); - /* Default sort order is by IPs small to big */ config.reverse_order = false; config.backups_found = false; - /* Parse command line options */ while (1) { int c; - c = getopt_long(argc, argv, "c:l:f:o:s:rL:vh", long_options, &option_index); + c = getopt_long(argc, argv, "c:l:f:o:s:rL:vh", long_options, &option_index); if (c == EOF) break; - switch (c) { case 'c': /* config file */ @@ -176,12 +168,10 @@ int main(int argc, char **argv) warnx("main: only first 5 sort orders will be used"); strncpy(config.sort, optarg, (size_t)5); sorts = 5; - } else { + } else strncpy(config.sort, optarg, (size_t)sorts); - } - for (i = 0; i < sorts; i++) { + for (i = 0; i < sorts; i++) field_selector(config.sort[i]); - } break; case 'r': /* What ever sort in reverse order */ @@ -194,9 +184,9 @@ int main(int argc, char **argv) case 'L': /* Specification what will be printed */ for (i = 0; i < 2; i++) { - if (optarg[i] >= '0' && optarg[i] < '8') { + if (optarg[i] >= '0' && optarg[i] < '8') config.output_limit[i] = optarg[i] - '0'; - } else { + else { clean_up(); errx(EXIT_FAILURE, "main: output mask `%s' is illegal", optarg); @@ -224,7 +214,6 @@ int main(int argc, char **argv) errx(EXIT_FAILURE, "Try `%s --help' for more information.", program_name); } } - /* Output function selection */ switch (config.output_format[0]) { case 't': @@ -259,25 +248,20 @@ int main(int argc, char **argv) clean_up(); errx(EXIT_FAILURE, "main: unknown output format `%c'", config.output_format[0]); } - /* Do the job */ prepare_memory(); set_ipv_functions(VERSION_UNKNOWN); parse_config(true, config.dhcpdconf_file, shared_networks); - parse_leases(); prepare_data(); do_counting(); tmp_ranges = xmalloc(sizeof(struct range_t) * num_ranges); - if (sorts != 0) { + if (sorts != 0) mergesort_ranges(ranges, num_ranges, tmp_ranges); - } - if (config.reverse_order == true) { + if (config.reverse_order == true) flip_ranges(ranges, tmp_ranges); - } free(tmp_ranges); ret_val = output_analysis(); - clean_up(); return (ret_val); } @@ -291,14 +275,11 @@ int prepare_memory(void) RANGES = 64; num_ranges = num_shared_networks = 0; shared_networks = xmalloc(sizeof(struct shared_network_t) * SHARED_NETWORKS); - ranges = xmalloc(sizeof(struct range_t) * RANGES); - /* First shared network entry is all networks */ shared_networks->name = xstrdup("All networks"); shared_networks->used = 0; shared_networks->touched = 0; shared_networks->backups = 0; - return 0; } diff --git a/src/getdata.c b/src/getdata.c index 0f5e8ae..bf2de86 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -69,42 +69,33 @@ int parse_leases(void) struct leases_t *lease; dhcpd_leases = fopen(config.dhcpdlease_file, "r"); - if (dhcpd_leases == NULL) { + if (dhcpd_leases == NULL) err(EXIT_FAILURE, "parse_leases: %s", config.dhcpdlease_file); - } #ifdef HAVE_POSIX_FADVISE # ifdef POSIX_FADV_NOREUSE - if (posix_fadvise(fileno(dhcpd_leases), 0, 0, POSIX_FADV_NOREUSE) != 0) { + if (posix_fadvise(fileno(dhcpd_leases), 0, 0, POSIX_FADV_NOREUSE) != 0) err(EXIT_FAILURE, "parse_leases: fadvise %s", config.dhcpdlease_file); - } # endif /* POSIX_FADV_NOREUSE */ # ifdef POSIX_FADV_SEQUENTIAL - if (posix_fadvise(fileno(dhcpd_leases), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) { + if (posix_fadvise(fileno(dhcpd_leases), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) err(EXIT_FAILURE, "parse_leases: fadvise %s", config.dhcpdlease_file); - } # endif /* POSIX_FADV_SEQUENTIAL */ #endif /* HAVE_POSIX_FADVISE */ - /* I found out that there's one lease address per 300 bytes in * dhcpd.leases file. Malloc is little bit pessimistic and uses 250. * If someone has higher density in lease file I'm interested to * hear about that. */ - if (stat(config.dhcpdlease_file, &lease_file_stats)) { + if (stat(config.dhcpdlease_file, &lease_file_stats)) err(EXIT_FAILURE, "parse_leases: %s", config.dhcpdlease_file); - } - line = xmalloc(sizeof(char) * MAXLEN); line[0] = '\0'; ipstring = xmalloc(sizeof(char) * MAXLEN); ipstring[0] = '\0'; - if (config.output_format[0] == 'X' || config.output_format[0] == 'J') { + if (config.output_format[0] == 'X' || config.output_format[0] == 'J') ethernets = true; - } - while (!feof(dhcpd_leases)) { - if (!fgets(line, MAXLEN, dhcpd_leases) && ferror(dhcpd_leases)) { + if (!fgets(line, MAXLEN, dhcpd_leases) && ferror(dhcpd_leases)) err(EXIT_FAILURE, "parse_leases: %s", config.dhcpdlease_file); - } switch (xstrstr(line)) { /* It's a lease, save IP */ case PREFIX_LEASE: @@ -122,23 +113,20 @@ int parse_leases(void) case PREFIX_BINDING_STATE_ABANDONED: case PREFIX_BINDING_STATE_EXPIRED: case PREFIX_BINDING_STATE_RELEASED: - if ((lease = find_lease(&addr)) != NULL) { + if ((lease = find_lease(&addr)) != NULL) delete_lease(lease); - } add_lease(&addr, FREE); break; case PREFIX_BINDING_STATE_ACTIVE: /* remove old entry, if exists */ - if ((lease = find_lease(&addr)) != NULL) { + if ((lease = find_lease(&addr)) != NULL) delete_lease(lease); - } add_lease(&addr, ACTIVE); break; case PREFIX_BINDING_STATE_BACKUP: /* remove old entry, if exists */ - if ((lease = find_lease(&addr)) != NULL) { + if ((lease = find_lease(&addr)) != NULL) delete_lease(lease); - } add_lease(&addr, BACKUP); config.backups_found = true; break; @@ -147,9 +135,8 @@ int parse_leases(void) break; memcpy(macstring, line + 20, 17); macstring[17] = '\0'; - if ((lease = find_lease(&addr)) != NULL) { + if ((lease = find_lease(&addr)) != NULL) lease->ethernet = xstrdup(macstring); - } break; default: /* do nothing */ ; @@ -193,41 +180,34 @@ void parse_config(int is_include, const char *restrict config_file, struct range_t *range_p; word = xmalloc(sizeof(char) * MAXLEN); - - if (is_include) { + if (is_include) /* Default place holder for ranges "All networks". */ shared_p->name = shared_networks->name; - } - /* Open configuration file */ dhcpd_config = fopen(config_file, "r"); - if (dhcpd_config == NULL) { + if (dhcpd_config == NULL) err(EXIT_FAILURE, "parse_config: %s", config_file); - } #ifdef HAVE_POSIX_FADVISE # ifdef POSIX_FADV_NOREUSE - if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_NOREUSE) != 0) { + if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_NOREUSE) != 0) err(EXIT_FAILURE, "parse_config: fadvise %s", config_file); - } # endif /* POSIX_FADV_NOREUSE */ # ifdef POSIX_FADV_SEQUENTIAL - if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) { + if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) err(EXIT_FAILURE, "parse_config: fadvise %s", config_file); - } # endif /* POSIX_FADV_SEQUENTIAL */ #endif /* HAVE_POSIX_FADVISE */ - /* Very hairy stuff begins. */ while (unlikely(!feof(dhcpd_config))) { char c; + c = fgetc(dhcpd_config); /* Certain characters are magical */ switch (c) { /* Handle comments if they are not quoted */ case '#': - if (quote == 0) { + if (quote == 0) comment = true; - } continue; case '"': if (comment == false) { @@ -239,15 +219,13 @@ void parse_config(int is_include, const char *restrict config_file, case '\n': /* New line resets comment section, but * not if quoted */ - if (quote == 0) { + if (quote == 0) comment = false; - } break; case ';': /* Quoted colon does not mean new clause */ - if (0 < quote) { + if (0 < quote) break; - } if (comment == false && argument != ITS_A_RANGE_FIRST_IP && argument != ITS_A_RANGE_SECOND_IP && argument != ITS_AN_INCLUCE) { @@ -271,25 +249,21 @@ void parse_config(int is_include, const char *restrict config_file, } continue; case '{': - if (0 < quote) { + if (0 < quote) break; - } - if (comment == 0) { + if (comment == 0) braces++; - } /* i == 0 detects word that ends to brace like: * * shared-network DSL{ ... */ if (i == 0) { newclause = true; continue; - } else { + } else break; - } case '}': - if (0 < quote) { + if (0 < quote) break; - } if (comment == false) { braces--; /* End of shared-network */ @@ -307,16 +281,13 @@ void parse_config(int is_include, const char *restrict config_file, default: break; } - /* Either inside comment or Nth word of clause. */ - if (comment == true || (newclause == false && argument == ITS_NOTHING_INTERESTING)) { + if (comment == true || (newclause == false && argument == ITS_NOTHING_INTERESTING)) continue; - } /* Strip white spaces before new clause word. */ if ((newclause == true || argument != ITS_NOTHING_INTERESTING) - && isspace(c) && i == 0 && one_ip_range == false) { + && isspace(c) && i == 0 && one_ip_range == false) continue; - } /* Save to word which clause this is. */ if ((newclause == true || argument != ITS_NOTHING_INTERESTING) && (!isspace(c) || 0 < quote)) { @@ -335,14 +306,12 @@ void parse_config(int is_include, const char *restrict config_file, else if (newclause == true) { /* Insert string end & set state */ word[i] = '\0'; - if (word[i - 1] != '{') { + if (word[i - 1] != '{') newclause = false; - } i = 0; argument = is_interesting_config_clause(word); - if (argument == ITS_A_RANGE_FIRST_IP) { + if (argument == ITS_A_RANGE_FIRST_IP) one_ip_range = true; - } } /* words after range, shared-network or include */ else if (argument != ITS_NOTHING_INTERESTING) { @@ -377,11 +346,9 @@ void parse_config(int is_include, const char *restrict config_file, case ITS_A_RANGE_FIRST_IP: /* printf ("range 1nd ip: %s\n", word); */ range_p = ranges + num_ranges; - if (!(parse_ipaddr(word, &addr))) { - /* word was not ip, try - * again */ + if (!(parse_ipaddr(word, &addr))) + /* word was not ip, try again */ break; - } copy_ipaddr(&range_p->first_ip, &addr); one_ip_range = false; argument = ITS_A_RANGE_SECOND_IP; @@ -395,13 +362,10 @@ void parse_config(int is_include, const char *restrict config_file, shared_p->used = 0; shared_p->touched = 0; shared_p->backups = 0; - if (SHARED_NETWORKS < num_shared_networks + 2) { - /* FIXME: make this - * away by reallocating - * more space. */ + if (SHARED_NETWORKS < num_shared_networks + 2) + /* FIXME: make this to go away by reallocating more space. */ errx(EXIT_FAILURE, "parse_config: increase default.h SHARED_NETWORKS and recompile"); - } argument = ITS_NOTHING_INTERESTING; braces_shared = braces; break; diff --git a/src/hash.c b/src/hash.c index 4b42610..a75e9f4 100644 --- a/src/hash.c +++ b/src/hash.c @@ -55,6 +55,7 @@ void add_lease_init(union ipaddr_t *addr void add_lease_v4(union ipaddr_t *addr, enum ltype type) { struct leases_t *l; + l = xmalloc(sizeof(struct leases_t)); copy_ipaddr(&l->ip, addr); l->type = type; @@ -65,6 +66,7 @@ void add_lease_v4(union ipaddr_t *addr, enum ltype type) void add_lease_v6(union ipaddr_t *addr, enum ltype type) { struct leases_t *l; + l = xmalloc(sizeof(struct leases_t)); copy_ipaddr(&l->ip, addr); l->type = type; @@ -84,6 +86,7 @@ struct leases_t *find_lease_init(union ipaddr_t *addr __attribute__ ((unused))) struct leases_t *find_lease_v4(union ipaddr_t *addr) { struct leases_t *l; + HASH_FIND_INT(leases, &addr->v4, l); return l; } @@ -91,6 +94,7 @@ struct leases_t *find_lease_v4(union ipaddr_t *addr) struct leases_t *find_lease_v6(union ipaddr_t *addr) { struct leases_t *l; + HASH_FIND_V6(leases, &addr->v4, l); return l; } @@ -109,6 +113,7 @@ void delete_lease(struct leases_t *lease) void delete_all_leases(void) { struct leases_t *l, *tmp; + HASH_ITER(hh, leases, l, tmp) { free(l->ethernet); HASH_DEL(leases, l); @@ -120,6 +125,7 @@ void delete_all_leases(void) { while (leases) { struct leases_t *l; + l = leases; free(l->ethernet); HASH_DEL(leases, l); /* leases advances to next on delete */ diff --git a/src/other.c b/src/other.c index f81e506..e9f49c8 100644 --- a/src/other.c +++ b/src/other.c @@ -117,13 +117,13 @@ int parse_ipaddr_init(const char *restrict src, union ipaddr_t *restrict dst) { struct in_addr addr; struct in6_addr addr6; - if (inet_aton(src, &addr) == 1) { + + if (inet_aton(src, &addr) == 1) set_ipv_functions(VERSION_4); - } else if (inet_pton(AF_INET6, src, &addr6) == 1) { + else if (inet_pton(AF_INET6, src, &addr6) == 1) set_ipv_functions(VERSION_6); - } else { + else return 0; - } return parse_ipaddr(src, dst); } @@ -131,6 +131,7 @@ int parse_ipaddr_v4(const char *restrict src, union ipaddr_t *restrict dst) { int rv; struct in_addr addr; + rv = inet_aton(src, &addr); dst->v4 = ntohl(addr.s_addr); return rv == 1; @@ -140,6 +141,7 @@ int parse_ipaddr_v6(const char *restrict src, union ipaddr_t *restrict dst) { int rv; struct in6_addr addr; + rv = inet_pton(AF_INET6, src, &addr); memcpy(&dst->v6, addr.s6_addr, sizeof(addr.s6_addr)); return rv == 1; @@ -175,6 +177,7 @@ void copy_ipaddr_v6(union ipaddr_t *restrict dst, const union ipaddr_t *restrict const char *ntop_ipaddr_init(const union ipaddr_t *ip __attribute__ ((unused))) { static char buffer = '\0'; + return &buffer; } @@ -182,6 +185,7 @@ const char *ntop_ipaddr_v4(const union ipaddr_t *ip) { static char buffer[sizeof("255.255.255.255")]; struct in_addr addr; + addr.s_addr = htonl(ip->v4); return inet_ntop(AF_INET, &addr, buffer, sizeof(buffer)); } @@ -190,6 +194,7 @@ const char *ntop_ipaddr_v6(const union ipaddr_t *ip) { static char buffer[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")]; struct in6_addr addr; + memcpy(addr.s6_addr, ip->v6, sizeof(addr.s6_addr)); return inet_ntop(AF_INET6, &addr, buffer, sizeof(buffer)); } @@ -214,6 +219,7 @@ double get_range_size_v6(const struct range_t *r) { double size = 0; int i; + /* When calculating the size of an IPv6 range overflow may occur. * In that case only the last LONG_BIT bits are preserved, thus * we just skip the first (16 - LONG_BIT) bits... */ @@ -260,11 +266,11 @@ int xstrstr_v4(const char *restrict str) { size_t len; - if (str[2] == 'b' || str[2] == 'h') { + + if (str[2] == 'b' || str[2] == 'h') len = strlen(str); - } else { + else len = 0; - } if (15 < len) { switch (str[16]) { case 'f': @@ -295,9 +301,8 @@ int break; } } - if (!memcmp("lease ", str, 6)) { + if (!memcmp("lease ", str, 6)) return PREFIX_LEASE; - } return NUM_OF_PREFIX; } @@ -314,11 +319,11 @@ int xstrstr_v6(const char *restrict str) { size_t len; - if (str[4] == 'b' || str[2] == 'h') { + + if (str[4] == 'b' || str[2] == 'h') len = strlen(str); - } else { + else len = 0; - } if (17 < len) { switch (str[18]) { case 'f': @@ -349,9 +354,8 @@ int break; } } - if (!memcmp(" iaaddr ", str, 9)) { + if (!memcmp(" iaaddr ", str, 9)) return PREFIX_LEASE; - } return NUM_OF_PREFIX; } @@ -370,15 +374,12 @@ double strtod_or_err(const char *restrict str, const char *restrict errmesg) goto err; errno = 0; num = strtod(str, &end); - if (errno || str == end || (end && *end)) goto err; - return num; err: if (errno) err(EXIT_FAILURE, "%s: '%s'", errmesg, str); - errx(EXIT_FAILURE, "%s: '%s'", errmesg, str); } @@ -393,10 +394,8 @@ void flip_ranges(struct range_t *restrict flip_me, struct range_t *restrict tmp_ { unsigned int i = num_ranges - 1, j; - for (j = 0; j < num_ranges; j++, i--) { + for (j = 0; j < num_ranges; j++, i--) *(tmp_ranges + j) = *(flip_me + i); - } - memcpy(flip_me, tmp_ranges, num_ranges * sizeof(struct range_t)); } @@ -404,9 +403,8 @@ void flip_ranges(struct range_t *restrict flip_me, struct range_t *restrict tmp_ void clean_up(void) { /* Just in case there something in buffers */ - if (fflush(NULL)) { + if (fflush(NULL)) warn("clean_up: fflush"); - } free(config.dhcpdconf_file); free(config.dhcpdlease_file); free(config.output_file); @@ -414,10 +412,10 @@ void clean_up(void) delete_all_leases(); if (shared_networks) { unsigned int i; + num_shared_networks++; - for (i = 0; i < num_shared_networks; i++) { + for (i = 0; i < num_shared_networks; i++) free((shared_networks + i)->name); - } free(shared_networks); } } @@ -437,6 +435,7 @@ void __attribute__ ((__noreturn__)) print_version(void) void __attribute__ ((__noreturn__)) usage(int status) { FILE *out; + out = status != 0 ? stderr : stdout; fprintf(out, "\ diff --git a/src/sort.c b/src/sort.c index 666b11e..b01db91 100644 --- a/src/sort.c +++ b/src/sort.c @@ -265,20 +265,16 @@ static int merge(struct range_t *restrict left, struct range_t *restrict right) return (1); continue; } - /* Select which function is pointed by comparer */ comparer = field_selector(config.sort[i]); cmp = comparer(left, right); /* If fields are equal use next sort method */ - if (cmp == 0) { + if (cmp == 0) continue; - } - if (cmp < 0) { + if (cmp < 0) return (1); - } return (0); } - /* If all comparers where equal */ return (0); } @@ -300,23 +296,19 @@ void mergesort_ranges(struct range_t *restrict orig, int size, struct range_t *r for (left = 0; left < size; left++) { hold = *(orig + left); for (right = left - 1; 0 <= right; right--) { - if (merge((orig + right), &hold)) { + if (merge((orig + right), &hold)) break; - } *(orig + right + 1) = *(orig + right); } *(orig + right + 1) = hold; } return; } - mergesort_ranges(orig, size / 2, temp); mergesort_ranges(orig + size / 2, size - size / 2, temp); - left = 0; right = size / 2; i = 0; - while (left < size / 2 && right < size) { if (merge((orig + left), (orig + right))) { *(temp + i) = *(orig + left); @@ -337,6 +329,5 @@ void mergesort_ranges(struct range_t *restrict orig, int size, struct range_t *r right++; i++; } - memcpy(orig, temp, size * sizeof(struct range_t)); } From c7379e3e2518d19130dec8ad18674e70582f24f9 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 15 Nov 2014 10:02:41 +0000 Subject: [PATCH 030/224] release: 2.26 Signed-off-by: Sami Kerola --- NEWS | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/NEWS b/NEWS index 905dc0e..8c0a1a2 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,29 @@ Please send dhcpd-pools bug reports to kerolasa@iki.fi. gpg: Signature is crated using RSA key ID FDE9B739. +Version 2.26 +$ git shortlog v2.25..v2.26 +Sami Kerola (15): + news: add the note about .sig pgp key id + reindent all files + declare global variables only once + add appropriate sorting function for struct leases_t + update kernel.org url in README + getdata: fix buffer-overflows reported by address sanitizer + update bootstrap from gnulib + getdata: fix buffer overflow [AddressSanitizer] + other: reduce variable scope + output: prefer thread safe function localtime_r() + tests: add regression test to avoid shared-net off by one alarming + issue + output: avoid division by zero + other: disallow unsigned counter ever to have minus value + maint: remove unnecessary braces, spaces, update gnulib .gitignore + release: 2.26 + +Wolfgang Steudel (1): + alarming: include last shared network in alarming [off by one] + Version 2.25 $ git shortlog v2.24..v2.25 Sami Kerola (14): From 34dd1dee6ef8a6cf984df1b001ac9c6ddea77277 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Wed, 1 Apr 2015 23:10:43 +0100 Subject: [PATCH 031/224] docs: remove very basic git usage info This is not a git beginner manual project. Signed-off-by: Sami Kerola --- README | 147 --------------------------------------------------------- 1 file changed, 147 deletions(-) diff --git a/README b/README index 2c1fd7b..d38bd29 100644 --- a/README +++ b/README @@ -47,150 +47,3 @@ This is dhcpd-pools which is made for ISC dhcpd pool range analysis. If you are interested to help this way put all files into tar.gz, and send them to kerolasa@iki.fi. It would be nice that email subject line would have 'dhcpd-pools test data'. - - -== Instructions for developers - -AUTOTOOLS: - - * "./bootstrap" generates all files needed to compile and - install the code (run it after checkout from git) - - * "make distclean" removes all unnecessary files, but the - code can still be recompiled with "./configure; make" - -PATCHES: - - * First get familiar with git. In case you are completely - lost watch Greg Kroah-Hartman explaining the very - basics. - http://archive.fosdem.org/2010/schedule/events/linuxkernelpatch - - * Get up to date version of the code base. - - $ git clone git://dhcpd-pools.git.sourceforge.net/gitroot/dhcpd-pools/dhcpd-pools - - * Don't include generated (autotools) stuff to your - patches (hint: use git-clean [-X]) - - * Add a Signed-off-by line, use "git commit -s" - - * Patches are delivered via email only. The following - commands will do the correct thing. - - $ git format-patch -C origin/master..yourbranch -o ~/patches - - When you send only one patch use the following. - - $ git send-email --to kerolasa@iki.fi 0001* - - The command above expects you have configured email - sending properly. See git.wiki for help. - https://git.wiki.kernel.org/index.php/GitTips#Mail - - * One patch per email, with the changelog in the body of - the email. - - * When you send series of pathes include introductory - message. - - $ git send-email --compose --to kerolasa@iki.fi ~/00* - - Good introductory message will have at least - - -- snip - Your Name (3): - firstfile.c: short description - secondfile.c: another description - - firstfile.c | 2 +- - secondfile.c | 2 +- - secondfile.c | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) - -- snip - - Above introductory can be generated with git. - - $ git shortlog master..yourbranch - $ git diff --stat master..yourbranch - - * Subject: [PATCH] subsystem: description. Following - ~/.gitconfig will help you a little. - - -- snip - [user] - name = Your Name - email = your.name@example.com - - [format] - subjectprefix = PATCH - numbered = auto - signoff = yes - - [sendemail] - chainreplyto = false - cc = your.name@example.com - -- snip - - * If someone else wrote the patch, they should be - credited (and blamed) for it. To communicate this, add - a line: - - From: John Doe - - The sign-off is a simple line at the end of the - explanation for the patch, which certifies that you - wrote it or otherwise have the right to pass it on as a - open-source patch. The rules are pretty simple: if you - can certify the below: - - By making a contribution to this project, I certify - that: - - (a) The contribution was created in whole or in - part by me and I have the right to submit it - under the open source license indicated in the - file; or - - (b) The contribution is based upon previous work - that, to the best of my knowledge, is covered - under an appropriate open source license and I - have the right under that license to submit - that work with modifications, whether created - in whole or in part by me, under the same open - source license (unless I am permitted to submit - under a different license), as indicated in the - file; or - - (c) The contribution was provided directly to me by - some other person who certified (a), (b) or (c) - and I have not modified it. - - (d) I understand and agree that this project and - the contribution are public and that a record - of the contribution (including all personal - information I submit with it, including my - sign-off) is maintained indefinitely and may be - redistributed consistent with this project or - the open source license(s) involved. - - then you just add a line saying - - Signed-off-by: Random J Developer - - using your real name (sorry, no pseudonyms or anonymous - contributions.) - - * If the the business with git is too difficult just send - source code files as is as email attachment to - maintainer. - -CODING STYLE: - - * The preferred coding style is based on the linux kernel - Documentation/CodingStyle. For more details see: - - http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/Documentation/CodingStyle - - * Source code is pretty printed by using two, and only - the two, indent command switches -kr -i8 From 735c5db817b274b2802e9d1f14667e816935890f Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Wed, 1 Apr 2015 23:15:38 +0100 Subject: [PATCH 032/224] docs: remove todo items that will never happen Signed-off-by: Sami Kerola --- TODO | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/TODO b/TODO index fe04930..fa08675 100644 --- a/TODO +++ b/TODO @@ -14,26 +14,3 @@ o When time stamps are part of lease situation evaluation (see bug 1) add a --now switch which will one can use to change when expiry happens. o Add lease time histogram support. - -### Next major version - -1 Well structured code, with extendible sane architecture. -2 Server, which has analysis in cache for N seconds and will - answer via socket. -3 Configuration file for server. -4 State file, where different ranges, shared networks etc have - unique identifiers (needed for graphs). -5 Support for snmp and munin protocols. -6 SNMP traps when limits get exceeded. -7 Some clever check_dhcpd_pools binary for Nagios & other - monitoring software. - -8 Super server support, which will collect analysis from other - dhcpd-pool servers. -9 Nice http view interface on super server, much can be copied - from http://piwik.org/ -10 And some other things perhaps... - -When items 1-7 are done v3 can be released. To support rewrite -there should be a design document with nice blue print, which is -a web page. From 73b357484d54fcdb7c97492ad8b4d78dcfaf4f7e Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 2 May 2015 18:00:10 +0100 Subject: [PATCH 033/224] output: remove empty element from xml Signed-off-by: Sami Kerola --- src/output.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/output.c b/src/output.c index 679a089..1865266 100644 --- a/src/output.c +++ b/src/output.c @@ -264,12 +264,8 @@ int output_xml(void) } else { fprintf(outfile, "\t\n"); } - - fprintf(outfile, "\t\n"); - fprintf(outfile, "\t\n"); fprintf(outfile, "\t%s ", ntop_ipaddr(&range_p->first_ip)); fprintf(outfile, "- %s\n", ntop_ipaddr(&range_p->last_ip)); - fprintf(outfile, "\t\n"); fprintf(outfile, "\t%g\n", range_size); fprintf(outfile, "\t%g\n", range_p->count); fprintf(outfile, "\t%g\n", range_size - range_p->count); From 0d6c61d437541ee4b3b5a9fa23a8ad0f81d3544a Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 2 May 2015 18:48:52 +0100 Subject: [PATCH 034/224] 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 Signed-off-by: Sami Kerola --- THANKS | 1 + src/output.c | 6 ++++++ tests/expected/same-twice-json | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/THANKS b/THANKS index 949078f..260293d 100644 --- a/THANKS +++ b/THANKS @@ -32,3 +32,4 @@ Dan Pritts Fredrik Lysén Conor McCarthy Wolfgang Steudel +Aaron Paetznick diff --git a/src/output.c b/src/output.c index 1865266..156be3d 100644 --- a/src/output.c +++ b/src/output.c @@ -268,6 +268,7 @@ int output_xml(void) fprintf(outfile, "- %s\n", ntop_ipaddr(&range_p->last_ip)); fprintf(outfile, "\t%g\n", range_size); fprintf(outfile, "\t%g\n", range_p->count); + fprintf(outfile, "\t%g\n", range_p->touched); fprintf(outfile, "\t%g\n", range_size - range_p->count); range_p++; range_size = get_range_size(range_p); @@ -282,6 +283,7 @@ int output_xml(void) fprintf(outfile, "\t%s\n", shared_p->name); fprintf(outfile, "\t%g\n", shared_p->available); fprintf(outfile, "\t%g\n", shared_p->used); + fprintf(outfile, "\t%g\n", shared_p->touched); fprintf(outfile, "\t%g\n", shared_p->available - shared_p->used); fprintf(outfile, "\n"); @@ -293,6 +295,7 @@ int output_xml(void) fprintf(outfile, "\t%s\n", shared_networks->name); fprintf(outfile, "\t%g\n", shared_networks->available); fprintf(outfile, "\t%g\n", shared_networks->used); + fprintf(outfile, "\t%g\n", shared_networks->touched); fprintf(outfile, "\t%g\n", shared_networks->available - shared_networks->used); fprintf(outfile, "\n"); @@ -385,6 +388,7 @@ int output_json(void) fprintf(outfile, " - %s\", ", ntop_ipaddr(&range_p->last_ip)); fprintf(outfile, "\"defined\":%g, ", range_size); fprintf(outfile, "\"used\":%g, ", range_p->count); + fprintf(outfile, "\"touched\":%g, ", range_p->touched); fprintf(outfile, "\"free\":%g ", range_size - range_p->count); range_p++; range_size = get_range_size(range_p); @@ -409,6 +413,7 @@ int output_json(void) fprintf(outfile, "\"location\":\"%s\", ", shared_p->name); fprintf(outfile, "\"defined\":%g, ", shared_p->available); fprintf(outfile, "\"used\":%g, ", shared_p->used); + fprintf(outfile, "\"touched\":%g, ", shared_p->touched); fprintf(outfile, "\"free\":%g ", shared_p->available - shared_p->used); if (i + 1 < num_shared_networks) fprintf(outfile, "},\n"); @@ -427,6 +432,7 @@ int output_json(void) fprintf(outfile, " \"location\":\"%s\",\n", shared_networks->name); fprintf(outfile, " \"defined\":%g,\n", shared_networks->available); fprintf(outfile, " \"used\":%g,\n", shared_networks->used); + fprintf(outfile, " \"touched\":%g,\n", shared_networks->touched); fprintf(outfile, " \"free\":%g\n", shared_networks->available - shared_networks->used); fprintf(outfile, " }"); /* end of summary */ diff --git a/tests/expected/same-twice-json b/tests/expected/same-twice-json index aa0c419..7d29ad9 100644 --- a/tests/expected/same-twice-json +++ b/tests/expected/same-twice-json @@ -3,7 +3,7 @@ { "ip":"10.0.0.5", "macaddress":"00:00:00:00:00:00" } ], "subnets": [ - { "location":"All networks", "range":"10.0.0.1 - 10.0.0.10", "defined":10, "used":1, "free":9 } + { "location":"All networks", "range":"10.0.0.1 - 10.0.0.10", "defined":10, "used":1, "touched":0, "free":9 } ], "shared-networks": [ ], @@ -11,6 +11,7 @@ "location":"All networks", "defined":10, "used":1, + "touched":0, "free":9 } } From c4e5ef61982b2ffc84940e38b76690b76e8f405e Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 2 May 2015 18:51:39 +0100 Subject: [PATCH 035/224] add xml format check Signed-off-by: Sami Kerola --- tests/Makemodule.am | 1 + tests/expected/same-twice-xml | 21 +++++++++++++++++++++ tests/full-xml | 13 +++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 tests/expected/same-twice-xml create mode 100755 tests/full-xml diff --git a/tests/Makemodule.am b/tests/Makemodule.am index fdb48be..07e55ae 100644 --- a/tests/Makemodule.am +++ b/tests/Makemodule.am @@ -13,6 +13,7 @@ TESTS = \ tests/complete \ tests/empty \ tests/full-json \ + tests/full-xml \ tests/leading0 \ tests/one-ip \ tests/one-line \ diff --git a/tests/expected/same-twice-xml b/tests/expected/same-twice-xml new file mode 100644 index 0000000..93612d6 --- /dev/null +++ b/tests/expected/same-twice-xml @@ -0,0 +1,21 @@ + + + 10.0.0.5 + 00:00:00:00:00:00 + + + All networks + 10.0.0.1 - 10.0.0.10 + 10 + 1 + 0 + 9 + + + All networks + 10 + 1 + 0 + 9 + + diff --git a/tests/full-xml b/tests/full-xml new file mode 100755 index 0000000..33fce2c --- /dev/null +++ b/tests/full-xml @@ -0,0 +1,13 @@ +#!/bin/sh +# +# Minimal regression test suite. + +if [ ! -d tests/outputs ]; then + mkdir tests/outputs +fi + +dhcpd-pools -f X -c $top_srcdir/tests/confs/same-twice \ + -l $top_srcdir/tests/leases/same-twice \ + -o tests/outputs/same-twice-xml +diff -u $top_srcdir/tests/expected/same-twice-xml tests/outputs/same-twice-xml +exit $? From 9d1241c00644e4ff52aad4b2d5ff9fbdef24b33e Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 2 May 2015 19:40:06 +0100 Subject: [PATCH 036/224] 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 --- src/output.c | 136 +++++++++++++++++++++++++-------------------------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/src/output.c b/src/output.c index 156be3d..28d6775 100644 --- a/src/output.c +++ b/src/output.c @@ -475,59 +475,59 @@ static void html_header(FILE *restrict f) errx(EXIT_FAILURE, "html_header: strftime returned 0"); } - fprintf(f, "\n"); + fprintf(f, "\n"); fprintf(f, "\n"); fprintf(f, "\n"); fprintf(f, "\n"); - fprintf(f, " ISC dhcpd stats\n"); - fprintf(f, " \n"); + fprintf(f, "ISC dhcpd stats\n"); + fprintf(f, "\n"); fprintf(f, "\n"); fprintf(f, "\n"); fprintf(f, "The lease file mtime: %s", outstr); @@ -541,12 +541,12 @@ static void html_footer(FILE *restrict f) { fprintf(f, "


\n"); fprintf(f, "
\n"); - fprintf(f, "

\nData generated by "); + fprintf(f, "

\nData generated by "); fprintf(f, "", PACKAGE_URL); fprintf(f, "%s.\n

\n", PACKAGE_STRING); - fprintf(f, "

\n"); + fprintf(f, "

\n"); fprintf(f, "\n
\n

\n"); fprintf(f, "\n"); @@ -568,7 +568,7 @@ static void newrow(FILE *restrict f) */ static void endrow(FILE *restrict f) { - fprintf(f, "\n\n"); + fprintf(f, "\n"); } /*! \brief Line with text in html output format. @@ -581,7 +581,7 @@ static void endrow(FILE *restrict f) static void output_line(FILE *restrict f, char const *restrict type, char const *restrict class, char const *restrict text) { - fprintf(f, " <%s class=%s>%s\n", type, class, text, type); + fprintf(f, "<%s class=\"%s\">%s\n", type, class, text, type); } /*! \brief Line with digit in html output format. @@ -592,7 +592,7 @@ static void output_line(FILE *restrict f, char const *restrict type, */ static void output_double(FILE *restrict f, char const *restrict type, double d) { - fprintf(f, " <%s class=ralign>%g\n", type, d, type); + fprintf(f, "<%s class=\"ralign\">%g\n", type, d, type); } /*! \brief Line with float in html output format. @@ -603,7 +603,7 @@ static void output_double(FILE *restrict f, char const *restrict type, double d) */ static void output_float(FILE *f, char const *restrict type, float fl) { - fprintf(f, " <%s class=ralign>%.3f\n", type, fl, type); + fprintf(f, "<%s class=\"ralign\">%.3f\n", type, fl, type); } /*! \brief Begin table in html output format. @@ -634,7 +634,7 @@ static void table_end(FILE *restrict f) static void newsection(FILE *restrict f, char const *restrict title) { newrow(f); - output_line(f, "td", "calign", " "); + output_line(f, "td", "lalign", " "); endrow(f); newrow(f); output_line(f, "th", "section", title); @@ -671,9 +671,9 @@ int output_html(void) if (config.output_limit[0] & BIT1) { newsection(outfile, "Ranges:"); newrow(outfile); - output_line(outfile, "th", "calign", "shared net name"); - output_line(outfile, "th", "calign", "first ip"); - output_line(outfile, "th", "calign", "last ip"); + output_line(outfile, "th", "lalign", "shared net name"); + output_line(outfile, "th", "lalign", "first ip"); + output_line(outfile, "th", "lalign", "last ip"); output_line(outfile, "th", "ralign", "max"); output_line(outfile, "th", "ralign", "cur"); output_line(outfile, "th", "ralign", "percent"); @@ -690,12 +690,12 @@ int output_html(void) for (i = 0; i < num_ranges; i++) { newrow(outfile); if (range_p->shared_net) { - output_line(outfile, "td", "calign", range_p->shared_net->name); + output_line(outfile, "td", "lalign", range_p->shared_net->name); } else { - output_line(outfile, "td", "calign", "not_defined"); + output_line(outfile, "td", "lalign", "not_defined"); } - output_line(outfile, "td", "calign", ntop_ipaddr(&range_p->first_ip)); - output_line(outfile, "td", "calign", ntop_ipaddr(&range_p->last_ip)); + output_line(outfile, "td", "lalign", ntop_ipaddr(&range_p->first_ip)); + output_line(outfile, "td", "lalign", ntop_ipaddr(&range_p->last_ip)); output_double(outfile, "td", range_size); output_double(outfile, "td", range_p->count); output_float(outfile, "td", (float)(100 * range_p->count) / range_size); @@ -719,7 +719,7 @@ int output_html(void) if (config.output_limit[0] & BIT2) { newsection(outfile, "Shared networks:"); newrow(outfile); - output_line(outfile, "th", "calign", "name"); + output_line(outfile, "th", "lalign", "name"); output_line(outfile, "th", "ralign", "max"); output_line(outfile, "th", "ralign", "cur"); output_line(outfile, "th", "ralign", "percent"); @@ -736,7 +736,7 @@ int output_html(void) for (i = 0; i < num_shared_networks; i++) { shared_p++; newrow(outfile); - output_line(outfile, "td", "calign", shared_p->name); + output_line(outfile, "td", "lalign", shared_p->name); output_double(outfile, "td", shared_p->available); output_double(outfile, "td", shared_p->used); output_float(outfile, "td", @@ -765,7 +765,7 @@ int output_html(void) if (config.output_limit[0] & BIT3) { newsection(outfile, "Sum of all ranges:"); newrow(outfile); - output_line(outfile, "th", "calign", "name"); + output_line(outfile, "th", "lalign", "name"); output_line(outfile, "th", "ralign", "max"); output_line(outfile, "th", "ralign", "cur"); output_line(outfile, "th", "ralign", "percent"); @@ -781,7 +781,7 @@ int output_html(void) } if (config.output_limit[1] & BIT3) { newrow(outfile); - output_line(outfile, "td", "calign", shared_networks->name); + output_line(outfile, "td", "lalign", shared_networks->name); output_double(outfile, "td", shared_networks->available); output_double(outfile, "td", shared_networks->used); output_float(outfile, "td", From cf26e17fe761bbc4e21e501c8cf800c2990ba9a1 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 29 May 2015 09:18:08 +0100 Subject: [PATCH 037/224] add hint about configure options to README Proposed-by: Tim Cantin Signed-off-by: Sami Kerola --- README | 4 ++++ THANKS | 1 + 2 files changed, 5 insertions(+) diff --git a/README b/README index d38bd29..270c6b7 100644 --- a/README +++ b/README @@ -7,6 +7,10 @@ This is dhcpd-pools which is made for ISC dhcpd pool range analysis. make make install + # Notice that there are configuration options for dhcpd.conf, + # dhcpd.leases, and uthash include paths, among other things. + + ./configure --help == General information diff --git a/THANKS b/THANKS index 260293d..286cbce 100644 --- a/THANKS +++ b/THANKS @@ -33,3 +33,4 @@ Fredrik Lys Conor McCarthy Wolfgang Steudel Aaron Paetznick +Tim Cantin From d8aef85d012c483177fbe4acfe1d5fb0dca7a774 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Fri, 4 Sep 2015 11:11:56 +0100 Subject: [PATCH 038/224] man: fix character class change Debian package lint found going back to roman mode was broken. Reported-by: Martijn van Brummelen Signed-off-by: Sami Kerola --- THANKS | 1 + man/dhcpd-pools.1.in | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/THANKS b/THANKS index 286cbce..07b1f68 100644 --- a/THANKS +++ b/THANKS @@ -34,3 +34,4 @@ Conor McCarthy Wolfgang Steudel Aaron Paetznick Tim Cantin +Martijn van Brummelen diff --git a/man/dhcpd-pools.1.in b/man/dhcpd-pools.1.in index 28b2fc5..a054a5f 100644 --- a/man/dhcpd-pools.1.in +++ b/man/dhcpd-pools.1.in @@ -1,4 +1,4 @@ -.TH DHCPD-POOLS "1" "2012-11-25" "@PACKAGE_STRING@" "User Commands" +.TH DHCPD-POOLS "1" "2015-09-04" "@PACKAGE_STRING@" "User Commands" .SH NAME dhcpd-pools \- ISC dhcpd pools usage analysis .SH SYNOPSIS @@ -161,7 +161,7 @@ is If critical percentage is not specified it defaults to .BR @ALARM_CRIT@ . .TP -\fB\-\-minsize\fR=\fIsize\f +\fB\-\-minsize\fR=\fIsize\fR Ignore ranges and shared networks that are smaller or equal to the defined size. This option is meaningful only in context of alarming, and will intented to supress for example single host ranges. By default this From 167c4b698916b7d095beb3fda9da73d2dec8a9b2 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 5 Sep 2015 13:33:02 +0100 Subject: [PATCH 039/224] gitignore: update gnulib file list Signed-off-by: Sami Kerola --- lib/.gitignore | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/.gitignore b/lib/.gitignore index 928a516..2e2c50e 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -7,6 +7,7 @@ /Makefile.am /Makefile.in /_Exit.c +/alloca.in.h /arg-nonnull.h /arpa/ /arpa_inet.in.h @@ -75,6 +76,9 @@ /localcharset.h /lseek.c /malloc.c +/malloca.c +/malloca.h +/malloca.valgrind /math.c /math.h /math.in.h @@ -83,6 +87,8 @@ /memchr.c /memchr.valgrind /memcpy.c +/mktime-internal.h +/mktime.c /msvc-inval.c /msvc-inval.h /msvc-nothrow.c @@ -99,12 +105,14 @@ /ref-add.sin /ref-del.sed /ref-del.sin +/setenv.c /stat.c /stdalign.h /stdalign.in.h /stdarg.in.h /stdbool.in.h /stddef.in.h +/stdint.in.h /stdio-impl.h /stdio.c /stdio.h @@ -131,12 +139,16 @@ /sys_time.in.h /sys_types.in.h /sys_uio.in.h +/time-internal.h /time.h /time.in.h /time_r.c +/time_rz.c +/timegm.c /unistd.c /unistd.h /unistd.in.h +/unsetenv.c /unused-parameter.h /verify.h /warn-on-use.h From fae20302cf8dc8fe6ff354fec00a93b9b1f6a2c4 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 5 Sep 2015 13:17:46 +0100 Subject: [PATCH 040/224] release: 2.27 Signed-off-by: Sami Kerola --- NEWS | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/NEWS b/NEWS index 8c0a1a2..77360eb 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,19 @@ Please send dhcpd-pools bug reports to kerolasa@iki.fi. gpg: Signature is crated using RSA key ID FDE9B739. +Version 2.27 +Sami Kerola (9): + docs: remove very basic git usage info + docs: remove todo items that will never happen + output: remove empty element from xml + add touched addresses counts to xml and json reports + add xml format check + improve html output + add hint about configure options to README + man: fix character class change + gitignore: update gnulib file list + release: 2.27 + Version 2.26 $ git shortlog v2.25..v2.26 Sami Kerola (15): From 535dfc4fc2ac64183466a6e1f584852de19e45c6 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Mon, 26 Oct 2015 22:12:37 +0000 Subject: [PATCH 041/224] 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 Signed-off-by: Sami Kerola --- THANKS | 1 + bootstrap.conf | 1 + build-aux/.gitignore | 1 + lib/.gitignore | 1 + src/dhcpd-pools.c | 20 +++++++------ src/getdata.c | 29 ++++++++++--------- src/hash.c | 5 +++- src/other.c | 19 ++++++------ src/output.c | 69 +++++++++++++++++++++++--------------------- src/sort.c | 10 +++---- 10 files changed, 84 insertions(+), 72 deletions(-) diff --git a/THANKS b/THANKS index 07b1f68..331b868 100644 --- a/THANKS +++ b/THANKS @@ -35,3 +35,4 @@ Wolfgang Steudel Aaron Paetznick Tim Cantin Martijn van Brummelen +Anton Tkachev diff --git a/bootstrap.conf b/bootstrap.conf index b815859..b51e08a 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -20,6 +20,7 @@ gnulib_modules=" close-stream closeout + error fclose fcntl-h fdopen diff --git a/build-aux/.gitignore b/build-aux/.gitignore index a7f0fb2..a85ce13 100644 --- a/build-aux/.gitignore +++ b/build-aux/.gitignore @@ -1,3 +1,4 @@ +/ar-lib /compile /config.guess /config.sub diff --git a/lib/.gitignore b/lib/.gitignore index 2e2c50e..b0e5275 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -7,6 +7,7 @@ /Makefile.am /Makefile.in /_Exit.c +/alloca.h /alloca.in.h /arg-nonnull.h /arpa/ diff --git a/src/dhcpd-pools.c b/src/dhcpd-pools.c index bfb312b..267d185 100644 --- a/src/dhcpd-pools.c +++ b/src/dhcpd-pools.c @@ -38,10 +38,9 @@ */ #include + #include #include -#include -#include #include #include #include @@ -49,11 +48,13 @@ #include "close-stream.h" #include "closeout.h" -#include "defaults.h" -#include "dhcpd-pools.h" +#include "error.h" #include "progname.h" #include "xalloc.h" +#include "dhcpd-pools.h" +#include "defaults.h" + /* Global variables */ int prefix_length[2][NUM_OF_PREFIX]; struct configuration_t config; @@ -165,7 +166,7 @@ int main(int argc, char **argv) /* Output sorting option */ sorts = strlen(optarg); if (5 < sorts) { - warnx("main: only first 5 sort orders will be used"); + error(0, 0, "main: only first 5 sort orders will be used"); strncpy(config.sort, optarg, (size_t)5); sorts = 5; } else @@ -188,8 +189,8 @@ int main(int argc, char **argv) config.output_limit[i] = optarg[i] - '0'; else { clean_up(); - errx(EXIT_FAILURE, - "main: output mask `%s' is illegal", optarg); + error(EXIT_FAILURE, 0, + "main: output mask `%s' is illegal", optarg); } } break; @@ -211,7 +212,8 @@ int main(int argc, char **argv) /* Print help */ usage(EXIT_SUCCESS); default: - errx(EXIT_FAILURE, "Try `%s --help' for more information.", program_name); + error(EXIT_FAILURE, 0, "Try `%s --help' for more information.", + program_name); } } /* Output function selection */ @@ -246,7 +248,7 @@ int main(int argc, char **argv) break; default: clean_up(); - errx(EXIT_FAILURE, "main: unknown output format `%c'", config.output_format[0]); + error(EXIT_FAILURE, 0, "main: unknown output format `%c'", config.output_format[0]); } /* Do the job */ prepare_memory(); diff --git a/src/getdata.c b/src/getdata.c index bf2de86..591d743 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -53,10 +52,12 @@ #include #include -#include "defaults.h" -#include "dhcpd-pools.h" +#include "error.h" #include "xalloc.h" +#include "dhcpd-pools.h" +#include "defaults.h" + /*! \brief Lease file parser. The parser can only read ISC DHCPD * dhcpd.leases file format. */ int parse_leases(void) @@ -70,15 +71,15 @@ int parse_leases(void) dhcpd_leases = fopen(config.dhcpdlease_file, "r"); if (dhcpd_leases == NULL) - err(EXIT_FAILURE, "parse_leases: %s", config.dhcpdlease_file); + error(EXIT_FAILURE, errno, "parse_leases: %s", config.dhcpdlease_file); #ifdef HAVE_POSIX_FADVISE # ifdef POSIX_FADV_NOREUSE if (posix_fadvise(fileno(dhcpd_leases), 0, 0, POSIX_FADV_NOREUSE) != 0) - err(EXIT_FAILURE, "parse_leases: fadvise %s", config.dhcpdlease_file); + error(EXIT_FAILURE, errno, "parse_leases: fadvise %s", config.dhcpdlease_file); # endif /* POSIX_FADV_NOREUSE */ # ifdef POSIX_FADV_SEQUENTIAL if (posix_fadvise(fileno(dhcpd_leases), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) - err(EXIT_FAILURE, "parse_leases: fadvise %s", config.dhcpdlease_file); + error(EXIT_FAILURE, errno, "parse_leases: fadvise %s", config.dhcpdlease_file); # endif /* POSIX_FADV_SEQUENTIAL */ #endif /* HAVE_POSIX_FADVISE */ /* I found out that there's one lease address per 300 bytes in @@ -86,7 +87,7 @@ int parse_leases(void) * If someone has higher density in lease file I'm interested to * hear about that. */ if (stat(config.dhcpdlease_file, &lease_file_stats)) - err(EXIT_FAILURE, "parse_leases: %s", config.dhcpdlease_file); + error(EXIT_FAILURE, errno, "parse_leases: %s", config.dhcpdlease_file); line = xmalloc(sizeof(char) * MAXLEN); line[0] = '\0'; ipstring = xmalloc(sizeof(char) * MAXLEN); @@ -95,7 +96,7 @@ int parse_leases(void) ethernets = true; while (!feof(dhcpd_leases)) { if (!fgets(line, MAXLEN, dhcpd_leases) && ferror(dhcpd_leases)) - err(EXIT_FAILURE, "parse_leases: %s", config.dhcpdlease_file); + error(EXIT_FAILURE, errno, "parse_leases: %s", config.dhcpdlease_file); switch (xstrstr(line)) { /* It's a lease, save IP */ case PREFIX_LEASE: @@ -186,15 +187,15 @@ void parse_config(int is_include, const char *restrict config_file, /* Open configuration file */ dhcpd_config = fopen(config_file, "r"); if (dhcpd_config == NULL) - err(EXIT_FAILURE, "parse_config: %s", config_file); + error(EXIT_FAILURE, errno, "parse_config: %s", config_file); #ifdef HAVE_POSIX_FADVISE # ifdef POSIX_FADV_NOREUSE if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_NOREUSE) != 0) - err(EXIT_FAILURE, "parse_config: fadvise %s", config_file); + error(EXIT_FAILURE, errno, "parse_config: fadvise %s", config_file); # endif /* POSIX_FADV_NOREUSE */ # ifdef POSIX_FADV_SEQUENTIAL if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0) - err(EXIT_FAILURE, "parse_config: fadvise %s", config_file); + error(EXIT_FAILURE, errno, "parse_config: fadvise %s", config_file); # endif /* POSIX_FADV_SEQUENTIAL */ #endif /* HAVE_POSIX_FADVISE */ /* Very hairy stuff begins. */ @@ -364,8 +365,8 @@ void parse_config(int is_include, const char *restrict config_file, shared_p->backups = 0; if (SHARED_NETWORKS < num_shared_networks + 2) /* FIXME: make this to go away by reallocating more space. */ - errx(EXIT_FAILURE, - "parse_config: increase default.h SHARED_NETWORKS and recompile"); + error(EXIT_FAILURE, 0, + "parse_config: increase default.h SHARED_NETWORKS and recompile"); argument = ITS_NOTHING_INTERESTING; braces_shared = braces; break; @@ -380,7 +381,7 @@ void parse_config(int is_include, const char *restrict config_file, argument = ITS_NOTHING_INTERESTING; break; default: - warnx("impossible occurred, report a bug"); + error(0, 0, "impossible occurred, report a bug"); assert(0); } } diff --git a/src/hash.c b/src/hash.c index a75e9f4..08b95b4 100644 --- a/src/hash.c +++ b/src/hash.c @@ -38,9 +38,12 @@ * analysis happen as quick as possible.. */ -#include "dhcpd-pools.h" +#include + #include "xalloc.h" +#include "dhcpd-pools.h" + #define HASH_FIND_V6(head, findv6, out) HASH_FIND(hh, head, findv6, 16, out) #define HASH_ADD_V6(head, v6field, add) HASH_ADD(hh, head, v6field, 16, add) diff --git a/src/other.c b/src/other.c index e9f49c8..67c2f4d 100644 --- a/src/other.c +++ b/src/other.c @@ -39,13 +39,9 @@ #include -#include "dhcpd-pools.h" -#include "defaults.h" -#include "progname.h" - #include -#include #include +#include #include #include #include @@ -53,7 +49,12 @@ #include #include #include -#include + +#include "error.h" +#include "progname.h" + +#include "dhcpd-pools.h" +#include "defaults.h" /*! \brief Set function pointers depending on IP version. * \param ip IP version. @@ -378,9 +379,7 @@ double strtod_or_err(const char *restrict str, const char *restrict errmesg) goto err; return num; err: - if (errno) - err(EXIT_FAILURE, "%s: '%s'", errmesg, str); - errx(EXIT_FAILURE, "%s: '%s'", errmesg, str); + error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str); } /*! \brief Reverse range. @@ -404,7 +403,7 @@ void clean_up(void) { /* Just in case there something in buffers */ if (fflush(NULL)) - warn("clean_up: fflush"); + error(0, 0, "clean_up: fflush"); free(config.dhcpdconf_file); free(config.dhcpdlease_file); free(config.output_file); diff --git a/src/output.c b/src/output.c index 28d6775..06a5469 100644 --- a/src/output.c +++ b/src/output.c @@ -40,7 +40,6 @@ #include #include -#include #include #include #include @@ -53,10 +52,12 @@ #include #include "close-stream.h" -#include "dhcpd-pools.h" +#include "error.h" #include "progname.h" #include "strftime.h" +#include "dhcpd-pools.h" + /*! \brief Text output format, which is the default. * FIXME: This function should return void. */ int output_txt(void) @@ -72,7 +73,7 @@ int output_txt(void) if (config.output_file[0]) { outfile = fopen(config.output_file, "w+"); if (outfile == NULL) { - err(EXIT_FAILURE, "output_txt: %s", config.output_file); + error(EXIT_FAILURE, errno, "output_txt: %s", config.output_file); } } else { outfile = stdout; @@ -201,12 +202,12 @@ int output_txt(void) if (outfile == stdout) { ret = fflush(stdout); if (ret) { - warn("output_txt: fflush"); + error(0, 0, "output_txt: fflush"); } } else { ret = close_stream(outfile); if (ret) { - warn("output_txt: fclose"); + error(0, 0, "output_txt: fclose"); } } @@ -228,7 +229,7 @@ int output_xml(void) if (config.output_file[0]) { outfile = fopen(config.output_file, "w+"); if (outfile == NULL) { - err(EXIT_FAILURE, "output_xml: %s", config.output_file); + error(EXIT_FAILURE, errno, "output_xml: %s", config.output_file); } } else { outfile = stdout; @@ -242,6 +243,7 @@ int output_xml(void) if (config.output_format[0] == 'X' || config.output_format[0] == 'J') { struct leases_t *l; + for (l = leases; l != NULL; l = l->hh.next) { if (l->type == ACTIVE) { fputs("\n\t", outfile); @@ -305,12 +307,12 @@ int output_xml(void) if (outfile == stdout) { ret = fflush(stdout); if (ret) { - warn("output_xml: fflush"); + error(0, 0, "output_xml: fflush"); } } else { ret = close_stream(outfile); if (ret) { - warn("output_xml: fclose"); + error(0, 0, "output_xml: fclose"); } } @@ -333,7 +335,7 @@ int output_json(void) if (config.output_file[0]) { outfile = fopen(config.output_file, "w+"); if (outfile == NULL) { - err(EXIT_FAILURE, "output_json: %s", config.output_file); + error(EXIT_FAILURE, errno, "output_json: %s", config.output_file); } } else { outfile = stdout; @@ -348,6 +350,7 @@ int output_json(void) if (config.output_format[0] == 'X' || config.output_format[0] == 'J') { struct leases_t *l; + fprintf(outfile, " \"active_leases\": ["); for (l = leases; l != NULL; l = l->hh.next) { if (l->type == ACTIVE) { @@ -443,12 +446,12 @@ int output_json(void) if (outfile == stdout) { ret = fflush(stdout); if (ret) { - warn("output_json: fflush"); + error(0, 0, "output_json: fflush"); } } else { ret = close_stream(outfile); if (ret) { - warn("output_json: fclose"); + error(0, 0, "output_json: fclose"); } } @@ -465,14 +468,15 @@ static void html_header(FILE *restrict f) struct tm *tmp, result; struct stat statbuf; + stat(config.dhcpdlease_file, &statbuf); tmp = localtime_r(&statbuf.st_mtime, &result); if (tmp == NULL) { - err(EXIT_FAILURE, "html_header: localtime"); + error(EXIT_FAILURE, errno, "html_header: localtime"); } if (strftime(outstr, sizeof(outstr), nl_langinfo(D_T_FMT), &result) == 0) { - errx(EXIT_FAILURE, "html_header: strftime returned 0"); + error(EXIT_FAILURE, 0, "html_header: strftime returned 0"); } fprintf(f, "backups); output_float(outfile, "td", shared_p->available == 0 ? -NAN : (float)(100 * - shared_p-> - backups) / - shared_p->available); + shared_p->backups) + / shared_p->available); } endrow(outfile); @@ -792,18 +796,16 @@ int output_html(void) output_double(outfile, "td", shared_networks->touched + shared_networks->used); output_float(outfile, "td", shared_networks->available == 0 ? -NAN : (float)(100 * - (shared_networks-> - touched + - shared_networks-> - used)) / - shared_networks->available); + (shared_networks->touched + + + shared_networks->used)) + / shared_networks->available); if (config.backups_found == true) { output_double(outfile, "td", shared_networks->backups); output_float(outfile, "td", shared_networks->available == 0 ? -NAN : (float)(100 * - shared_networks-> - backups) / - shared_networks->available); + shared_networks->backups) + / shared_networks->available); } endrow(outfile); } @@ -814,12 +816,12 @@ int output_html(void) if (outfile == stdout) { ret = fflush(stdout); if (ret) { - warn("output_html: fflush"); + error(0, 0, "output_html: fflush"); } } else { ret = close_stream(outfile); if (ret) { - warn("output_html: fclose"); + error(0, 0, "output_html: fclose"); } } return 0; @@ -836,10 +838,11 @@ int output_csv(void) struct shared_network_t *shared_p; FILE *outfile; int ret; + if (config.output_file[0]) { outfile = fopen(config.output_file, "w+"); if (outfile == NULL) { - err(EXIT_FAILURE, "output_csv: %s", config.output_file); + error(EXIT_FAILURE, errno, "output_csv: %s", config.output_file); } } else { outfile = stdout; @@ -957,12 +960,12 @@ int output_csv(void) if (outfile == stdout) { ret = fflush(stdout); if (ret) { - warn("output_cvs: fflush"); + error(0, 0, "output_cvs: fflush"); } } else { ret = close_stream(outfile); if (ret) { - warn("output_cvs: fclose"); + error(0, 0, "output_cvs: fclose"); } } return 0; @@ -989,7 +992,7 @@ int output_alarming(void) if (config.output_file[0]) { outfile = fopen(config.output_file, "w+"); if (outfile == NULL) { - err(EXIT_FAILURE, "output_alarming: %s", config.output_file); + error(EXIT_FAILURE, errno, "output_alarming: %s", config.output_file); } } else { outfile = stdout; @@ -1077,12 +1080,12 @@ int output_alarming(void) if (outfile == stdout) { ret = fflush(stdout); if (ret) { - warn("output_alarming: fflush"); + error(0, 0, "output_alarming: fflush"); } } else { ret = close_stream(outfile); if (ret) { - warn("output_alarming: fclose"); + error(0, 0, "output_alarming: fclose"); } } return ret_val; diff --git a/src/sort.c b/src/sort.c index b01db91..d0af3cb 100644 --- a/src/sort.c +++ b/src/sort.c @@ -40,15 +40,15 @@ #include -#include -#include #include #include #include -#include "dhcpd-pools.h" +#include "error.h" #include "progname.h" +#include "dhcpd-pools.h" + /*! \brief Compare IP address, with IPv4/v6 determination. * \param a Binary IP address. * \param b Binary IP address. @@ -237,8 +237,7 @@ comparer_t field_selector(char c) return comp_tcperc; default: clean_up(); - warnx("field_selector: unknown sort order `%c'", c); - errx(EXIT_FAILURE, "Try `%s --help' for more information.", program_name); + error(EXIT_FAILURE, 0, "field_selector: unknown sort order `%c'", c); } return NULL; } @@ -289,6 +288,7 @@ void mergesort_ranges(struct range_t *restrict orig, int size, struct range_t *r { int left, right, i; struct range_t hold; + /* Merge sort split size */ static const int MIN_MERGE_SIZE = 8; From c30c122027811fc158c5d5711d0fb9116f75a089 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Mon, 26 Oct 2015 22:43:31 +0000 Subject: [PATCH 042/224] 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 --- src/getdata.c | 5 ++++- src/other.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/getdata.c b/src/getdata.c index 591d743..ce56a2b 100644 --- a/src/getdata.c +++ b/src/getdata.c @@ -178,7 +178,7 @@ void parse_config(int is_include, const char *restrict config_file, char *word; int braces_shared = 1000; union ipaddr_t addr; - struct range_t *range_p; + struct range_t *range_p = NULL; word = xmalloc(sizeof(char) * MAXLEN); if (is_include) @@ -245,6 +245,9 @@ void parse_config(int is_include, const char *restrict config_file, c = ' '; break; } else if (argument == ITS_A_RANGE_SECOND_IP && i == 0) { + if (!range_p) { + error(EXIT_FAILURE, 0, "parse_config: range_p uninitialized: please report a bug"); + } range_p->last_ip = range_p->first_ip; goto newrange; } diff --git a/src/other.c b/src/other.c index 67c2f4d..040c55a 100644 --- a/src/other.c +++ b/src/other.c @@ -380,6 +380,7 @@ double strtod_or_err(const char *restrict str, const char *restrict errmesg) return num; err: error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str); + return 0; } /*! \brief Reverse range. From 2528c4c9d693d16d2b57582e008e3e59e1f537af Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Wed, 25 Nov 2015 21:53:29 +0000 Subject: [PATCH 043/224] 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 Signed-off-by: Sami Kerola --- Makefile.am | 28 ++++++++++++++++++- configure.ac | 4 +-- contrib/.gitignore | 2 ++ contrib/Makemodule.am | 4 ++- .../{dhcpd-pools.cgi => dhcpd-pools.cgi.in} | 4 +-- contrib/nagios.conf | 1 - contrib/nagios.conf.in | 1 + doc/.gitignore | 1 + doc/Makemodule.am | 6 +++- doc/doxy.conf.in | 2 +- man/Makemodule.am | 3 +- man/dhcpd-pools.1.in | 2 +- 12 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 contrib/.gitignore rename contrib/{dhcpd-pools.cgi => dhcpd-pools.cgi.in} (91%) delete mode 100644 contrib/nagios.conf create mode 100644 contrib/nagios.conf.in create mode 100644 doc/.gitignore diff --git a/Makefile.am b/Makefile.am index b2beaca..0daa8bf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,9 +16,35 @@ $(top_srcdir)/.version: dist-hook: echo $(VERSION) > $(distdir)/.tarball-version -CLEANFILES = +PATHFILES = +CLEANFILES = $(PATHFILES) +EXTRA_DIST += $(PATHFILES:=.in) CLEAN_LOCALS = +edit_cmd = sed \ + -e 's|@ALARM_CRIT[@]|$(ALARM_CRIT)|g' \ + -e 's|@ALARM_WARN[@]|$(ALARM_WARN)|g' \ + -e 's|@DHCPDCONF_FILE[@]|$(DHCPDCONF_FILE)|g' \ + -e 's|@DHCPDLEASE_FILE[@]|$(DHCPDLEASE_FILE)|g' \ + -e 's|@OUTPUT_FORMAT[@]|$(OUTPUT_FORMAT)|g' \ + -e 's|@OUTPUT_LIMIT[@]|$(OUTPUT_LIMIT)|g' \ + -e 's|@PACKAGE_BUGREPORT[@]|$(PACKAGE_BUGREPORT)|g' \ + -e 's|@PACKAGE_MAINTAINER[@]|$(PACKAGE_MAINTAINER)|g' \ + -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \ + -e 's|@PACKAGE_URL[@]|$(PACKAGE_URL)|g' \ + -e 's|@SHELL[@]|$(SHELL)|g' \ + -e 's|@VERSION[@]|$(VERSION)|g' \ + -e 's|@bindir[@]|$(bindir)|g' \ + -e 's|@top_srcdir[@]|$(top_srcdir)|g' + +$(PATHFILES): Makefile + @ rm -f $@ $@.tmp + $(AM_V_at) test -d $(dir $@) || mkdir -p $(dir $@) + $(AM_V_GEN) srcdir=''; \ + test -f ./$@.in || srcdir=$(srcdir)/; \ + $(edit_cmd) $${srcdir}$@.in >$@.tmp + @ mv $@.tmp $@ + include contrib/Makemodule.am include doc/Makemodule.am include man/Makemodule.am diff --git a/configure.ac b/configure.ac index cfa9271..ec993c7 100644 --- a/configure.ac +++ b/configure.ac @@ -134,8 +134,7 @@ AM_CONDITIONAL([ENABLE_DOXYGEN], [test "x$enable_doxygen" = "xyes"]) AS_IF([test x$enable_doxygen = xyes], [ AC_CHECK_PROGS([DOXYGEN], [doxygen]) AS_IF([test "x$DOXYGEN" = "x"], - AC_MSG_ERROR([doxygen not in path]), - AC_CONFIG_FILES([doc/doxy.conf]) + AC_MSG_ERROR([doxygen not in path]) ) AC_CHECK_PROGS([DOXYGEN_DOT], [dot]) @@ -149,7 +148,6 @@ AM_CONDITIONAL([HAVE_DOXYGEN_DOT], [test "x$DOXYGEN_DOT" != "x"]) AC_CONFIG_FILES([ Makefile lib/Makefile - man/dhcpd-pools.1 ]) AC_OUTPUT diff --git a/contrib/.gitignore b/contrib/.gitignore new file mode 100644 index 0000000..591c7bd --- /dev/null +++ b/contrib/.gitignore @@ -0,0 +1,2 @@ +/dhcpd-pools.cgi +/nagios.conf diff --git a/contrib/Makemodule.am b/contrib/Makemodule.am index f6aee1f..a6bbc1e 100644 --- a/contrib/Makemodule.am +++ b/contrib/Makemodule.am @@ -1,3 +1,5 @@ contribdir = $(datadir)/dhcpd-pools/ +PATHFILES += contrib/dhcpd-pools.cgi contrib/nagios.conf dist_contrib_SCRIPTS = contrib/dhcpd-pools.cgi contrib/snmptest.pl -EXTRA_DIST += contrib/nagios.conf contrib/munin_plugins +dist_contrib_DATA = contrib/nagios.conf +EXTRA_DIST += contrib/munin_plugins diff --git a/contrib/dhcpd-pools.cgi b/contrib/dhcpd-pools.cgi.in similarity index 91% rename from contrib/dhcpd-pools.cgi rename to contrib/dhcpd-pools.cgi.in index 15a73fb..117a7cf 100755 --- a/contrib/dhcpd-pools.cgi +++ b/contrib/dhcpd-pools.cgi.in @@ -1,4 +1,4 @@ -#!/bin/sh +#!@SHELL@ # # Simple CGI for dhcpd-pools. @@ -26,7 +26,7 @@ echo "

This was situation at " date echo "

" -/usr/local/bin/dhcpd-pools --format html +@bindir@/dhcpd-pools --format html echo "" echo "" diff --git a/contrib/nagios.conf b/contrib/nagios.conf deleted file mode 100644 index 0159fca..0000000 --- a/contrib/nagios.conf +++ /dev/null @@ -1 +0,0 @@ -command[check_dhcpd_pools]=/usr/bin/dhcpd-pools --warning $ARG1$ --critical $ARG2$ diff --git a/contrib/nagios.conf.in b/contrib/nagios.conf.in new file mode 100644 index 0000000..1881c1a --- /dev/null +++ b/contrib/nagios.conf.in @@ -0,0 +1 @@ +command[check_dhcpd_pools]=@bindir@/dhcpd-pools --warning $ARG1$ --critical $ARG2$ diff --git a/doc/.gitignore b/doc/.gitignore new file mode 100644 index 0000000..2063aaa --- /dev/null +++ b/doc/.gitignore @@ -0,0 +1 @@ +/doxy.conf diff --git a/doc/Makemodule.am b/doc/Makemodule.am index 5a5686d..8069c66 100644 --- a/doc/Makemodule.am +++ b/doc/Makemodule.am @@ -1,5 +1,9 @@ +PATHFILES += \ + doc/doxy.conf +nodist_noinst_DATA = \ + doc/doxy.conf + EXTRA_DIST += \ - doc/doxy.conf.in \ doc/introduction.dox if ENABLE_DOXYGEN diff --git a/doc/doxy.conf.in b/doc/doxy.conf.in index 86e2d3b..0427f34 100644 --- a/doc/doxy.conf.in +++ b/doc/doxy.conf.in @@ -32,7 +32,7 @@ PROJECT_NAME = @PACKAGE_NAME@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = @PACKAGE_VERSION@ +PROJECT_NUMBER = @VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer diff --git a/man/Makemodule.am b/man/Makemodule.am index 102705a..75f7eb1 100644 --- a/man/Makemodule.am +++ b/man/Makemodule.am @@ -1,3 +1,2 @@ man_MANS = man/dhcpd-pools.1 -EXTRA_DIST += man/dhcpd-pools.1.in -CLEANFILES += man/dhcpd-pools.1 +PATHFILES += man/dhcpd-pools.1 diff --git a/man/dhcpd-pools.1.in b/man/dhcpd-pools.1.in index a054a5f..fcd2fdb 100644 --- a/man/dhcpd-pools.1.in +++ b/man/dhcpd-pools.1.in @@ -1,4 +1,4 @@ -.TH DHCPD-POOLS "1" "2015-09-04" "@PACKAGE_STRING@" "User Commands" +.TH DHCPD-POOLS "1" "2015-09-04" "@VERSION@" "User Commands" .SH NAME dhcpd-pools \- ISC dhcpd pools usage analysis .SH SYNOPSIS From 99b6af70ef607486cdd1a484a1e144714eeb35e7 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Wed, 25 Nov 2015 22:02:41 +0000 Subject: [PATCH 044/224] update doxygen.conf file Signed-off-by: Sami Kerola --- doc/doxy.conf.in | 2448 ++++++++++++++++++++++++++++------------------ 1 file changed, 1514 insertions(+), 934 deletions(-) diff --git a/doc/doxy.conf.in b/doc/doxy.conf.in index 0427f34..d64080e 100644 --- a/doc/doxy.conf.in +++ b/doc/doxy.conf.in @@ -1,110 +1,129 @@ -# Doxyfile 1.8.2 +# Doxyfile 1.8.10 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # -# All text after a hash (#) is considered a comment and will be ignored. +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. # The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" "). +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 -# The PROJECT_NAME tag is a single word (or sequence of words) that should -# identify the project. Note that if you do not use Doxywizard you need -# to put quotes around the project name if it contains spaces. +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. PROJECT_NAME = @PACKAGE_NAME@ -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. PROJECT_NUMBER = @VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer -# a quick idea about the purpose of the project. Keep the description short. +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = "ISC dhcpd lease usage analyser" -# With the PROJECT_LOGO tag one can specify an logo or icon that is -# included in the documentation. The maximum height of the logo should not -# exceed 55 pixels and the maximum width should not exceed 200 pixels. -# Doxygen will copy the logo to the output directory. +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. PROJECT_LOGO = -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. OUTPUT_DIRECTORY = @top_srcdir@/doc -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. CREATE_SUBDIRS = NO +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. OUTPUT_LANGUAGE = English -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. BRIEF_MEMBER_DESC = YES -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. +# The default value is: YES. REPEAT_BRIEF = YES -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief +# doxygen will generate a detailed section even if there is only a brief # description. +# The default value is: NO. ALWAYS_DETAILED_SEC = NO @@ -112,242 +131,276 @@ ALWAYS_DETAILED_SEC = NO # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. +# The default value is: NO. INLINE_INHERITED_MEMB = NO -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. FULL_PATH_NAMES = YES -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. Note that you specify absolute paths here, but also -# relative paths, which will be relative from the directory where doxygen is -# started. +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. STRIP_FROM_PATH = src -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. STRIP_FROM_INC_PATH = -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful if your file system -# doesn't support long names like on DOS, Mac, or CD-ROM. +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. SHORT_NAMES = NO -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. JAVADOC_AUTOBRIEF = YES -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. QT_AUTOBRIEF = YES -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. MULTILINE_CPP_IS_BRIEF = NO -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. INHERIT_DOCS = YES -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. SEPARATE_MEMBER_PAGES = NO -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. TAB_SIZE = 4 -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. ALIASES = # This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding -# "class=itcl::class" will allow you to use the command class in the -# itcl::class meaning. +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. TCL_SUBST = -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. OPTIMIZE_OUTPUT_FOR_C = NO -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, -# and language is one of the parsers supported by doxygen: IDL, Java, -# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, -# C++. For instance to make doxygen treat .inc files as Fortran files (default -# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note -# that for custom extensions you also need to set FILE_PATTERNS otherwise the -# files are not read by doxygen. +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. EXTENSION_MAPPING = -# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all -# comments according to the Markdown format, which allows for more readable +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you -# can mix doxygen, HTML, and XML commands with Markdown formatting. -# Disable only in case of backward compatibilities issues. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. MARKDOWN_SUPPORT = YES -# When enabled doxygen tries to link words that correspond to documented classes, -# or namespaces to their corresponding documentation. Such a link can be -# prevented in individual cases by by putting a % sign in front of the word or +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. AUTOLINK_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also makes the inheritance and collaboration +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. +# The default value is: NO. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. +# The default value is: NO. CPP_CLI_SUPPORT = NO -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. SIP_SUPPORT = NO -# For Microsoft's IDL there are propget and propput attributes to indicate getter and setter methods for a property. Setting this option to YES (the default) will make doxygen replace the get and set methods by a property in the documentation. This will only work if the methods are indeed getting or setting a simple type. If this is not the case, or you want to show the methods anyway, you should set this option to NO. +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first +# tag is set to YES then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. +# The default value is: NO. DISTRIBUTE_GROUP_DOC = NO -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. SUBGROUPING = YES -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and -# unions are shown inside the group in which they are included (e.g. using -# @ingroup) instead of on a separate page (for HTML and Man pages) or -# section (for LaTeX and RTF). +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. INLINE_GROUPED_CLASSES = NO -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and -# unions with only public data fields will be shown inline in the documentation -# of the scope in which they are defined (i.e. file, namespace, or group -# documentation), provided this scope is documented. If set to NO (the default), -# structs, classes, and unions are shown on a separate page (for HTML and Man -# pages) or section (for LaTeX and RTF). +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. INLINE_SIMPLE_STRUCTS = NO -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. TYPEDEF_HIDES_STRUCT = NO -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penalty. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will roughly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols. - -SYMBOL_CACHE_SIZE = 0 - -# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be -# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given -# their name and scope. Since this can be an expensive process and often the -# same symbol appear multiple times in the code, doxygen keeps a cache of -# pre-resolved symbols. If the cache is too small doxygen will become slower. -# If the cache is too large, memory is wasted. The cache size is given by this -# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols. +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. LOOKUP_CACHE_SIZE = 0 @@ -355,357 +408,421 @@ LOOKUP_CACHE_SIZE = 0 # Build related configuration options #--------------------------------------------------------------------------- -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. EXTRACT_ALL = YES -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. EXTRACT_PRIVATE = NO -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. +# The default value is: NO. EXTRACT_PACKAGE = NO -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. EXTRACT_STATIC = YES -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. EXTRACT_LOCAL_CLASSES = YES -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespaces are hidden. +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. EXTRACT_ANON_NSPACES = NO -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. HIDE_UNDOC_MEMBERS = NO -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. HIDE_UNDOC_CLASSES = NO -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. HIDE_IN_BODY_DOCS = NO -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. INTERNAL_DOCS = YES -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. +# The default value is: system dependent. CASE_SENSE_NAMES = YES -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. HIDE_SCOPE_NAMES = NO -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. SHOW_INCLUDE_FILES = YES -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. FORCE_LOCAL_INCLUDES = NO -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. INLINE_INFO = YES -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. SORT_MEMBER_DOCS = YES -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. SORT_BRIEF_DOCS = NO -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. SORT_MEMBERS_CTORS_1ST = NO -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. SORT_GROUP_NAMES = NO -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. SORT_BY_SCOPE_NAME = NO -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to -# do proper type resolution of all parameters of a function it will reject a -# match between the prototype and the implementation of a member function even -# if there is only one candidate or it is obvious which candidate to choose -# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen -# will still accept a match between prototype and implementation in such cases. +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. STRICT_PROTO_MATCHING = NO -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. GENERATE_TODOLIST = YES -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. GENERATE_TESTLIST = YES -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. GENERATE_BUGLIST = YES -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. GENERATE_DEPRECATEDLIST= YES -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. ENABLED_SECTIONS = -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or macro consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and macros in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. MAX_INITIALIZER_LINES = 30 -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the # list will mention the files that were used to generate the documentation. +# The default value is: YES. SHOW_USED_FILES = YES -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. SHOW_FILES = YES -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. -# This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. LAYOUT_FILE = -# The CITE_BIB_FILES tag can be used to specify one or more bib files -# containing the references data. This must be a list of .bib files. The -# .bib extension is automatically appended if omitted. Using this command -# requires the bibtex tool to be installed. See also -# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style -# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this -# feature you need bibtex and perl available in the search path. +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. CITE_BIB_FILES = #--------------------------------------------------------------------------- -# configuration options related to warning and progress messages +# Configuration options related to warning and progress messages #--------------------------------------------------------------------------- -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. WARNINGS = YES -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. WARN_IF_UNDOCUMENTED = YES -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. WARN_IF_DOC_ERROR = YES -# The WARN_NO_PARAMDOC option can be enabled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. +# The default value is: NO. WARN_NO_PARAMDOC = NO -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text" -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). WARN_LOGFILE = #--------------------------------------------------------------------------- -# configuration options related to the input files +# Configuration options related to the input files #--------------------------------------------------------------------------- -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. INPUT = @top_srcdir@ # This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh -# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py -# *.f90 *.f *.for *.vhd *.vhdl +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, +# *.vhdl, *.ucf, *.qsf, *.as and *.js. -FILE_PATTERNS = *.c *.h *.dox +FILE_PATTERNS = *.c \ + *.h \ + *.dox -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. +# # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = build-aux contrib +EXCLUDE = build-aux \ + contrib # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. +# The default value is: NO. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* EXCLUDE_PATTERNS = @@ -714,765 +831,1115 @@ EXCLUDE_PATTERNS = # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* EXCLUDE_SYMBOLS = -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. EXAMPLE_RECURSIVE = NO -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. -# If FILTER_PATTERNS is specified, this tag will be -# ignored. +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. -# Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. -# The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty or if -# non of the patterns match the file name, INPUT_FILTER is applied. +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) -# and it is also possible to disable source filtering for a specific pattern -# using *.ext= (so without naming a filter). This option only has effect when -# FILTER_SOURCE_FILES is enabled. +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. -FILTER_SOURCE_PATTERNS = *.c *.h +FILTER_SOURCE_PATTERNS = *.c \ + *.h + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- -# configuration options related to source browsing +# Configuration options related to source browsing #--------------------------------------------------------------------------- -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. SOURCE_BROWSER = NO -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. INLINE_SOURCES = NO -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C, C++ and Fortran comments will always remain visible. +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. STRIP_CODE_COMMENTS = YES -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. REFERENCED_BY_RELATION = YES -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. REFERENCES_RELATION = NO -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. -# Otherwise they will link to the documentation. +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. REFERENCES_LINK_SOURCE = YES -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. USE_HTAGS = NO -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index +# Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. ALPHABETICAL_INDEX = YES -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. COLS_IN_ALPHA_INDEX = 5 -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = #--------------------------------------------------------------------------- -# configuration options related to the HTML output +# Configuration options related to the HTML output #--------------------------------------------------------------------------- -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. GENERATE_HTML = YES -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_OUTPUT = html -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_FILE_EXTENSION = .html -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. Note that when using a custom header you are responsible -# for the proper inclusion of any scripts and style sheets that doxygen -# needs, which is dependent on the configuration options used. -# It is advised to generate a default header using "doxygen -w html -# header.html footer.html stylesheet.css YourConfigFile" and then modify -# that header. Note that the header is subject to change so you typically -# have to redo this when upgrading to a newer version of doxygen or when -# changing the value of configuration settings such as GENERATE_TREEVIEW! +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_HEADER = -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_FOOTER = -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If left blank doxygen will -# generate a default style sheet. Note that it is recommended to use -# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this -# tag will in the future become obsolete. +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_STYLESHEET = -# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional -# user-defined cascading style sheet that is included after the standard -# style sheets created by doxygen. Using this option one can overrule -# certain style aspects. This is preferred over using HTML_STYLESHEET -# since it does not replace the standard style sheet and is therefor more -# robust against future updates. Doxygen will copy the style sheet file to -# the output directory. +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the -# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that -# the files will be copied as-is; there are no commands or markers available. +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_FILES = -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the style sheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_HUE = 220 -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_SAT = 100 -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_TIMESTAMP = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_DYNAMIC_SECTIONS = NO -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of -# entries shown in the various tree structured indices initially; the user -# can expand and collapse entries dynamically later on. Doxygen will expand -# the tree to such a level that at most the specified number of entries are -# visible (unless a fully collapsed tree already exceeds this amount). -# So setting the number of entries 1 will produce a full collapsed tree by -# default. 0 is a special value representing an infinite number of entries -# and will result in a full expanded tree by default. +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_INDEX_NUM_ENTRIES = 100 -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_DOCSET = NO -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_FEEDNAME = "Doxygen generated docs" -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_BUNDLE_ID = org.doxygen.Project -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely -# identify the documentation publisher. This should be a reverse domain-name -# style string, e.g. com.mycompany.MyDocSet.documentation. +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_ID = org.doxygen.Publisher -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_NAME = Publisher -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_HTMLHELP = NO -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be # written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_FILE = -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. HHC_LOCATION = -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. GENERATE_CHI = NO -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_INDEX_ENCODING = -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. BINARY_TOC = NO -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_QHP = NO -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. QCH_FILE = -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. QHP_NAMESPACE = org.doxygen.Project -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. QHP_VIRTUAL_FOLDER = doc -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# -# Qt Help Project / Custom Filters. +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# -# Qt Help Project / Filter Attributes. +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_ECLIPSEHELP = NO -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. ECLIPSE_DOC_ID = org.doxygen.Project -# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) -# at top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. Since the tabs have the same information as the -# navigation tree you can set this option to NO if you already set -# GENERATE_TREEVIEW to YES. +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. -# Since the tree basically has the same information as the tab index you -# could consider to set DISABLE_INDEX to NO when enabling this option. +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = NO -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values -# (range [0,1..20]) that doxygen will group on one line in the generated HTML -# documentation. Note that a value of 0 will completely suppress the enum -# values from appearing in the overview section. +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. ENUM_VALUES_PER_LINE = 4 -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. TREEVIEW_WIDTH = 250 -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. EXT_LINKS_IN_WINDOW = NO -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_TRANSPARENT = YES -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the -# rendering instead of using prerendered bitmaps. Use this if you do not -# have LaTeX installed or if you want to formulas look prettier in the HTML -# output. When enabled you may also need to install MathJax separately and -# configure the path to it using the MATHJAX_RELPATH option. +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. USE_MATHJAX = NO -# When MathJax is enabled you need to specify the location relative to the -# HTML output directory using the MATHJAX_RELPATH option. The destination -# directory should contain the MathJax.js script. For instance, if the mathjax -# directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to -# the MathJax Content Delivery Network so you can quickly see the result without -# installing MathJax. -# However, it is strongly recommended to install a local -# copy of MathJax from http://www.mathjax.org before deployment. +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest -# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension -# names that should be enabled during MathJax rendering. +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /