Merge pull request #2575 from davidjwood/RELENG_2_2-ppp-ipv6-new

This commit is contained in:
Chris Buechler 2016-01-30 04:06:00 -06:00
commit ec0643f7f1
3 changed files with 48 additions and 3 deletions

View File

@ -1818,6 +1818,26 @@ EOD;
unlink("{$g['var_path']}/spool/lock/LCK..{$port}");
}
/* 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");
@ -1838,6 +1858,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 */
@ -3019,7 +3049,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);
@ -3576,7 +3611,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");

View File

@ -159,8 +159,11 @@ 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;
}

View File

@ -25,6 +25,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) {
@ -65,6 +69,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