1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-11-25 19:47:02 +00:00

Merge pull request #752 from avian2/fix-dhcp-pool

dhcp-pool: fix conffile parsing
This commit is contained in:
Steve Schnepp 2016-10-01 21:26:56 +02:00 committed by GitHub
commit 521bc92393

View file

@ -73,7 +73,7 @@ else {
# For each pool, count how many leases from that pool are currently active
foreach $start (keys %pools) {
$size = $pools{$start};
$end = $start+$size;
$end = $start+$size-1;
$free = $size;
foreach $lease (@activeleases) {
@ -98,12 +98,17 @@ sub determine_pools {
close (CONFFILE);
foreach $line (@conffile) {
next if $line =~ /^\s*#/;
if ($line =~ /range[\s]+([\d]+\.[\d]+\.[\d]+\.[\d]+)[\s]+([\d]+\.[\d]+\.[\d]+\.[\d]+)/) {
$start = string2ip($1);
$end = string2ip($2);
$size = $end - $start;
defined($start) || next;
defined($end) || next;
# The range statement gives the lowest and highest IP addresses in a range.
$size = $end - $start + 1;
$pools{$start} = $size;
}