diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-09-08 20:04:45 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-09-20 21:28:53 +0200 |
commit | 04399a6e724c95c44e136f4675b04262de73d156 (patch) | |
tree | d95973219dd189061360eeab513bca2e87db96de | |
parent | ca9964099fe67128bd380fb6026f1631ccd89f11 (diff) | |
download | vyos-1x-04399a6e724c95c44e136f4675b04262de73d156.tar.gz vyos-1x-04399a6e724c95c44e136f4675b04262de73d156.zip |
Python/ifconfig: T1557: mac: ignore empty address strings
-rw-r--r-- | python/vyos/ifconfig.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index 9310ee278..ab8799e54 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -43,7 +43,6 @@ dhclient_base = r'/var/lib/dhcp/dhclient_' class Interface: - def __init__(self, ifname, type=None): """ This is the base interface class which supports basic IP/MAC address @@ -202,6 +201,10 @@ class Interface: >>> Interface('eth0').mac '00:90:43:fe:fe:1b' """ + # on interface removal (ethernet) an empty string is passed - ignore it + if not mac: + return None + # a mac address consits out of 6 octets octets = len(mac.split(':')) if octets != 6: |