Project

General

Profile

« Previous | Next » 

Revision c18ba6bf

Added by Phil Davis over 9 years ago

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

View differences:

src/etc/inc/util.inc
392 392
		if ($bits == 32) {
393 393
			return $ipaddr;
394 394
		}
395
		return long2ip32(ip2long($ipaddr) | ~gen_subnet_mask_long($bits));
395
		return long2ip32(ip2long($ipaddr) | (~gen_subnet_mask_long($bits) & 0xFFFFFFFF));
396 396
	}
397 397
	return "";
398 398
}
src/usr/local/www/services_dhcp.php
798 798
));
799 799

  
800 800
// Compose a string to display the required address ranges
801
$range_from = ip2long(long2ip32(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)));
801
$range_from = ip2long(gen_subnetv4($ifcfgip, $ifcfgsn));
802 802
$range_from++;
803 803

  
804
$range_to = ip2long(long2ip32(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))));
804
$range_to = ip2long(gen_subnetv4_max($ifcfgip, $ifcfgsn));
805 805
$range_to--;
806 806

  
807 807
$rangestr = long2ip32($range_from) . ' - ' . long2ip32($range_to);

Also available in: Unified diff