summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-09-08 19:53:49 +0200
committerChristian Poessinger <christian@poessinger.com>2019-09-20 21:28:53 +0200
commit735a7d663c279e25feadcfad79e17be7fc0d8c8f (patch)
treead0b2ead76b337a2ad89a30327b368c7a3e37871
parent78c0fc6050d05c03bd35c7d4beacef9da432deb3 (diff)
downloadvyos-1x-735a7d663c279e25feadcfad79e17be7fc0d8c8f.tar.gz
vyos-1x-735a7d663c279e25feadcfad79e17be7fc0d8c8f.zip
ethernet: T1637: reset MAC address to read hw-id on removal
-rwxr-xr-xsrc/conf_mode/interface-ethernet.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/conf_mode/interface-ethernet.py b/src/conf_mode/interface-ethernet.py
index c20e551d6..83459cedb 100755
--- a/src/conf_mode/interface-ethernet.py
+++ b/src/conf_mode/interface-ethernet.py
@@ -140,6 +140,10 @@ def get_config():
if conf.exists('disable-link-detect'):
eth['disable_link_detect'] = 2
+ # retrieve real hardware address
+ if conf.exists('hw-id'):
+ eth['hw_id'] = conf.return_value('hw-id')
+
# disable interface
if conf.exists('disable'):
eth['disable'] = True
@@ -235,9 +239,12 @@ def apply(eth):
# Enable private VLAN proxy ARP on this interface
e.proxy_arp_pvlan = eth['ip_proxy_arp_pvlan']
- # Change interface MAC address
+ # Change interface MAC address - re-set to real hardware address (hw-id)
+ # if custom mac is removed
if eth['mac']:
e.mac = eth['mac']
+ else:
+ e.mac = eth['hw_id']
# Maximum Transmission Unit (MTU)
e.mtu = eth['mtu']