summaryrefslogtreecommitdiff
path: root/cloudinit/net/__init__.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2018-10-09 17:31:33 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2018-10-09 17:31:33 +0000
commit00e36d3ded0b0f81f352de993036fc9f89e14a7a (patch)
tree5254db94dd7b77aa084b385f86999b7382f782fa /cloudinit/net/__init__.py
parent638f09e82260ea3256c387cd55408e0411f36c23 (diff)
downloadvyos-cloud-init-00e36d3ded0b0f81f352de993036fc9f89e14a7a.tar.gz
vyos-cloud-init-00e36d3ded0b0f81f352de993036fc9f89e14a7a.zip
net: ignore nics that have "zero" mac address.
Previously we explicitly excluded mac address '00:00:00:00:00:00'. But then some nics (tunl0 and sit0) ended up having a mac address like '00:00:00:00'. The change here just ignores all 00[:00[:00...]]. LP: #1796917
Diffstat (limited to 'cloudinit/net/__init__.py')
-rw-r--r--cloudinit/net/__init__.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
index f83d3681..ad98a595 100644
--- a/cloudinit/net/__init__.py
+++ b/cloudinit/net/__init__.py
@@ -612,7 +612,8 @@ def get_interfaces():
Bridges and any devices that have a 'stolen' mac are excluded."""
ret = []
devs = get_devicelist()
- empty_mac = '00:00:00:00:00:00'
+ # 16 somewhat arbitrarily chosen. Normally a mac is 6 '00:' tokens.
+ zero_mac = ':'.join(('00',) * 16)
for name in devs:
if not interface_has_own_mac(name):
continue
@@ -624,7 +625,8 @@ def get_interfaces():
# some devices may not have a mac (tun0)
if not mac:
continue
- if mac == empty_mac and name != 'lo':
+ # skip nics that have no mac (00:00....)
+ if name != 'lo' and mac == zero_mac[:len(mac)]:
continue
ret.append((name, mac, device_driver(name), device_devid(name)))
return ret