summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-bonding.py
diff options
context:
space:
mode:
authorJernej Jakob <jernej.jakob@gmail.com>2020-04-22 17:08:44 +0200
committerJernej Jakob <jernej.jakob@gmail.com>2020-04-23 15:01:06 +0200
commit0b6eb4f601dd9717b478ff38e8d4ab4fcd878b15 (patch)
treedb94632df8dab84d02d3946f60c65afe63a40a3e /src/conf_mode/interfaces-bonding.py
parent2703915afb9a6bf266adc8834ab01ef721c03424 (diff)
downloadvyos-1x-0b6eb4f601dd9717b478ff38e8d4ab4fcd878b15.tar.gz
vyos-1x-0b6eb4f601dd9717b478ff38e8d4ab4fcd878b15.zip
interfaces: T2362: split set_ipv6_eui64_address into add and del functions
Diffstat (limited to 'src/conf_mode/interfaces-bonding.py')
-rwxr-xr-xsrc/conf_mode/interfaces-bonding.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/conf_mode/interfaces-bonding.py b/src/conf_mode/interfaces-bonding.py
index 380457772..267a78870 100755
--- a/src/conf_mode/interfaces-bonding.py
+++ b/src/conf_mode/interfaces-bonding.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2019 VyOS maintainers and contributors
+# Copyright (C) 2019-2020 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -52,7 +52,8 @@ default_config_data = {
'ip_proxy_arp': 0,
'ip_proxy_arp_pvlan': 0,
'ipv6_autoconf': 0,
- 'ipv6_eui64_prefix': '',
+ 'ipv6_eui64_prefix': [],
+ 'ipv6_eui64_prefix_remove': [],
'ipv6_forwarding': 1,
'ipv6_dup_addr_detect': 1,
'is_bridge_member': False,
@@ -204,7 +205,13 @@ def get_config():
# Get prefix for IPv6 addressing based on MAC address (EUI-64)
if conf.exists('ipv6 address eui64'):
- bond['ipv6_eui64_prefix'] = conf.return_value('ipv6 address eui64')
+ bond['ipv6_eui64_prefix'].append(conf.return_value('ipv6 address eui64'))
+
+ # Determine currently effective EUI64 address - to determine which
+ # address is no longer valid and needs to be removed
+ eff_addr = conf.return_effective_value('ipv6 address eui64')
+ if eff_addr and eff_addr not in bond['ipv6_eui64_prefix']:
+ bond['ipv6_eui64_prefix_remove'].append(eff_addr)
# Disable IPv6 forwarding on this interface
if conf.exists('ipv6 disable-forwarding'):
@@ -434,17 +441,23 @@ def apply(bond):
b.set_proxy_arp_pvlan(bond['ip_proxy_arp_pvlan'])
# IPv6 address autoconfiguration
b.set_ipv6_autoconf(bond['ipv6_autoconf'])
- # IPv6 EUI-based address
- b.set_ipv6_eui64_address(bond['ipv6_eui64_prefix'])
# IPv6 forwarding
b.set_ipv6_forwarding(bond['ipv6_forwarding'])
# IPv6 Duplicate Address Detection (DAD) tries
b.set_ipv6_dad_messages(bond['ipv6_dup_addr_detect'])
+ # Delete old IPv6 EUI64 addresses before changing MAC
+ for addr in bond['ipv6_eui64_prefix_remove']:
+ b.del_ipv6_eui64_address(addr)
+
# Change interface MAC address
if bond['mac']:
b.set_mac(bond['mac'])
+ # Add IPv6 EUI-based addresses
+ for addr in bond['ipv6_eui64_prefix']:
+ b.add_ipv6_eui64_address(addr)
+
# Maximum Transmission Unit (MTU)
b.set_mtu(bond['mtu'])