summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-11-19 22:07:38 +0100
committerChristian Poessinger <christian@poessinger.com>2020-11-19 22:07:38 +0100
commit1b3cde673ad0e00198565711ae5d6969ebd1cd82 (patch)
tree4a708e3e24c87c3a459a0a640cc39d10e1125af8 /python
parentf01b0ae9e5e71c55d5ea46103b59f265fd6b6f52 (diff)
downloadvyos-1x-1b3cde673ad0e00198565711ae5d6969ebd1cd82.tar.gz
vyos-1x-1b3cde673ad0e00198565711ae5d6969ebd1cd82.zip
ifconfig: T1405: ensure MAC address is configured first
The MAC address is changed after we have set an IP address on the interface or started dhclient. This will cause some users to receive the wrong IP address on device startup. Change to order of how parameters are set in the system. The interface MAC address is now configured first.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/interface.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index 893623284..39b80ce08 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -942,6 +942,15 @@ class Interface(Control):
# method to apply()?
self._config = config
+ # Change interface MAC address - re-set to real hardware address (hw-id)
+ # if custom mac is removed. Skip if bond member.
+ if 'is_bond_member' not in config:
+ mac = config.get('hw_id')
+ if 'mac' in config:
+ mac = config.get('mac')
+ if mac:
+ self.set_mac(mac)
+
# Update interface description
self.set_alias(config.get('description', ''))
@@ -1058,15 +1067,6 @@ class Interface(Control):
for addr in tmp:
self.del_ipv6_eui64_address(addr)
- # Change interface MAC address - re-set to real hardware address (hw-id)
- # if custom mac is removed. Skip if bond member.
- if 'is_bond_member' not in config:
- mac = config.get('hw_id')
- if 'mac' in config:
- mac = config.get('mac')
- if mac:
- self.set_mac(mac)
-
# Manage IPv6 link-local addresses
tmp = dict_search('ipv6.address.no_default_link_local', config)
# we must check explicitly for None type as if the key is set we will