Compare commits

...

14 commits
v3.2 ... master

Author SHA1 Message Date
Sami Kerola
1722d54103
chore: update web pages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2025-04-28 15:32:04 +01:00
Sami Kerola
1c413b0653
release: 3.3
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2025-04-28 14:36:52 +01:00
Sami Kerola
d020e4d09f
output: update html javascripts
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2025-04-28 14:33:35 +01:00
Sami Kerola
f917d5b223
build-sys: update bootstrap from gnulib
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2025-04-28 14:33:26 +01:00
Sami Kerola
5b7ab28314
build-sys: quote subshell execution in the autotools file
Ryan discovered a typo/issue while handling the man targets.  This change
fixes the issue.

Reported-by: Ryan Steinmetz <zi@freebsd.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2025-04-28 14:22:56 +01:00
Belkacem Daheb
dc649e27cd
getdata output: add start, end and hostname printing support for xml and json
Ensure strings are always null terminated.
2024-08-09 12:51:20 +01:00
luisδμ
7fc13c60e0
fix: avoid generation of unvalid JSON in summary
This can happen when there are no available shared networks.  A division by
zero throws 'nan', which is non JSON-valid unless it's surrounded by double
quotes.
2024-08-09 12:30:49 +01:00
Sami Kerola
5ed6e7688f
gnulib: update bootstrap and gitignore files
And it turns out mustach.c will not compile without config.h being
explicitly included before other headers, so let me do that.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2024-08-09 12:06:22 +01:00
M. van Brummelen
9c6336e5b6
docs: fix manual page groff warning
The only thing the change does is the way the manpage gets parsed, and fixes
follwing warning.

"W: dhcpd-pools: groff-message an.tmac:<standard input>:147: warning: tbl
preprocessor failed, or it or soelim was not run; table(s) likely not
rendered (TE macro called with TW register undefined)
[usr/share/man/man1/dhcpd-pools.1.gz:1]"

Reference: https://www.mail-archive.com/debian-devel@lists.debian.org/msg377263.html
Signed-off-by: M. van Brummelen <mvb@debian.org>
Reviewed-by: Sami Kerola <kerolasa@iki.fi>
2024-08-09 11:00:02 +01:00
Sami Kerola
d94654e100
getdata: only emit warning when config include file cannot be read
Not being able to open primary config file will cause fatal error, where as
include files will only warn.  This is useful for setups that want to
publish some of the dhcp lease data, but not all.  Such setup obviously
required dhcpd server to have differnt account than dhcpd-pools, with
carefully managed read permissions.

Requested-by: Björn Lässig <b.laessig@pengutronix.de>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2024-01-28 16:07:56 +00:00
Sami Kerola
dc1f0b9b76
chore: update web links
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2023-09-02 11:55:16 +01:00
Belkacem Daheb
3d37ac0a2d
add start, end and hostname printing support for xml and json
In short it gets these parameters and prints them in json and xml formats.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2023-08-15 22:17:38 +01:00
Sami Kerola
102d017ed5
website: use https
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2023-03-26 11:15:36 +01:00
Sami Kerola
501bc15b43
update project web page
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2022-11-26 10:00:53 +00:00
27 changed files with 2080 additions and 1392 deletions

View file

@ -39,7 +39,7 @@ edit_cmd = sed \
$(PATHFILES): Makefile
@ rm -f $@ $@.tmp
$(AM_V_at) mkdir -p $(dir $@)
$(AM_V_at) mkdir -p $$(dirname $@)
$(AM_V_GEN) srcdir=''; \
test -f ./$@.in || srcdir=$(srcdir)/; \
$(edit_cmd) $${srcdir}$@.in >$@.tmp

22
NEWS
View file

@ -7,6 +7,28 @@ Please send dhcpd-pools bug reports to kerolasa@iki.fi.
gpg: Signature is crated using RSA key ID 8ED396E37E38D471A00530D3A9553245FDE9B739.
Version 3.3
Belkacem Daheb (2):
add start, end and hostname printing support for xml and json
getdata output: add start, end and hostname printing support for xml and json
M. van Brummelen (1):
docs: fix manual page groff warning
Sami Kerola (9):
update project web page
website: use https
chore: update web links
getdata: only emit warning when config include file cannot be read
gnulib: update bootstrap and gitignore files
build-sys: quote subshell execution in the autotools file
build-sys: update bootstrap from gnulib
output: update html javascripts
release: 3.3
luisδμ (1):
fix: avoid generation of unvalid JSON in summary
Version 3.2
Jean Benoit (1):

4
README
View file

@ -28,7 +28,7 @@ Quick start.
Dependencies to other projects.
http://www.gnu.org/software/gnulib/
https://www.gnu.org/software/gnulib/
You can avoid repeated gnulib downloads by setting
GNULIB_SRCDIR environment variable. For example:
@ -39,7 +39,7 @@ Dependencies to other projects.
Assumign detached gnulib please remember to git pull the
latest updates before building dhcpd-pools.
http://uthash.sourceforge.net/
https://troydhanson.github.io/uthash/
See quick start.

