diff options
author | Renato Botelho <renato@netgate.com> | 2016-02-19 08:28:44 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-02-19 10:57:32 -0200 |
commit | 2bf455caa3aaca83287309b6a7629c7d3a328652 (patch) | |
tree | d86087d0db6abc692d570e9f2dde7067675b0ffb /src/usr/local/www/services_dhcpv6.php | |
parent | 934b8a98b29b01978f6d36d9487423df1b2f7339 (diff) | |
download | pfsense-2bf455caa3aaca83287309b6a7629c7d3a328652.zip pfsense-2bf455caa3aaca83287309b6a7629c7d3a328652.tar.gz |
Ticket #3029
Import patch from @Robert-Nelson to enable DHCPv6 Server/RA to
interfaces configured to track DHCP-PD
This patch only works for PD with length 64
Diffstat (limited to 'src/usr/local/www/services_dhcpv6.php')
-rw-r--r-- | src/usr/local/www/services_dhcpv6.php | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/src/usr/local/www/services_dhcpv6.php b/src/usr/local/www/services_dhcpv6.php index 5513b3d..ea80ac4 100644 --- a/src/usr/local/www/services_dhcpv6.php +++ b/src/usr/local/www/services_dhcpv6.php @@ -99,8 +99,9 @@ $iflist = array_merge($iflist, get_configured_pppoe_server_interfaces()); if (!$if || !isset($iflist[$if])) { foreach ($iflist as $ifent => $ifname) { $oc = $config['interfaces'][$ifent]; - $valid_if_ipaddrv6 = (bool) (is_ipaddrv6($oc['ipaddrv6']) && - !is_linklocal($oc['ipaddrv6'])); + $valid_if_ipaddrv6 = (bool) ($oc['ipaddrv6'] == 'track6' || + (is_ipaddrv6($oc['ipaddrv6']) && + !is_linklocal($oc['ipaddrv6']))); if ((!is_array($config['dhcpdv6'][$ifent]) || !isset($config['dhcpdv6'][$ifent]['enable'])) && @@ -151,8 +152,13 @@ if (is_array($config['dhcpdv6'][$if])) { $a_maps = &$config['dhcpdv6'][$if]['staticmap']; } -$ifcfgip = get_interface_ipv6($if); -$ifcfgsn = get_interface_subnetv6($if); +if ($config['interfaces'][$if]['ipaddrv6'] == 'track6') { + $ifcfgip = '::'; + $ifcfgsn = 64; +} else { + $ifcfgip = get_interface_ipv6($if); + $ifcfgsn = get_interface_subnetv6($if); +} /* set the enabled flag which will tell us if DHCP relay is enabled * on any interface. We will use this to disable DHCP server since @@ -234,11 +240,21 @@ if ($_POST) { } } - if (($_POST['range_from'] && !is_ipaddrv6($_POST['range_from']))) { - $input_errors[] = gettext("A valid range must be specified."); + if ($_POST['range_from']) { + if (!is_ipaddrv6($_POST['range_from'])) { + $input_errors[] = gettext("A valid range must be specified."); + } elseif ($config['interfaces'][$if]['ipaddrv6'] == 'track6' && + !Net_IPv6::isInNetmask($_POST['range_from'], '::', 64)) { + $input_errors[] = gettext("The prefix (upper 64 bits) must be zero. Use the form ::x:x:x:x"); + } } - if (($_POST['range_to'] && !is_ipaddrv6($_POST['range_to']))) { - $input_errors[] = gettext("A valid range must be specified."); + if ($_POST['range_to']) { + if (!is_ipaddrv6($_POST['range_to'])) { + $input_errors[] = gettext("A valid range must be specified."); + } elseif ($config['interfaces'][$if]['ipaddrv6'] == 'track6' && + !Net_IPv6::isInNetmask($_POST['range_to'], '::', 64)) { + $input_errors[] = gettext("The prefix (upper 64 bits) must be zero. Use the form ::x:x:x:x"); + } } if (($_POST['gateway'] && !is_ipaddrv6($_POST['gateway']))) { $input_errors[] = gettext("A valid IPv6 address must be specified for the gateway."); @@ -507,8 +523,9 @@ $i = 0; foreach ($iflist as $ifent => $ifname) { $oc = $config['interfaces'][$ifent]; - $valid_if_ipaddrv6 = (bool) (is_ipaddrv6($oc['ipaddrv6']) && - !is_linklocal($oc['ipaddrv6'])); + $valid_if_ipaddrv6 = (bool) ($oc['ipaddrv6'] == 'track6' || + (is_ipaddrv6($oc['ipaddrv6']) && + !is_linklocal($oc['ipaddrv6']))); if ((!is_array($config['dhcpdv6'][$ifent]) || !isset($config['dhcpdv6'][$ifent]['enable'])) && |