From de44c6aef249b5c3350a5114a38eee3a761f7de0 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Sun, 20 Apr 2025 20:59:57 +0200 Subject: interface: T7379: do not request SLAAC default route when only DHCPv6 is set When an interface runs in DHCPv6 only mode, there is no reason to have a default installed that was received via SLAAC. If SLAAC is needed, it should be turned on explicitly. This bug was only triggered during system boot where a DHCPv6 client address and a default route to a link-local address was shown in the system. If DHCPv6 was enabled only on an interface while VyOS was already running - no default route got installed. --- python/vyos/ifconfig/interface.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'python') diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index baa45f5bd..337e3ec63 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -913,7 +913,7 @@ class Interface(Control): rc = self.set_interface('ipv6_autoconf', autoconf) if autoconf == '0': flushed = self.flush_ipv6_slaac_addrs() - self.flush_ipv6_slaac_routes(flushed) + self.flush_ipv6_slaac_routes(ra_addrs=flushed) return rc def add_ipv6_eui64_address(self, prefix): @@ -1326,7 +1326,7 @@ class Interface(Control): netns = get_interface_namespace(self.ifname) netns_cmd = f'ip netns exec {netns}' if netns else '' tmp = get_interface_address(self.ifname) - if 'addr_info' not in tmp: + if not tmp or 'addr_info' not in tmp: return # Parse interface IP addresses. Example data: @@ -1354,13 +1354,9 @@ class Interface(Control): Will raise an exception on error. """ - # Do not flush default route if interface uses DHCPv6 in addition to SLAAC - if 'address' in self.config and 'dhcpv6' in self.config['address']: - return None - # Find IPv6 connected prefixes for flushed SLAAC addresses connected = [] - for addr in ra_addrs: + for addr in ra_addrs if isinstance(ra_addrs, list) else []: connected.append(str(IPv6Interface(addr).network)) netns = get_interface_namespace(self.ifname) @@ -1865,9 +1861,7 @@ class Interface(Control): # IPv6 router advertisements tmp = dict_search('ipv6.address.autoconf', config) - value = '2' if (tmp != None) else '1' - if 'dhcpv6' in new_addr: - value = '2' + value = '2' if (tmp != None) else '0' self.set_ipv6_accept_ra(value) # IPv6 address autoconfiguration -- cgit v1.2.3