mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-15 15:27:00 +00:00
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>
This commit is contained in:
parent
dc1f0b9b76
commit
d94654e100
3 changed files with 18 additions and 2 deletions
1
THANKS
1
THANKS
|
|
@ -50,3 +50,4 @@ Brent Swingle
|
|||
Mathieu Morier
|
||||
Jean Benoit
|
||||
Belkacem Daheb
|
||||
Björn Lässig
|
||||
|
|
|
|||
|
|
@ -238,8 +238,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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
[1;34mAll networks 0 0 nan 0 0 nan[0m
|
||||
=== missing leases
|
||||
dhcpd-pools: parse_leases: ./tests/leases/complete_NXFILE: No such file or directory
|
||||
=== html table
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue