summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsmos <seth.mos@dds.nl>2012-04-18 11:26:09 +0200
committersmos <seth.mos@dds.nl>2012-04-18 11:26:09 +0200
commitfeb88a1476141a7249e1046ee705e3e982374668 (patch)
tree994674ef79b52b948181e23fca6d4e5726abc2d0
parent1a5f87d1c856115009101d29732c53094082c6a2 (diff)
downloadpfsense-feb88a1476141a7249e1046ee705e3e982374668.zip
pfsense-feb88a1476141a7249e1046ee705e3e982374668.tar.gz
Add support for SLAAC on the WAN interface, this is required for Stateless autoconf addressing.
Normally this should only apply to Appliances that do not need to route. We automatically hook in the dhcp6 client to request name servers from DHCP6 in a information only mode. It will not attempt to request a address. For that you should use the plain DHCP6 option with a prefix size of none. This is for redmine ticket #1834
-rw-r--r--etc/inc/filter.inc1
-rw-r--r--etc/inc/interfaces.inc76
-rw-r--r--etc/inc/services.inc1
-rwxr-xr-xusr/local/www/interfaces.php24
4 files changed, 63 insertions, 39 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc
index 25008ff..09c642d 100644
--- a/etc/inc/filter.inc
+++ b/etc/inc/filter.inc
@@ -2497,6 +2497,7 @@ EOD;
break;
}
switch($oc['type6']) {
+ case "slaac":
case "dhcp6":
$ipfrules .= <<<EOD
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc
index 6e4351a..fb18fa2 100644
--- a/etc/inc/interfaces.inc
+++ b/etc/inc/interfaces.inc
@@ -1119,6 +1119,7 @@ function interface_bring_down($interface = "wan", $destroy = false) {
}
switch ($ifcfg['ipaddrv6']) {
+ case "slaac":
case "dhcp6":
$pidv6 = find_dhcp6c_process($realif);
if($pidv6)
@@ -2886,6 +2887,7 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven
}
switch ($wancfg['ipaddrv6']) {
+ case 'slaac':
case 'dhcp6':
interface_dhcpv6_configure($interface);
break;
@@ -3368,35 +3370,45 @@ function interface_dhcpv6_configure($interface = "wan") {
}
$dhcp6cconf = "";
- $dhcp6cconf .= "interface {$wanif} {\n";
- $dhcp6cconf .= " send ia-na 0; # request stateful address\n";
- if(is_numeric($wancfg['dhcp6-ia-pd-len'])) {
- $dhcp6cconf .= " send ia-pd 0; # request prefix delegation\n";
- }
- $dhcp6cconf .= "request domain-name-servers;\n";
- $dhcp6cconf .= "request domain-name;\n";
- $dhcp6cconf .= "script \"{$g['varetc_path']}/dhcp6c_{$interface}_script.sh\"; # we'd like some nameservers please\n";
-
- $dhcp6cconf .= "};\n";
- $dhcp6cconf .= "id-assoc na 0 { };\n";
- if(is_numeric($wancfg['dhcp6-ia-pd-len'])) {
- /* Setup the prefix delegation */
- $dhcp6cconf .= "id-assoc pd 0 {\n";
- foreach($iflist as $friendly => $ifdescr) {
- if($config['interfaces'][$friendly]['track6-interface'] != $interface)
- continue;
- if(is_numeric($config['interfaces'][$friendly]['track6-prefix-id'])) {
- log_error("setting up $friendly - {$config['interfaces'][$friendly]['track6-prefix-id']}");
- $realif = get_real_interface($friendly);
- $dhcp6cconf .= " prefix-interface {$realif} {\n";
- $dhcp6cconf .= " sla-id {$config['interfaces'][$friendly]['track6-prefix-id']};\n";
- $dhcp6cconf .= " sla-len {$wancfg['dhcp6-ia-pd-len']};\n";
- $dhcp6cconf .= " };\n";
- }
+ $dhcp6cconf .= "interface {$wanif} {\n";
+
+ /* for SLAAC interfaces we do fire off a dhcp6 client for just our name servers */
+ if($wancfg['ipaddrv6'] == "slaac") {
+ $dhcp6cconf .= " information-only;\n";
+ $dhcp6cconf .= " request domain-name-servers;\n";
+ $dhcp6cconf .= " request domain-name;\n";
+ $dhcp6cconf .= " script \"{$g['varetc_path']}/dhcp6c_{$interface}_script.sh\"; # we'd like some nameservers please\n";
+ $dhcp6cconf .= "};\n";
+ } else {
+
+ $dhcp6cconf .= " send ia-na 0; # request stateful address\n";
+ if(is_numeric($wancfg['dhcp6-ia-pd-len'])) {
+ $dhcp6cconf .= " send ia-pd 0; # request prefix delegation\n";
}
+ $dhcp6cconf .= "request domain-name-servers;\n";
+ $dhcp6cconf .= "request domain-name;\n";
+ $dhcp6cconf .= "script \"{$g['varetc_path']}/dhcp6c_{$interface}_script.sh\"; # we'd like some nameservers please\n";
+
$dhcp6cconf .= "};\n";
+ $dhcp6cconf .= "id-assoc na 0 { };\n";
+ if(is_numeric($wancfg['dhcp6-ia-pd-len'])) {
+ /* Setup the prefix delegation */
+ $dhcp6cconf .= "id-assoc pd 0 {\n";
+ foreach($iflist as $friendly => $ifdescr) {
+ if($config['interfaces'][$friendly]['track6-interface'] != $interface)
+ continue;
+ if(is_numeric($config['interfaces'][$friendly]['track6-prefix-id'])) {
+ log_error("setting up $friendly - {$config['interfaces'][$friendly]['track6-prefix-id']}");
+ $realif = get_real_interface($friendly);
+ $dhcp6cconf .= " prefix-interface {$realif} {\n";
+ $dhcp6cconf .= " sla-id {$config['interfaces'][$friendly]['track6-prefix-id']};\n";
+ $dhcp6cconf .= " sla-len {$wancfg['dhcp6-ia-pd-len']};\n";
+ $dhcp6cconf .= " };\n";
+ }
+ }
+ $dhcp6cconf .= "};\n";
+ }
}
-
fwrite($fd, $dhcp6cconf);
fclose($fd);
@@ -3432,6 +3444,7 @@ function interface_dhcpv6_configure($interface = "wan") {
log_error("Found IPv6 default gateway '{$parts[3]}' by RA.");
file_put_contents("{$g['tmp_path']}/{$wanif}_routerv6", "{$parts[3]}\n");
file_put_contents("{$g['tmp_path']}/{$wanif}_defaultgwv6", "{$parts[3]}\n");
+ break;
}
}
}
@@ -3440,12 +3453,13 @@ function interface_dhcpv6_configure($interface = "wan") {
* to configure a lan interface with a prefix */
sleep(5);
- /* configure dependent interfaces */
- foreach($iflist as $if => $ifname) {
- if($config['interfaces'][$if]['track6-interface'] == $interface)
- interface_track6_configure($if);
+ if($wancfg['ippaddrv6'] != "slaac") {
+ /* configure dependent interfaces */
+ foreach($iflist as $if => $ifname) {
+ if($config['interfaces'][$if]['track6-interface'] == $interface)
+ interface_track6_configure($if);
+ }
}
-
return 0;
}
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index 98a0b77..e0d0504 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -654,7 +654,6 @@ function services_dhcpdv6_configure() {
/* kill any running dhcpd */
if(is_process_running("dhcpd")) {
killbypid("{$g['dhcpd_chroot_path']}{$g['varrun_path']}/dhcpdv6.pid");
- killbypid("{$g['varrun_path']}/dhcpleases6.pid");
}
/* DHCP enabled on any interfaces? */
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php
index 8bd609f..5377357 100755
--- a/usr/local/www/interfaces.php
+++ b/usr/local/www/interfaces.php
@@ -213,6 +213,9 @@ switch($wancfg['ipaddr']) {
}
switch($wancfg['ipaddrv6']) {
+ case "slaac":
+ $pconfig['type6'] = "slaac";
+ break;
case "dhcp6":
$pconfig['dhcp6-duid'] = $wancfg['dhcp6-duid'];
if($wancfg['dhcp6-ia-pd-len'] == "")
@@ -803,6 +806,9 @@ if ($_POST['apply']) {
$wancfg['gatewayv6'] = $_POST['gatewayv6'];
}
break;
+ case "slaac":
+ $wancfg['ipaddrv6'] = "slaac";
+ break;
case "dhcp6":
$wancfg['ipaddrv6'] = "dhcp6";
$wancfg['dhcp6-duid'] = $_POST['dhcp6-duid'];
@@ -1080,7 +1086,7 @@ $statusurl = "status_interfaces.php";
$closehead = false;
include("head.inc");
$types4 = array("none" => gettext("None"), "staticv4" => gettext("Static IPv4"), "dhcp" => gettext("DHCP"), "ppp" => gettext("PPP"), "pppoe" => gettext("PPPoE"), "pptp" => gettext("PPTP"), "l2tp" => gettext("L2TP") /* , "carpdev-dhcp" => "CarpDev"*/);
-$types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), "dhcp6" => gettext("DHCP6"), "6rd" => gettext("6rd"), "6to4" => gettext("6to4"), "track6" => gettext("Track Interface"));
+$types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), "dhcp6" => gettext("DHCP6"), "slaac" => gettext("SLAAC"), "6rd" => gettext("6rd Tunnel"), "6to4" => gettext("6to4 Tunnel"), "track6" => gettext("Track Interface"));
?>
@@ -1127,27 +1133,31 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"),
function updateTypeSix(t) {
switch(t) {
case "none": {
- jQuery('#staticv6, #dhcp6, #6rd, #6to4, #track6').hide();
+ jQuery('#staticv6, #dhcp6, #6rd, #6to4, #track6, #slaac').hide();
break;
}
case "staticv6": {
- jQuery('#none, #dhcp6, #6rd, #6to4, #track6').hide();
+ jQuery('#none, #dhcp6, #6rd, #6to4, #track6, #slaac').hide();
+ break;
+ }
+ case "slaac": {
+ jQuery('#none, #staticv6, #6rd, #6to4, #track6, #dhcp6').hide();
break;
}
case "dhcp6": {
- jQuery('#none, #staticv6, #6rd, #6to4, #track6').hide();
+ jQuery('#none, #staticv6, #6rd, #6to4, #track6, #slaac').hide();
break;
}
case "6rd": {
- jQuery('#none, #dhcp6, #staticv6, #6to4, #track6').hide();
+ jQuery('#none, #dhcp6, #staticv6, #6to4, #track6, #slaac').hide();
break;
}
case "6to4": {
- jQuery('#none, #dhcp6, #staticv6, #6rd, #track6').hide();
+ jQuery('#none, #dhcp6, #staticv6, #6rd, #track6, #slaac').hide();
break;
}
case "track6": {
- jQuery('#none, #dhcp6, #staticv6, #6rd, #6to4').hide();
+ jQuery('#none, #dhcp6, #staticv6, #6rd, #6to4, #slaac').hide();
break;
}
}
OpenPOWER on IntegriCloud