summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-ethernet.py
diff options
context:
space:
mode:
authorJernej Jakob <jernej.jakob@gmail.com>2020-04-22 17:12:25 +0200
committerJernej Jakob <jernej.jakob@gmail.com>2020-04-23 16:09:33 +0200
commitd6c08414d55eadd8232b693303f2b14bfe121c01 (patch)
treecf7e5bd23fb6f2efa9f376cf4eec440bac31ff81 /src/conf_mode/interfaces-ethernet.py
parent76feb7d154a452ba5475b9b6ee720a7a8f5491d5 (diff)
downloadvyos-1x-d6c08414d55eadd8232b693303f2b14bfe121c01.tar.gz
vyos-1x-d6c08414d55eadd8232b693303f2b14bfe121c01.zip
interfaces: T2362: delete and re-add all EUI64 addresses if MAC has changed
Diffstat (limited to 'src/conf_mode/interfaces-ethernet.py')
-rwxr-xr-xsrc/conf_mode/interfaces-ethernet.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py
index 01a805e8b..f620cc6ab 100755
--- a/src/conf_mode/interfaces-ethernet.py
+++ b/src/conf_mode/interfaces-ethernet.py
@@ -20,7 +20,7 @@ from sys import exit
from copy import deepcopy
from netifaces import interfaces
-from vyos.ifconfig import EthernetIf
+from vyos.ifconfig import EthernetIf, Section
from vyos.ifconfig_vlan import apply_vlan_config, verify_vlan_config
from vyos.configdict import list_diff, vlan_to_dict
from vyos.config import Config
@@ -201,6 +201,12 @@ def get_config():
if conf.exists('mac'):
eth['mac'] = conf.return_value('mac')
+ # Find out if MAC has changed - if so, we need to delete all IPv6 EUI64 addresses
+ # before re-adding them
+ if ( eth['mac'] and eth['intf'] in Section.interfaces(section='ethernet')
+ and eth['mac'] != EthernetIf(eth['intf'], create=False).get_mac() ):
+ eth['ipv6_eui64_prefix_remove'] += eth['ipv6_eui64_prefix']
+
# Maximum Transmission Unit (MTU)
if conf.exists('mtu'):
eth['mtu'] = int(conf.return_value('mtu'))