diff options
author | Phil Davis <phil.davis@inf.org> | 2015-12-18 12:23:26 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-12-18 12:23:26 +0545 |
commit | c18ba6bf278c96c3016f92681544e8ccbae79670 (patch) | |
tree | 43397320f9a3ff001aff2bfda4f2f458c73565aa /src | |
parent | bdabc817f21adb31e6f512fe59f7676997eaee8d (diff) | |
download | pfsense-c18ba6bf278c96c3016f92681544e8ccbae79670.zip pfsense-c18ba6bf278c96c3016f92681544e8ccbae79670.tar.gz |
Fix gen_subnetv4_max
and use it in services_dhcp rather than trying to do the similar
calculation in-line.
Should fix redmine #5654 and probably a bunch of other things that use
gen_subnet_max
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/inc/util.inc | 2 | ||||
-rw-r--r-- | src/usr/local/www/services_dhcp.php | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index 821855f..be6a5e9 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -392,7 +392,7 @@ function gen_subnetv4_max($ipaddr, $bits) { if ($bits == 32) { return $ipaddr; } - return long2ip32(ip2long($ipaddr) | ~gen_subnet_mask_long($bits)); + return long2ip32(ip2long($ipaddr) | (~gen_subnet_mask_long($bits) & 0xFFFFFFFF)); } return ""; } diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php index 333a322..ffcc6b5 100644 --- a/src/usr/local/www/services_dhcp.php +++ b/src/usr/local/www/services_dhcp.php @@ -798,10 +798,10 @@ $section->addInput(new Form_StaticText( )); // Compose a string to display the required address ranges -$range_from = ip2long(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn))); +$range_from = ip2long(gen_subnetv4($ifcfgip, $ifcfgsn)); $range_from++; -$range_to = ip2long(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn)))); +$range_to = ip2long(gen_subnetv4_max($ifcfgip, $ifcfgsn)); $range_to--; $rangestr = long2ip32($range_from) . ' - ' . long2ip32($range_to); |