From df4ca453520342a0541ab9202305858bf39d4f48 Mon Sep 17 00:00:00 2001 From: Dimitri John Ledkov Date: Thu, 20 Apr 2017 11:08:48 +0100 Subject: net: kernel lies about vlans not stealing mac addresses, when they do Introduce is_vlan function and call that when building dictionary of interfaces by mac address. LP: #1682871 --- cloudinit/net/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cloudinit/net') diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py index 346be5d3..a072a8d6 100644 --- a/cloudinit/net/__init__.py +++ b/cloudinit/net/__init__.py @@ -86,6 +86,11 @@ def is_bridge(devname): return os.path.exists(sys_dev_path(devname, "bridge")) +def is_vlan(devname): + uevent = str(read_sys_net_safe(devname, "uevent")) + return 'DEVTYPE=vlan' in uevent.splitlines() + + def is_connected(devname): # is_connected isn't really as simple as that. 2 is # 'physically connected'. 3 is 'not connected'. but a wlan interface will @@ -393,6 +398,8 @@ def get_interfaces_by_mac(): continue if is_bridge(name): continue + if is_vlan(name): + continue mac = get_interface_mac(name) # some devices may not have a mac (tun0) if not mac: -- cgit v1.2.3