diff options
author | Chris Buechler <cmb@pfsense.org> | 2016-01-28 17:57:37 -0600 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2016-01-28 17:57:37 -0600 |
commit | 0c9b98c0731f6486ee0734f58a099cd6023077d8 (patch) | |
tree | 6fd4604c75225acb232649e2e630fd86eb3f2d84 /src | |
parent | 7d8552fc50e0ea445fd59067f67b95557003f687 (diff) | |
download | pfsense-0c9b98c0731f6486ee0734f58a099cd6023077d8.zip pfsense-0c9b98c0731f6486ee0734f58a099cd6023077d8.tar.gz |
Import David W's patch fixing issues with dhcp6c being launched multiple times in some circumstances. Ticket #5621
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/inc/interfaces.inc | 38 | ||||
-rwxr-xr-x | src/etc/rc.newwanip | 4 | ||||
-rwxr-xr-x | src/usr/local/sbin/ppp-ipv6 | 8 |
3 files changed, 47 insertions, 3 deletions
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 29ae6b3..71c5123 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -2016,6 +2016,26 @@ EOD; } } + /* Set temporary bogon (RFC 5737) IPv4 addresses to work round mpd5 IPv6CP issue causing */ + /* random IPv6 interface identifier during boot. More details at */ + /* https://forum.pfsense.org/index.php?topic=101967.msg570519#msg570519 */ + if (platform_booting() && is_array($config['interfaces'])) { + $count = 0; + foreach ($config['interfaces'] as $tempifacename => $tempiface) { + if ((isset($tempiface['if'])) && (isset($tempiface['ipaddr']) || isset($tempiface['ipaddrv6'])) && !interface_isppp_type($tempifacename)) { + $tempaddr[$count]['if'] = $tempiface['if']; + $tempaddr[$count]['ipaddr'] = '192.0.2.' . strval (10 + ($count * 2)) . '/31'; + mwexec('/sbin/ifconfig ' . escapeshellarg($tempaddr[$count]['if']) . ' inet ' . escapeshellarg($tempaddr[$count]['ipaddr']) . ' alias', true); + $count++; + } + // Maximum /31 is is x.y.z.254/31 + if ($count > 122) { + break; + } + } + unset($count); + } + /* fire up mpd */ mwexec("/usr/local/sbin/mpd5 -b -k -d {$g['varetc_path']} -f mpd_{$interface}.conf -p {$g['varrun_path']}/" . escapeshellarg($ppp['type']) . "_{$interface}.pid -s ppp " . escapeshellarg($ppp['type']) . "client"); @@ -2038,6 +2058,16 @@ EOD; $i++; } + /* Remove all temporary bogon IPv4 addresses */ + if (is_array($tempaddr)) { + foreach ($tempaddr as $tempiface) { + if (isset($tempiface['if']) && isset($tempiface['ipaddr'])) { + mwexec('/sbin/ifconfig ' . escapeshellarg($tempiface['if']) . ' inet ' . escapeshellarg($tempiface['ipaddr']) . ' -alias', true); + } + } + unset ($tempaddr); + } + /* we only support the 3gstats.php for huawei modems for now. Will add more later. */ /* We should be able to launch the right version for each modem */ /* We can also guess the mondev from the manufacturer */ @@ -3385,7 +3415,12 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven switch ($wancfg['ipaddrv6']) { case 'slaac': case 'dhcp6': - interface_dhcpv6_configure($interface, $wancfg); + // N.B. PPP connections using PPP as the IPv6 parent interface are excluded because the ppp-ipv6 script + // calls interface_dhcpv6_configure() for these connections after IPv6CP is up, whilst rc.newwanip + // handles all non-PPP connections with 'dhcp6usev4iface' set + if (!(isset($wancfg['dhcp6usev4iface']) || $wancfg['ipaddr']==='ppp')) { + interface_dhcpv6_configure($interface, $wancfg); + } break; case '6rd': interface_6rd_configure($interface, $wancfg); @@ -3994,7 +4029,6 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) { @chmod("{$g['varetc_path']}/rtsold_{$wanif}_script.sh", 0755); /* accept router advertisements for this interface */ - set_single_sysctl("net.inet6.ip6.accept_rtadv", "1"); log_error("Accept router advertisements on interface {$wanif} "); mwexec("/sbin/ifconfig {$wanif} inet6 accept_rtadv"); diff --git a/src/etc/rc.newwanip b/src/etc/rc.newwanip index bfbe78b..880e64a 100755 --- a/src/etc/rc.newwanip +++ b/src/etc/rc.newwanip @@ -176,7 +176,9 @@ switch ($config['interfaces'][$interface]['ipaddrv6']) { interface_6rd_configure($interface, $config['interfaces'][$interface]); break; case "dhcp6": - if (isset($config['interfaces'][$interface]['dhcp6usev4iface'])) { + // N.B. PPP connections using PPP as the IPv6 parent interface are excluded because the ppp-ipv6 script calls + // interface_dhcpv6_configure() for these connections after IPv6CP is up + if (isset($config['interfaces'][$interface]['dhcp6usev4iface']) && !interface_isppp_type($interface)) { interface_dhcpv6_configure($interface, $config['interfaces'][$interface]); } break; diff --git a/src/usr/local/sbin/ppp-ipv6 b/src/usr/local/sbin/ppp-ipv6 index aa0536c..4d47de2 100755 --- a/src/usr/local/sbin/ppp-ipv6 +++ b/src/usr/local/sbin/ppp-ipv6 @@ -23,6 +23,10 @@ function interface_ipv6_lower($interface_real) { switch ($ifcfg['ipaddrv6']) { case 'slaac': case 'dhcp6': + // Take no action if dhcp6 is active on the parent interface, not the PPP interface + if ($ifcfg['ipaddrv6']==='dhcp6' && !(isset($ifcfg['dhcp6usev4iface']) || $ifcfg['ipaddr']==='ppp')) { + break; + } // bring down dhcp6c if it is running $pidv6 = find_dhcp6c_process($interface_real); if ($pidv6) { @@ -63,6 +67,10 @@ function interface_ipv6_raise($interface_real) { switch ($ifcfg['ipaddrv6']) { case 'slaac': case 'dhcp6': + // Take no action if dhcp6 is active on the parent interface, not the PPP interface + if ($ifcfg['ipaddrv6']==='dhcp6' && !(isset($ifcfg['dhcp6usev4iface']) || $ifcfg['ipaddr']==='ppp')) { + break; + } $pidv6 = find_dhcp6c_process($interface_real); if (empty($pidv6)) { // only fire if router advertisements off |