summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
authorJernej Jakob <jernej.jakob@gmail.com>2020-04-22 18:57:50 +0200
committerJernej Jakob <jernej.jakob@gmail.com>2020-04-23 15:01:06 +0200
commit9f26522388972eb6537446a5030c806a5e1b68ff (patch)
treecdabc54e5291fff8ba671a5ff8b9b7eef9ae787c /python/vyos
parent0b6eb4f601dd9717b478ff38e8d4ab4fcd878b15 (diff)
downloadvyos-1x-9f26522388972eb6537446a5030c806a5e1b68ff.tar.gz
vyos-1x-9f26522388972eb6537446a5030c806a5e1b68ff.zip
interfaces: vlan: T2362: add IPv6 EUI64 address to VLAN scripts
Diffstat (limited to 'python/vyos')
-rw-r--r--python/vyos/configdict.py12
-rw-r--r--python/vyos/ifconfig_vlan.py8
2 files changed, 20 insertions, 0 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index 24fe174d2..0d315f146 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -125,6 +125,8 @@ def vlan_to_dict(conf):
'ip_enable_arp_ignore': 0,
'ip_proxy_arp': 0,
'ipv6_autoconf': 0,
+ 'ipv6_eui64_prefix': [],
+ 'ipv6_eui64_prefix_remove': [],
'ipv6_forwarding': 1,
'ipv6_dup_addr_detect': 1,
'ingress_qos': '',
@@ -199,6 +201,16 @@ def vlan_to_dict(conf):
if conf.exists('ipv6 address autoconf'):
vlan['ipv6_autoconf'] = 1
+ # Get prefix for IPv6 addressing based on MAC address (EUI-64)
+ if conf.exists('ipv6 address eui64'):
+ vlan['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 vlan['ipv6_eui64_prefix']:
+ vlan['ipv6_eui64_prefix_remove'].append(eff_addr)
+
# Disable IPv6 forwarding on this interface
if conf.exists('ipv6 disable-forwarding'):
vlan['ipv6_forwarding'] = 0
diff --git a/python/vyos/ifconfig_vlan.py b/python/vyos/ifconfig_vlan.py
index 899fd17da..ee009f7f9 100644
--- a/python/vyos/ifconfig_vlan.py
+++ b/python/vyos/ifconfig_vlan.py
@@ -66,10 +66,18 @@ def apply_vlan_config(vlan, config):
# assign/remove VRF
vlan.set_vrf(config['vrf'])
+ # Delete old IPv6 EUI64 addresses before changing MAC
+ for addr in config['ipv6_eui64_prefix_remove']:
+ vlan.del_ipv6_eui64_address(addr)
+
# Change VLAN interface MAC address
if config['mac']:
vlan.set_mac(config['mac'])
+ # Add IPv6 EUI-based addresses
+ for addr in config['ipv6_eui64_prefix']:
+ vlan.add_ipv6_eui64_address(addr)
+
# enable/disable VLAN interface
if config['disable']:
vlan.set_admin_state('down')