diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-10-07 19:57:05 +0200 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2026-10-31 09:58:29 +0000 |
| commit | 2b6a744cc2f90114fa0df85db096495866a403e2 (patch) | |
| tree | be07b8f74d99e17a00aa118aa21ab1129c6d009e /python | |
| parent | 30b999c5a2b6ce67734e882942609a5e4a4d84cf (diff) | |
| download | vyos-1x-2b6a744cc2f90114fa0df85db096495866a403e2.tar.gz vyos-1x-2b6a744cc2f90114fa0df85db096495866a403e2.zip | |
ethernet: T3871: restore the address the card came with, not the one on it
Deleting an ethernet configuration puts the hardware address back. It was
read from the driver, which reports the current address when it cannot report
a permanent one separately - and at that point the current address is still
the custom one being removed, so it was reapplied rather than undone and the
card kept an address the configuration no longer mentioned.
Ask what naming recorded for the interface first, as the reset path already
does. That was taken before any custom address was applied, and the driver
stays the fallback for an interface no pass has seen.
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/ifconfig/ethernet.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py index 2f53b5e06..60a3ce7a3 100644 --- a/python/vyos/ifconfig/ethernet.py +++ b/python/vyos/ifconfig/ethernet.py @@ -20,6 +20,7 @@ from glob import glob from vyos.base import Warning from vyos.ethtool import Ethtool from vyos.ifconfig.ifname_store import permanent_mac +from vyos.ifconfig.ifname_store import recorded_mac from vyos.ifconfig.interface import Interface from vyos.utils.dict import dict_search from vyos.utils.file import read_file @@ -162,7 +163,10 @@ class EthernetIf(Interface): # of step with the bond it is still in. Releasing it runs this again. tmp = get_interface_config(self.ifname) if dict_search('linkinfo.info_slave_kind', tmp) != 'bond': - mac = permanent_mac(self.ifname) + # what naming recorded first: a driver which cannot report a + # permanent address reports the current one instead, which is the + # custom address still on the port at this point + mac = recorded_mac(self.ifname) or permanent_mac(self.ifname) if mac: self.set_mac(mac) |
