diff options
author | Dimitri John Ledkov <xnox@ubuntu.com> | 2017-04-20 11:08:48 +0100 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-04-20 14:56:52 -0400 |
commit | df4ca453520342a0541ab9202305858bf39d4f48 (patch) | |
tree | 0169443f30db2f99f336d5bf53c7d875b43541ea /cloudinit | |
parent | 169a7105a25a27ee894af63cd8b5bcc3ded6fd2e (diff) | |
download | vyos-cloud-init-df4ca453520342a0541ab9202305858bf39d4f48.tar.gz vyos-cloud-init-df4ca453520342a0541ab9202305858bf39d4f48.zip |
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
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/net/__init__.py | 7 |
1 files changed, 7 insertions, 0 deletions
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: |