3
THANKS
View file

@ -49,3 +49,6 @@ Mark Sangster
Brent Swingle
Mathieu Morier
Jean Benoit
Belkacem Daheb
Björn Lässig
Luisδμ

1991
bootstrap

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
# Bootstrap configuration.
# Bootstrap configuration. -*- sh -*-
# Copyright (C) 2006-2022 Free Software Foundation, Inc.
# Copyright (C) 2006-2025 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

View file

@ -6,7 +6,7 @@ AC_CONFIG_MACRO_DIRS([m4])
AC_INIT([dhcpd-pools],
[m4_esyscmd([build-aux/git-version-gen .tarball-version])],
[kerolasa@iki.fi],[],
[http://dhcpd-pools.sourceforge.net/])
[https://dhcpd-pools.sourceforge.net/])
PACKAGE_MAINTAINER="Sami Kerola"
AC_SUBST([PACKAGE_MAINTAINER])
AC_CONFIG_AUX_DIR([build-aux])

View file

@ -7,7 +7,7 @@ pkgver=0
pkgrel=1
pkgdesc="ISC dhcpd lease status utility"
arch=('i686' 'x86_64')
url=http://dhcpd-pools.sourceforge.net/
url=https://dhcpd-pools.sourceforge.net/
license=('BSD')
depends=('pacman')
makedepends=('uthash' 'git')

102
lib/.gitignore vendored
View file

@ -1,11 +1,15 @@
/alloca.h
/alloca.in.h
/arg-nonnull.h
/arpa/inet.h
/arpa/
/arpa_inet.c
/arpa_inet.in.h
/assert.in.h
/attribute.h
/basename-lgpl.c
/basename-lgpl.h
/c32is-impl.h
/c32isprint.c
/calloc.c
/c-ctype.c
/c-ctype.h
@ -22,13 +26,11 @@
/c-strcaseeq.h
/c-strcase.h
/c-strncasecmp.c
/dirname.h
/dirname-lgpl.c
/dosname.h
/dup2.c
/errno.in.h
/error.c
/error.h
/error.in.h
/exitfail.c
/exitfail.h
/fclose.c
@ -43,6 +45,7 @@
/flexmember.h
/float.c
/float+.h
/float.h
/float.in.h
/fopen.c
/fpending.c
@ -57,6 +60,8 @@
/ftell.c
/ftello.c
/getdtablesize.c
/getlocalename_l-unsafe.c
/getlocalename_l-unsafe.h
/getopt1.c
/getopt.c
/getopt-cdefs.in.h
@ -69,8 +74,6 @@
/getprogname.c
/getprogname.h
/gettext.h
/.gitignore~
/glthread/*
/hard-locale.c
/hard-locale.h
/ialloc.c
@ -78,6 +81,7 @@
/idx.h
/inet_pton.c
/intprops.h
/intprops-internal.h
/inttypes.h
/inttypes.in.h
/isnan.c
@ -89,16 +93,60 @@
/lc-charset-dispatch.h
/libc-config.h
/libdhcpd_pools.la
/libdhcpd_pools_la-arpa_inet.lo
/libdhcpd_pools_la-basename-lgpl.lo
/libdhcpd_pools_la-c32isprint.lo
/libdhcpd_pools_la-c-ctype.lo
/libdhcpd_pools_la-cloexec.lo
/libdhcpd_pools_la-closeout.lo
/libdhcpd_pools_la-close-stream.lo
/libdhcpd_pools_la-c-strcasecmp.lo
/libdhcpd_pools_la-exitfail.lo
/libdhcpd_pools_la-fclose.lo
/libdhcpd_pools_la-fcntl.lo
/libdhcpd_pools_la-fd-hook.lo
/libdhcpd_pools_la-fflush.lo
/libdhcpd_pools_la-float.lo
/libdhcpd_pools_la-fopen.lo
/libdhcpd_pools_la-fpurge.lo
/libdhcpd_pools_la-freading.lo
/libdhcpd_pools_la-fseek.lo
/libdhcpd_pools_la-fseeko.lo
/libdhcpd_pools_la-getprogname.lo
/libdhcpd_pools_la-hard-locale.lo
/libdhcpd_pools_la-ialloc.lo
/libdhcpd_pools_la-localcharset.lo
/libdhcpd_pools_la-malloca.lo
/libdhcpd_pools_la-math.lo
/libdhcpd_pools_la-mbrtoc32.lo
/libdhcpd_pools_la-mbrtowc.lo
/libdhcpd_pools_la-mbszero.lo
/libdhcpd_pools_la-mktime.lo
/libdhcpd_pools_la-nstrftime.lo
/libdhcpd_pools_la-progname.lo
/libdhcpd_pools_la-quotearg.lo
/libdhcpd_pools_la-reallocarray.lo
/libdhcpd_pools_la-realloc.lo
/libdhcpd_pools_la-setlocale_null.lo
/libdhcpd_pools_la-setlocale_null-unlocked.lo
/libdhcpd_pools_la-stat-time.lo
/libdhcpd_pools_la-stdlib.lo
/libdhcpd_pools_la-sys_socket.lo
/libdhcpd_pools_la-timegm.lo
/libdhcpd_pools_la-time_rz.lo
/libdhcpd_pools_la-unistd.lo
/libdhcpd_pools_la-wctype-h.lo
/libdhcpd_pools_la-xalloc-die.lo
/libdhcpd_pools_la-xmalloc.lo
/.libs/
/limits.h
/limits.in.h
/*.lo
/localcharset.c
/localcharset.h
/locale.h
/locale.in.h
/localtime-buffer.c
/localtime-buffer.h
/localename.h
/localename-unsafe.c
/lseek.c
/Makefile.am
/malloca.c
@ -107,10 +155,12 @@
/math.c
/math.h
/math.in.h
/mbrtoc32.c
/mbrtowc.c
/mbrtowc-impl.h
/mbrtowc-impl-utf8.h
/mbsinit.c
/mbszero.c
/mbtowc-lock.c
/mbtowc-lock.h
/memchr.c
@ -138,13 +188,15 @@
/setlocale-lock.c
/setlocale_null.c
/setlocale_null.h
/setlocale_null-unlocked.c
/stat.c
/stat-time.c
/stat-time.h
/stat-w32.c
/stat-w32.h
/stdalign.in.h
/stdbool.in.h
/stdckdint.h
/stdckdint.in.h
/stddef.h
/stddef.in.h
/stdint.in.h
/stdio.h
@ -152,6 +204,7 @@
/stdio.in.h
/stdio-read.c
/stdio-write.c
/stdlib.c
/stdlib.h
/stdlib.in.h
/stpncpy.c
@ -160,21 +213,18 @@
/strerror.c
/strerror-override.c
/strerror-override.h
/strftime.c
/strftime.h
/string.h
/string.in.h
/stripslash.c
/strstr.c
/strtod.c
/str-two-way.h
/sys/
/sys_socket.c
/sys/socket.h
/sys_socket.in.h
/sys/stat.h
/sys_stat.in.h
/sys/types.h
/sys_types.in.h
/sys/uio.h
/sys_uio.in.h
/timegm.c
/time.h
@ -183,11 +233,21 @@
/time_r.c
/time_rz.c
/tzset.c
/uchar.h
/uchar.in.h
/unictype/
/unictype/bitmap.h
/unictype/ctype_print.c
/unictype/ctype_print.h
/unictype/.gitignore
/unictype.h
/unictype.in.h
/unistd.c
/unistd.h
/unistd.in.h
/unitypes.h
/unitypes.in.h
/unsetenv.c
/unused-parameter.h
/verify.h
/warn-on-use.h
/wchar.h
@ -196,14 +256,6 @@
/wctype-h.c
/wctype.in.h
/windows-initguard.h
/windows-mutex.c
/windows-mutex.h
/windows-once.c
/windows-once.h
/windows-recmutex.c
/windows-recmutex.h
/windows-rwlock.c
/windows-rwlock.h
/xalloc-die.c
/xalloc.h
/xalloc-oversized.h

View file

@ -1,4 +1,5 @@
.TH DHCPD-POOLS "1" "2017-11-15" "@VERSION@" "User Commands"
'\" t
.TH DHCPD-POOLS "1" "2024-08-09" "@VERSION@" "User Commands"
.SH NAME
dhcpd-pools \- ISC dhcpd pools usage analysis
.SH SYNOPSIS

View file

@ -3,9 +3,9 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/">
<Project rdf:about="http://dhcpd-pools.sourceforge.net/">
<Project rdf:about="https://dhcpd-pools.sourceforge.net/">
<name>dhcpd-pools</name>
<homepage rdf:resource="http://dhcpd-pools.sourceforge.net/" />
<homepage rdf:resource="https://dhcpd-pools.sourceforge.net/" />
<shortdesc>This is dhcpd-pools ISC dhcp shared network and pool
range usage analysis tool.</shortdesc>
<description>Purpose of command is to count usage ratio of each

View file

@ -102,6 +102,9 @@ enum prefix_t {
PREFIX_BINDING_STATE_ACTIVE,
PREFIX_BINDING_STATE_BACKUP,
PREFIX_HARDWARE_ETHERNET,
PREFIX_STARTS,
PREFIX_ENDS,
PREFIX_HOSTNAME,
NUM_OF_PREFIX
};
@ -180,6 +183,9 @@ struct leases_t {
char *ethernet;
UT_hash_handle hh;
enum ltype type;
char *ends;
char *starts;
char *hostname;
};
/*! \enum limbits

View file

@ -83,7 +83,7 @@ enum isc_conf_parser {
int parse_leases(struct conf_t *state)
{
FILE *dhcpd_leases;
char *line, *ipstring, macstring[20], *stop;
char *line, *ipstring, macstring[20], *stop, endsstr[30], startsstr[30], hostnamestr[MAXLEN];
union ipaddr_t addr;
struct leases_t *lease;
@ -100,6 +100,9 @@ int parse_leases(struct conf_t *state)
line[0] = '\0';
ipstring = xmalloc(sizeof(char) * MAXLEN);
ipstring[0] = '\0';
endsstr[0] = '\0';
startsstr[0] = '\0';
hostnamestr[0] = '\0';
while (!feof(dhcpd_leases)) {
if (!fgets(line, MAXLEN, dhcpd_leases) && ferror(dhcpd_leases))
error(EXIT_FAILURE, errno, "parse_leases: %s", state->dhcpdlease_file);
@ -142,8 +145,35 @@ int parse_leases(struct conf_t *state)
break;
memcpy(macstring, line + 20, 17);
macstring[17] = '\0';
if ((lease = find_lease(state, &addr)) != NULL)
if ((lease = find_lease(state, &addr)) != NULL) {
lease->ethernet = xstrdup(macstring);
lease->starts = xstrdup(startsstr);
startsstr[0] = '\0';
lease->ends = xstrdup(endsstr);
endsstr[0] = '\0';
}
break;
case PREFIX_ENDS:
if (state->print_mac_addreses == 0)
break;
strncpy(endsstr, line + 7, sizeof(endsstr)-1);
endsstr[strlen(endsstr)-2] = '\0';
break;
case PREFIX_STARTS:
if (state->print_mac_addreses == 0)
break;
strncpy(startsstr, line + 9, sizeof(startsstr)-1);
startsstr[strlen(startsstr)-2] = '\0';
break;
case PREFIX_HOSTNAME:
if (state->print_mac_addreses == 0)
break;
strncpy(hostnamestr, line + 19, sizeof(hostnamestr)-1);
hostnamestr[strlen(hostnamestr)-3] = '\0';
if ((lease = find_lease(state, &addr)) != NULL) {
lease->hostname = xstrdup(hostnamestr);
}
hostnamestr[0] = '\0';
break;
default:
/* do nothing */ ;
@ -211,8 +241,14 @@ void parse_config(struct conf_t *state, const int is_include, const char *restri
shared_p->name = state->shared_net_root->name;
/* Open configuration file */
dhcpd_config = fopen(config_file, "r");
if (dhcpd_config == NULL)
if (dhcpd_config == NULL) {
if (is_include) {
error(0, errno, "cannot open inlude: %s", config_file);
return;
}
/* config if from command line, just exit with error */
error(EXIT_FAILURE, errno, "parse_config: %s", config_file);
}
#ifdef HAVE_POSIX_FADVISE
# ifdef POSIX_FADV_SEQUENTIAL
if (posix_fadvise(fileno(dhcpd_config), 0, 0, POSIX_FADV_SEQUENTIAL) != 0)

View file

@ -66,6 +66,9 @@ void add_lease_v4(struct conf_t *state, union ipaddr_t *addr, enum ltype type)
l->type = type;
HASH_ADD_INT(state->leases, ip.v4, l);
l->ethernet = NULL;
l->ends = NULL;
l->starts = NULL;
l->hostname = NULL;
}
void add_lease_v6(struct conf_t *state, union ipaddr_t *addr, enum ltype type)
@ -77,6 +80,9 @@ void add_lease_v6(struct conf_t *state, union ipaddr_t *addr, enum ltype type)
l->type = type;
HASH_ADD_V6(state->leases, ip.v6, l);
l->ethernet = NULL;
l->ends = NULL;
l->starts = NULL;
l->hostname = NULL;
}
/*! \brief Find pointer to lease from hash array.
@ -110,6 +116,9 @@ struct leases_t *find_lease_v6(struct conf_t *state, union ipaddr_t *addr)
void delete_lease(struct conf_t *state, struct leases_t *lease)
{
free(lease->ethernet);
free(lease->ends);
free(lease->starts);
free(lease->hostname);
HASH_DEL(state->leases, lease);
free(lease);
}
@ -122,6 +131,9 @@ void delete_all_leases(struct conf_t *state)
HASH_ITER(hh, state->leases, l, tmp) {
free(l->ethernet);
free(l->ends);
free(l->starts);
free(l->hostname);
HASH_DEL(state->leases, l);
free(l);
}
@ -134,6 +146,9 @@ void delete_all_leases(struct conf_t *state)
l = state->leases;
free(l->ethernet);
free(l->ends);
free(l->starts);
free(l->hostname);
HASH_DEL(state->leases, l); /* leases advances to next on delete */
free(l);
}

View file

@ -8,7 +8,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@ -19,6 +19,8 @@
#define _GNU_SOURCE
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

View file

@ -8,7 +8,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,

View file

@ -417,6 +417,12 @@ int
}
if (!memcmp("lease ", str, 6))
return PREFIX_LEASE;
else if (!memcmp(" starts ", str, 9))
return PREFIX_STARTS;
else if (!memcmp(" ends ", str, 7))
return PREFIX_ENDS;
else if (!memcmp(" client-hostname ", str, 18))
return PREFIX_HOSTNAME;
return NUM_OF_PREFIX;
}
@ -472,6 +478,12 @@ int
}
if (!memcmp(" iaaddr ", str, 9))
return PREFIX_LEASE;
else if (!memcmp(" starts ", str, 9))
return PREFIX_STARTS;
else if (!memcmp(" ends ", str, 7))
return PREFIX_ENDS;
else if (!memcmp(" client-hostname ", str, 18))
return PREFIX_HOSTNAME;
return NUM_OF_PREFIX;
}

