From 9d2ee6178bacd2b69c0fa7234ea0c96ecc39576d Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 31 May 2024 13:23:26 +0200 Subject: [PATCH] interfaces: experiment on SLAAC avoidance for #5630 --- src/etc/inc/interfaces.inc | 2 ++ src/etc/rc.newwanipv6 | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 0a29b0b80..1efe61b7d 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -4059,6 +4059,7 @@ function interfaces_addresses($interfaces, $as_subnet = false, $ifconfig_details $result[$key] = [ 'address' => $address['ipaddr'], 'alias' => false, + 'autoconf' => !empty($address['autoconf']), 'bind' => true, 'bits' => $address['subnetbits'], 'deprecated' => !empty($address['deprecated']), @@ -4175,6 +4176,7 @@ function _interfaces_primary_address6($interface, $ifconfig_details = null, $all } foreach (interfaces_addresses($interface, false, $ifconfig_details) as $addr) { + /* XXX consider excluding 'autoconf', but only when it's not in SLAAC mode */ if ($addr['family'] != 'inet6' || $addr['deprecated'] || $addr['detached'] || $addr['tentative'] || $addr['alias']) { continue; } diff --git a/src/etc/rc.newwanipv6 b/src/etc/rc.newwanipv6 index dd8360fbc..cc33df51f 100755 --- a/src/etc/rc.newwanipv6 +++ b/src/etc/rc.newwanipv6 @@ -105,6 +105,8 @@ switch ($config['interfaces'][$interface]['ipaddrv6'] ?? 'none') { plugins_configure('dhcp', false, ['inet6']); break; default: + /* flush SLAAC addressing in order to make any of our own addresses preferred */ + shell_safe('/usr/local/sbin/ifctl -i %s -f', $realif); break; }