diff options
author | Ermal Luçi <eri@pfsense.org> | 2009-03-30 00:37:45 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2009-03-30 00:38:36 +0000 |
commit | a55e9c701c2fc8914e0aebf12e37038f59b07cf8 (patch) | |
tree | 05b5a1bc85f8742706649429ec164f576d240975 /usr/local/www/services_dhcp.php | |
parent | cc460ee980e427bf4acdb8a4903e3278df59ea94 (diff) | |
download | pfsense-a55e9c701c2fc8914e0aebf12e37038f59b07cf8.zip pfsense-a55e9c701c2fc8914e0aebf12e37038f59b07cf8.tar.gz |
* 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.
Diffstat (limited to 'usr/local/www/services_dhcp.php')
-rwxr-xr-x | usr/local/www/services_dhcp.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/usr/local/www/services_dhcp.php b/usr/local/www/services_dhcp.php index 6ddced7..59b3415 100755 --- a/usr/local/www/services_dhcp.php +++ b/usr/local/www/services_dhcp.php @@ -101,7 +101,8 @@ if (is_array($config['dhcpd'][$if])){ $a_maps = &$config['dhcpd'][$if]['staticmap']; } -$ifcfg = $config['interfaces'][$if]; +$ifcfgip = get_interface_ip($if); +$ifcfgsn = get_interface_subnet($if); /* set the enabled flag which will tell us if DHCP relay is enabled @@ -181,8 +182,8 @@ if ($_POST) { if (!$input_errors) { /* make sure the range lies within the current subnet */ - $subnet_start = (ip2long($ifcfg['ipaddr']) & gen_subnet_mask_long($ifcfg['subnet'])); - $subnet_end = (ip2long($ifcfg['ipaddr']) | (~gen_subnet_mask_long($ifcfg['subnet']))); + $subnet_start = (ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn)); + $subnet_end = (ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))); if ((ip2long($_POST['range_from']) < $subnet_start) || (ip2long($_POST['range_from']) > $subnet_end) || (ip2long($_POST['range_to']) < $subnet_start) || (ip2long($_POST['range_to']) > $subnet_end)) { @@ -431,23 +432,23 @@ function show_netboot_config() { <tr> <td width="22%" valign="top" class="vncellreq">Subnet</td> <td width="78%" class="vtable"> - <?=gen_subnet($ifcfg['ipaddr'], $ifcfg['subnet']);?> + <?=gen_subnet($ifcfgip, $ifcfgsn);?> </td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">Subnet mask</td> <td width="78%" class="vtable"> - <?=gen_subnet_mask($ifcfg['subnet']);?> + <?=gen_subnet_mask($ifcfgsn);?> </td> </tr> <tr> <td width="22%" valign="top" class="vncellreq">Available range</td> <td width="78%" class="vtable"> - <?=long2ip(ip2long($ifcfg['ipaddr']) & gen_subnet_mask_long($ifcfg['subnet']));?> + <?=long2ip(ip2long($ifcfgip) & gen_subnet_mask_long($ifcfgsn));?> - - <?=long2ip(ip2long($ifcfg['ipaddr']) | (~gen_subnet_mask_long($ifcfg['subnet']))); ?> + <?=long2ip(ip2long($ifcfgip) | (~gen_subnet_mask_long($ifcfgsn))); ?> </td> </tr> <?php if($is_olsr_enabled): ?> |