View file

@ -387,7 +387,19 @@ static int output_xml(struct conf_t *state)
if (l->ethernet != NULL) {
fputs(l->ethernet, outfile);
}
fputs("</macaddress>\n</active_lease>\n", outfile);
fputs("</macaddress>\n\t<starts>", outfile);
if (l->starts != NULL) {
fputs(l->starts, outfile);
}
fputs("</starts>\n\t<ends>", outfile);
if (l->ends != NULL) {
fputs(l->ends, outfile);
}
fputs("</ends>\n\t<hostname>", outfile);
if (l->hostname != NULL) {
fputs(l->hostname, outfile);
}
fputs("</hostname>\n</active_lease>\n", outfile);
}
}
}
@ -481,6 +493,18 @@ static int output_json(struct conf_t *state)
if (l->ethernet != NULL) {
fputs(l->ethernet, outfile);
}
fputs("\", \"starts\":\"", outfile);
if (l->starts != NULL) {
fputs(l->starts, outfile);
}
fputs("\", \"ends\":\"", outfile);
if (l->ends != NULL) {
fputs(l->ends, outfile);
}
fputs("\", \"hostname\":\"", outfile);
if (l->hostname != NULL) {
fputs(l->hostname, outfile);
}
fputs("\" }", outfile);
}
}
@ -587,9 +611,15 @@ static int output_json(struct conf_t *state)
fprintf(outfile, " \"touched\":%g,\n", state->shared_net_root->touched);
fprintf(outfile, " \"free\":%g,\n",
state->shared_net_root->available - state->shared_net_root->used);
fprintf(outfile, " \"percent\":%g,\n", oh.percent);
if (fpclassify(state->shared_net_root->available) == FP_ZERO)
fprintf(outfile, " \"percent\":\"%g\",\n", oh.percent);
else
fprintf(outfile, " \"percent\":%g,\n", oh.percent);
fprintf(outfile, " \"touch_count\":%g,\n", oh.tc);
fprintf(outfile, " \"touch_percent\":%g,\n", oh.tcp);
if (fpclassify(state->shared_net_root->available) == FP_ZERO)
fprintf(outfile, " \"touch_percent\":\"%g\",\n", oh.tcp);
else
fprintf(outfile, " \"touch_percent\":%g,\n", oh.tcp);
if (state->backups_found == 1) {
fprintf(outfile, " \"backup_count\":%g,\n",
state->shared_net_root->backups);
@ -628,8 +658,8 @@ static void html_header(struct conf_t *state, FILE *restrict f)
fprintf(f, "<meta charset=\"utf-8\">\n");
fprintf(f, "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n");
fprintf(f, "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n");
fprintf(f, "<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css\" type=\"text/css\">\n");
fprintf(f, "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css\">\n");
fprintf(f, "<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css\" type=\"text/css\">\n");
fprintf(f, "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.datatables.net/v/dt/dt-2.2.2/datatables.min.css\">\n");
fprintf(f, "<style type=\"text/css\">\n");
fprintf(f, "table.dhcpd-pools th { text-transform: capitalize }\n");
fprintf(f, "</style>\n");
@ -652,8 +682,8 @@ static void html_footer(FILE *restrict f)
fprintf(f, "<small>Generated using %s<br />\n", PACKAGE_STRING);
fprintf(f, "More info at <a href=\"%s\">%s</a>\n", PACKAGE_URL, PACKAGE_URL);
fprintf(f, "</small></div></div>\n");
fprintf(f, "<script src=\"https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js\" type=\"text/javascript\"></script>\n");
fprintf(f, "<script type=\"text/javascript\" src=\"https://cdn.datatables.net/v/bs/jq-3.2.1/dt-1.10.16/datatables.min.js\"></script>\n");
fprintf(f, "<script src=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js\" type=\"text/javascript\"></script>\n");
fprintf(f, "<script type=\"text/javascript\" src=\"https://cdn.datatables.net/v/dt/dt-2.2.2/datatables.min.js\"></script>\n");
fprintf(f, "<script type=\"text/javascript\" class=\"init\">$(document).ready(function() { $('#s').DataTable({ \"iDisplayLength\": 50, \"lengthMenu\": [ [25, 50, 100, -1], [25, 50, 100, \"All\"] ], \"order\": [[ 4, \"desc\" ]] } ); } );</script>\n");
fprintf(f, "<script type=\"text/javascript\" class=\"init\">$(document).ready(function() { $('#r').DataTable({ \"iDisplayLength\": 100, \"lengthMenu\": [ [25, 50, 100, -1], [25, 50, 100, \"All\"] ], \"order\": [[ 6, \"desc\" ]] } ); } );</script>\n");
fprintf(f, "</body></html>\n");

View file

@ -7,7 +7,16 @@ dhcpd-pools: unknown color mode: 'sometimes'
=== IPv5
dhcpd-pools: unknown --ip-version argument: 5
=== missing conf
dhcpd-pools: parse_config: ./tests/confs/complete_NXFILE: No such file or directory
dhcpd-pools: cannot open inlude: ./tests/confs/complete_NXFILE: No such file or directory
Ranges:
shared net name first ip last ip max cur percent touch t+c t+c perc
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 0 0 nan 0 0 nan
=== missing leases
dhcpd-pools: parse_leases: ./tests/leases/complete_NXFILE: No such file or directory
=== html table

View file

@ -23,8 +23,8 @@ All networks 100 43 43.000 0 43 43.000
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-2.2.2/datatables.min.css">
<style type="text/css">
table.dhcpd-pools th { text-transform: capitalize }
</style>
@ -176,10 +176,10 @@ table.dhcpd-pools th { text-transform: capitalize }
</tbody>
</table>
<br /><div class="well well-lg">
More info at <a href="http://dhcpd-pools.sourceforge.net/">http://dhcpd-pools.sourceforge.net/</a>
More info at <a href="https://dhcpd-pools.sourceforge.net/">https://dhcpd-pools.sourceforge.net/</a>
</small></div></div>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript" src="https://cdn.datatables.net/v/bs/jq-3.2.1/dt-1.10.16/datatables.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-2.2.2/datatables.min.js"></script>
<script type="text/javascript" class="init">$(document).ready(function() { $('#s').DataTable({ "iDisplayLength": 50, "lengthMenu": [ [25, 50, 100, -1], [25, 50, 100, "All"] ], "order": [[ 4, "desc" ]] } ); } );</script>
<script type="text/javascript" class="init">$(document).ready(function() { $('#r').DataTable({ "iDisplayLength": 100, "lengthMenu": [ [25, 50, 100, -1], [25, 50, 100, "All"] ], "order": [[ 6, "desc" ]] } ); } );</script>
</body></html>

View file

@ -1,6 +1,6 @@
{
"active_leases": [
{ "ip":"10.0.0.5", "macaddress":"00:00:00:00:00:00" }
{ "ip":"10.0.0.5", "macaddress":"00:00:00:00:00:00", "starts":"", "ends":"", "hostname":"" }
],
"subnets": [
{ "location":"All networks", "range":"10.0.0.1 - 10.0.0.10", "first_ip":"10.0.0.1", "last_ip":"10.0.0.10", "defined":10, "used":1, "touched":0, "free":9, "percent":10, "touch_count":1, "touch_percent":10, "status":0 }

View file

@ -2,6 +2,9 @@
<active_lease>
<ip>10.0.0.5</ip>
<macaddress>00:00:00:00:00:00</macaddress>
<starts></starts>
<ends></ends>
<hostname></hostname>
</active_lease>
<subnet>
<location>All networks</location>

View file

@ -4,12 +4,11 @@
# analysis algorithm is sane. This script is no longer
# maintained, and can be considered as historic reference.
#
# Licensed under the Open Software License version 1.1
# http://opensource.org/licenses/osl.php
# Licensed under the Open Software License version 1.0
# https://opensource.org/license/osl-1-0/
#
# Sami Kerola <sami.kerola@teliasonera.com>
#
# Latest version is available from http://www.iki.fi/kerolasa/dhcp/
# This is version 1.4
BEGIN {

View file

@ -30,7 +30,7 @@ font-variant: normal;
</style>
</head>
<body>
<div itemscope itemtype="http://schema.org/SoftwareApplication">
<div itemscope itemtype="https://schema.org/SoftwareApplication">
<h1>ISC dhcpd lease analysis and reporting</h1>
<p>This is <span itemprop="name">dhcpd-pools</span>
<a href="https://www.isc.org/software/dhcp" itemprop="applicationSuite">ISC dhcp</a>
@ -49,9 +49,18 @@ any significant difference in getting analysis done.</p>
prompt&gt; ./dhcpd-pools --config=/etc/dhcpd.conf
--leases=/var/lib/dhcp/dhcpd.leases --format=H
--color=always --warning=40 --critical=50 --output=<a
href="http://dhcpd-pools.sourceforge.net/sampleoutput.html">sampleoutput.html</a>
href="https://dhcpd-pools.sourceforge.net/sampleoutput.html">sampleoutput.html</a>
</div>
<hr />
<h3>Is dhcpd-pools still developed?</h3>
<p>In short no, it is not.</p>
<p>
<a href="https://www.isc.org/blogs/isc-dhcp-eol/">ISC DHCPD has reached
EOL</a>. Users are Kea DHCP server instead. Kea has <a
href="https://kea.readthedocs.io/en/kea-2.2.0/arm/stats.html">native
statistics</a>, so it does not require this tool and therefore the
dhcpd-pools is obsolte.
</p>
<h3>Where I can get dhcpd-pools?</h3>
<p>Download
<a href="https://sourceforge.net/projects/dhcpd-pools/files/" itemprop="downloadUrl">release package</a>
@ -61,11 +70,11 @@ file.
<br /></p>
<div class="tt">git clone git://git.code.sf.net/p/dhcpd-pools/code dhcpd-pools</div>
<p>See also
<a href="http://sourceforge.net/projects/dhcpd-pools">SourceForge</a> project page.</p>
<a href="https://sourceforge.net/projects/dhcpd-pools">SourceForge</a> project page.</p>
<h3>Documentation</h3>
<p>The dhcpd-pools
<a href="http://dhcpd-pools.sourceforge.net/man.html">manual page</a>, and
<a href="http://dhcpd-pools.sourceforge.net/doxygen/">Doxygen</a> software
<a href="https://dhcpd-pools.sourceforge.net/man.html">manual page</a>, and
<a href="https://dhcpd-pools.sourceforge.net/doxygen/">Doxygen</a> software
reference documentation are available online.</p>
<h3>Getting the output you need</h3>
<ol>
@ -80,8 +89,8 @@ try:<br />
<li>Start filtering output. Options to try:<br />
<span style="font-family:monospace">--skip --limit</span></li>
<li>Change <span style="font-family:monospace">--format</span>
option to what you need, and maybe include <span style=
"font-family:monospace">--perfdata</span> if you want nagios alarm
option to what you need, and maybe include <span style="font-family:monospace">
--perfdata</span> if you want nagios alarm
format.</li>
<li>Done.</li>
</ol>
@ -90,33 +99,33 @@ format.</li>
<script type='text/javascript' src='https://www.openhub.net/p/dhcpd-pools/widgets/project_factoids_stats?format=js'></script>
</p>
<p>The program was written because
<a href="http://dhcpstatus.sourceforge.net/">DHCPStatus</a>,
<a href="http://freshmeat.net/projects/dhcpusestats/">DHCP Usage Statistics</a>,
<a href="http://www.omar.org/opensource/reportdhcp/">reportdhcp.pl</a>,
<a href="http://www.ofb.net/%7Ejheiss/lease_analyzer">lease_analyzer</a> and
<a href="http://www.net-track.ch/opensource/dhcpd-snmp/">dhcpd-snmp</a>
<a href="https://dhcpstatus.sourceforge.net/">DHCPStatus</a>,
<a href="https://freshmeat.net/projects/dhcpusestats/">DHCP Usage Statistics</a>,
<a href="https://www.omar.org/opensource/reportdhcp/">reportdhcp.pl</a>,
<a href="https://www.ofb.net/%7Ejheiss/lease_analyzer">lease_analyzer</a> and
<a href="https://www.net-track.ch/opensource/dhcpd-snmp/">dhcpd-snmp</a>
where too slow to handle huge number of leases. There is also difference in
printed details. The dhcpd-pools does not print quite as much information as
some other tools.</p>
<p>Notice that this utility is not the same as
<a href="http://folk.uio.no/trondham/software/dhcpd-pool.html">dhcpd-pool</a>
<a href="https://folk.uio.no/trondham/software/dhcpd-pool.html">dhcpd-pool</a>
that is maintained by Trond Hasle Amundsen.</p>
<p>Just for laugh, obsolete awk proof of concept (version 1.4)
<a href="http://dhcpd-pools.sourceforge.net/dhcpd-pools.awk">dhcpd-pools.awk</a></p>
<a href="https://dhcpd-pools.sourceforge.net/dhcpd-pools.awk">dhcpd-pools.awk</a></p>
<h3>Where to send questions, bug reports, code contributions...</h3>
<p><a href="http://www.iki.fi/kerolasa/" itemprop="copyrightHolder">Sami Kerola</a>
<p><a href="https://kerolasa.iki.fi/" itemprop="copyrightHolder">Sami Kerola</a>
&lt;<a href="mailto:kerolasa@iki.fi">kerolasa@iki.fi</a>&gt;</p>
<div style="visibility:hidden">
<span itemprop="datePublished" datetime="2006-03-13T00:00:00+0000">Mon Mar 13 00:00:00 GMT 2006</span>
<span itemprop="dateModified" datetime="2017-11-15T12:47:30+0000">Wed Nov 15 12:47:30 GMT 2017</span>
<span itemprop="dateModified" datetime="2022-11-26T09:58:28+0000">Sat Nov 26 09:58:28 GMT 2022</span>
<span itemprop="version">3.0</span>
<span itemprop="license">FreeBSD License</span>
<a href="http://dhcpd-pools.sourceforge.net/" itemprop="url"></a>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<a href="https://dhcpd-pools.sourceforge.net/" itemprop="url"></a>
<div itemprop="offers" itemscope itemtype="https://schema.org/Offer">
<span itemprop="price">0</span>
<meta itemprop="priceCurrency" content="EUR" />
</div>
<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<div itemprop="aggregateRating" itemscope itemtype="https://schema.org/AggregateRating">
<span itemprop="ratingValue">5</span> (
<span itemprop="ratingCount">2</span> ratings )
</div>

View file

@ -1,3 +1,3 @@
Sitemap: http://dhcpd-pools.sourceforge.net/sitemap.txt
Sitemap: https://dhcpd-pools.sourceforge.net/sitemap.txt
User-agent: *
Disallow:

View file

@ -5,8 +5,8 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs/jq-3.2.1/dt-1.10.16/datatables.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-2.2.2/datatables.min.css">
<style type="text/css">
table.dhcpd-pools th { text-transform: capitalize }
</style>
@ -14,7 +14,7 @@ table.dhcpd-pools th { text-transform: capitalize }
<body>
<div class="container">
<h2>ISC DHCPD status</h2>
<small>File samples/dhcpd.leases was last modified at 2017-11-11T23:59:04+0000</small><hr />
<small>File tests/leases/formats was last modified at 2025-04-15T14:32:48+0100</small><hr />
<h3>Sum of all</h3>
<table id="a" class="dhcpd-pools order-column table table-hover" summary="all">
<thead>
@ -27,8 +27,6 @@ table.dhcpd-pools th { text-transform: capitalize }
<th>touch</th>
<th>t+c</th>
<th>t+c perc</th>
<th>bu</th>
<th>bu perc</th>
</tr>
</thead>
<tbody>
@ -41,8 +39,6 @@ table.dhcpd-pools th { text-transform: capitalize }
<td>0</td>
<td>43</td>
<td>43.000</td>
<td>2</td>
<td>43.000</td>
</tr>
</tbody>
</table>
@ -58,8 +54,6 @@ table.dhcpd-pools th { text-transform: capitalize }
<th>touch</th>
<th>t+c</th>
<th>t+c perc</th>
<th>bu</th>
<th>bu perc</th>
</tr>
</thead>
<tbody>
@ -72,8 +66,6 @@ table.dhcpd-pools th { text-transform: capitalize }
<td>0</td>
<td>21</td>
<td>52.500</td>
<td>1</td>
<td>2.500</td>
</tr>
<tr>
<td>example2</td>
@ -84,8 +76,6 @@ table.dhcpd-pools th { text-transform: capitalize }
<td>0</td>
<td>17</td>
<td>42.500</td>
<td>0</td>
<td>0.000</td>
</tr>
</tbody>
</table>
@ -103,8 +93,6 @@ table.dhcpd-pools th { text-transform: capitalize }
<th>touch</th>
<th>t+c</th>
<th>t+c perc</th>
<th>bu</th>
<th>bu perc</th>
</tr>
</thead>
<tbody>
@ -119,8 +107,6 @@ table.dhcpd-pools th { text-transform: capitalize }
<td>0</td>
<td>11</td>
<td>55.000</td>
<td>1</td>
<td>5.000</td>
</tr>
<tr>
<td>example1</td>
@ -133,8 +119,6 @@ table.dhcpd-pools th { text-transform: capitalize }
<td>0</td>
<td>10</td>
<td>50.000</td>
<td>0</td>
<td>0.000</td>
</tr>
<tr>
<td>example2</td>
@ -147,8 +131,6 @@ table.dhcpd-pools th { text-transform: capitalize }
<td>0</td>
<td>8</td>
<td>40.000</td>
<td>0</td>
<td>0.000</td>
</tr>
<tr>
<td>example2</td>
@ -161,8 +143,6 @@ table.dhcpd-pools th { text-transform: capitalize }
<td>0</td>
<td>9</td>
<td>45.000</td>
<td>0</td>
<td>0.000</td>
</tr>
<tr>
<td>All networks</td>
@ -175,17 +155,15 @@ table.dhcpd-pools th { text-transform: capitalize }
<td>0</td>
<td>5</td>
<td>25.000</td>
<td>1</td>
<td>5.000</td>
</tr>
</tbody>
</table>
<br /><div class="well well-lg">
<small>Generated using dhcpd-pools 3.0<br />
More info at <a href="http://dhcpd-pools.sourceforge.net/">http://dhcpd-pools.sourceforge.net/</a>
<small>Generated using dhcpd-pools 3.3<br />
More info at <a href="https://dhcpd-pools.sourceforge.net/">https://dhcpd-pools.sourceforge.net/</a>
</small></div></div>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript" src="https://cdn.datatables.net/v/bs/jq-3.2.1/dt-1.10.16/datatables.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-2.2.2/datatables.min.js"></script>
<script type="text/javascript" class="init">$(document).ready(function() { $('#s').DataTable({ "iDisplayLength": 50, "lengthMenu": [ [25, 50, 100, -1], [25, 50, 100, "All"] ], "order": [[ 4, "desc" ]] } ); } );</script>
<script type="text/javascript" class="init">$(document).ready(function() { $('#r').DataTable({ "iDisplayLength": 100, "lengthMenu": [ [25, 50, 100, -1], [25, 50, 100, "All"] ], "order": [[ 6, "desc" ]] } ); } );</script>
</body></html>

File diff suppressed because it is too large Load diff