Crash on TUN / no MAC address interface

Bug #1913274 reported by RaveNoX
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
netplan
New
Undecided
Unassigned

Bug Description

"netplan apply" crashes if there's TUN interface or interface with no MAC address in system and "macaddress" matching used in configuration.

I ran into this problem with OpenVPN TUN interface.

Traceback:
Traceback (most recent call last):
  File "/usr/sbin/netplan", line 23, in <module>
    netplan.main()
  File "/usr/share/netplan/netplan/cli/core.py", line 50, in main
    self.run_command()
  File "/usr/share/netplan/netplan/cli/utils.py", line 257, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 55, in run
    self.run_command()
  File "/usr/share/netplan/netplan/cli/utils.py", line 257, in run_command
    self.func()
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 187, in command_apply
    changes = NetplanApply.process_link_changes(devices, config_manager)
  File "/usr/share/netplan/netplan/cli/commands/apply.py", line 283, in process_link_changes
    current_iface_name = utils.find_matching_iface(interfaces, match)
  File "/usr/share/netplan/netplan/cli/utils.py", line 199, in find_matching_iface
    matches = list(filter(lambda iface: is_interface_matching_macaddress(iface, match.get('macaddress')), matches))
  File "/usr/share/netplan/netplan/cli/utils.py", line 199, in <lambda>
    matches = list(filter(lambda iface: is_interface_matching_macaddress(iface, match.get('macaddress')), matches))
  File "/usr/share/netplan/netplan/cli/utils.py", line 185, in is_interface_matching_macaddress
    macaddress = get_interface_macaddress(interface)
  File "/usr/share/netplan/netplan/cli/utils.py", line 169, in get_interface_macaddress
    link = netifaces.ifaddresses(interface)[netifaces.AF_LINK][0]
KeyError: 17

Ubuntu 20.04
netplan.io = 0.101-0ubuntu3~20.04.2 / amd64

Some remark: OpenVPN TUN interface is not configured using netplan, it is just presents on the system

Netplan config:
network:
  version: 2
  renderer: networkd
  ethernets:
    lan:
        addresses:
        - 192.168.0.1/24
        match:
            macaddress: ac:1f:6b:9d:47:08
        nameservers:
            addresses:
            - 127.0.0.1
            search:
            - example.net
            - office.example.net
        set-name: lan
    wan:
        addresses:
        - X.X.X.X/27
        gateway4: Y.Y.Y.Y
        match:
            macaddress: ac:1f:6b:9d:47:0b
        optional: true
        routes:
        - to: Z.Z.Z.Z
            via: A.A.A.A
        set-name: wan

  bridges:
    dmz:
        addresses:
        - 192.168.254.1/24
        interfaces: []
        optional: true
        parameters:
            forward-delay: 0
            stp: false
    docker:
        addresses:
        - 192.168.110.1/24
        interfaces: []
        optional: true
        parameters:
            forward-delay: 0
            stp: false
    svc:
        addresses:
        - 192.168.111.1/24
        interfaces: []
        optional: true
        parameters:
            forward-delay: 0
            stp: false
    vms:
        addresses:
        - 192.168.100.1/24
        interfaces: []
        optional: true
        parameters:
            forward-delay: 0
            stp: false

Revision history for this message
Adrian (psilocyborg) wrote :

Duplicate of: https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/1913062
Looks like they patched it there.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.