summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-09-08 20:04:45 +0200
committerChristian Poessinger <christian@poessinger.com>2019-09-20 21:28:53 +0200
commit04399a6e724c95c44e136f4675b04262de73d156 (patch)
treed95973219dd189061360eeab513bca2e87db96de /python/vyos
parentca9964099fe67128bd380fb6026f1631ccd89f11 (diff)
downloadvyos-1x-04399a6e724c95c44e136f4675b04262de73d156.tar.gz
vyos-1x-04399a6e724c95c44e136f4675b04262de73d156.zip
Python/ifconfig: T1557: mac: ignore empty address strings
Diffstat (limited to 'python/vyos')
-rw-r--r--python/vyos/ifconfig.py5
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: