Skip to content

Commit

Permalink
interfaces: immediately enable SLAAC during IPv6 initiation
Browse files Browse the repository at this point in the history
This improves PPPoE responsivenes for IPv6 acquire using
SLAAC on the "IPv4 interface".  Tests ok according to an
user and the impact on existing setups is low.

PR: https://forum.opnsense.org/index.php?topic=21506.0

(cherry picked from commit f1afe99)
(cherry picked from commit 8a82feb)
  • Loading branch information
fichtner committed Mar 26, 2021
1 parent 2e37568 commit 52d6e4a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
34 changes: 17 additions & 17 deletions src/etc/inc/interfaces.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2456,12 +2456,20 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal
switch ($wancfg['ipaddrv6']) {
case 'slaac':
case 'dhcp6':
/* XXX why not tell the function... */
if (isset($wancfg['dhcp6usev4iface'])) {
break;
$realifv6 = get_real_interface($interface, 'inet6');

/* accept router advertisements for this interface */
set_single_sysctl('net.inet6.ip6.accept_rtadv', '1');
log_error("Accept router advertisements on interface {$realifv6}");
mwexecf('/sbin/ifconfig %s inet6 accept_rtadv -ifdisabled', $realifv6);

/* Enable RFC6204w support for IPv6 Customer Edge (CE) router */
set_single_sysctl('net.inet6.ip6.rfc6204w3', '1');

if (!isset($wancfg['dhcp6usev4iface'])) {
interface_dhcpv6_prepare($interface, $wancfg);
interface_dhcpv6_configure($interface, $wancfg);
}
interface_dhcpv6_prepare($interface, $wancfg);
interface_dhcpv6_configure($interface, $wancfg);
break;
case '6rd':
interface_6rd_configure($interface, $wancfg);
Expand All @@ -2473,13 +2481,13 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal
interface_track6_configure($interface, $wancfg, $reload || $linkupevent);
break;
default:
/* XXX why not tell the function... */
if (isset($wancfg['dhcp6usev4iface'])) {
break;
if (!isset($wancfg['dhcp6usev4iface'])) {
interface_static6_configure($interface, $wancfg);
}
interface_static6_configure($interface, $wancfg);
break;
}

/* XXX we do not disable accept_rtadv on $realifv6 != $realif where unused */
}

if (!empty($wancfg['mtu'])) {
Expand Down Expand Up @@ -2887,14 +2895,6 @@ function interface_dhcpv6_configure($interface = 'wan', $wancfg)

$realifv6 = get_real_interface($interface, 'inet6');

/* accept router advertisements for this interface */
set_single_sysctl('net.inet6.ip6.accept_rtadv', '1');
log_error("Accept router advertisements on interface {$realifv6}");
mwexecf('/sbin/ifconfig %s inet6 accept_rtadv -ifdisabled', $realifv6);

/* Enable RFC6204w support for IPv6 Customer Edge (CE) router */
set_single_sysctl('net.inet6.ip6.rfc6204w3', '1');

/* always kill rtsold in case of reconfigure */
killbypid('/var/run/rtsold.pid', 'TERM', true);

Expand Down
12 changes: 5 additions & 7 deletions src/etc/rc.newwanip
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,15 @@ if (isset($config['interfaces'][$interface]['ipaddrv6'])) {
break;
case 'dhcp6':
case 'slaac':
if (!isset($config['interfaces'][$interface]['dhcp6usev4iface'])) {
break;
if (isset($config['interfaces'][$interface]['dhcp6usev4iface'])) {
interface_dhcpv6_prepare($interface, $config['interfaces'][$interface]);
interface_dhcpv6_configure($interface, $config['interfaces'][$interface]);
}
interface_dhcpv6_prepare($interface, $config['interfaces'][$interface]);
interface_dhcpv6_configure($interface, $config['interfaces'][$interface]);
break;
default:
if (!isset($config['interfaces'][$interface]['dhcp6usev4iface'])) {
break;
if (isset($config['interfaces'][$interface]['dhcp6usev4iface'])) {
interface_static6_configure($interface, $config['interfaces'][$interface]);
}
interface_static6_configure($interface, $config['interfaces'][$interface]);
break;
}
}
Expand Down

0 comments on commit 52d6e4a

Please sign in to comment.