Project

General

Profile

« Previous | Next » 

Revision a55e9c70

Added by Ermal Luçi about 16 years ago

  • Hide interfaces internals to other code and use the propper interfaces.
    Basically use get_interface*() functions instead of accessing fields like 'ipaddr'/'descr' etc...
  • Make get_interfaces_with_gateway less heavyweight by getting information from the configuration stored in config.xml
  • Some other missed custom interface list building and substituing with propper get_configured_interface*()
    NOTE: This should give indipendce on dynamic interfaces on some services that before could not be used on top of this type of interfaces.

View differences:

usr/local/www/services_dhcp_edit.php
62 62

  
63 63
staticmaps_sort($if);
64 64
$a_maps = &$config['dhcpd'][$if]['staticmap'];
65
$ifcfg = &$config['interfaces'][$if];
65
$ifcfgip = get_interface_ip($if);
66
$ifcfgsn = get_interface_subnet($if);
67
$ifcfgdescr = convert_friendly_interface_to_friendly_descr($if);
66 68

  
67 69
$id = $_GET['id'];
68 70
if (isset($_POST['id']))
......
121 123
	if ($_POST['ipaddr']) {
122 124
		$dynsubnet_start = ip2long($config['dhcpd'][$if]['range']['from']);
123 125
		$dynsubnet_end = ip2long($config['dhcpd'][$if]['range']['to']);
124
		$lansubnet_start = (ip2long($ifcfg['ipaddr']) & gen_subnet_mask_long($ifcfg['subnet']));
125
		$lansubnet_end = (ip2long($ifcfg['ipaddr']) | (~gen_subnet_mask_long($ifcfg['subnet'])));
126
		$lansubnet_start = (ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn));
127
		$lansubnet_end = (ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn)));
126 128
		if ((ip2long($_POST['ipaddr']) < $lansubnet_start) ||
127 129
			(ip2long($_POST['ipaddr']) > $lansubnet_end)) {
128
			$input_errors[] = "The IP address must lie in the {$ifcfg['descr']} subnet.";
130
			$input_errors[] = "The IP address must lie in the {$ifcfgdescr} subnet.";
129 131
		}
130 132
	}
131 133

  

Also available in: Unified diff