<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>
      <blockquote type="cite"><font size="+1"><tt>Name            :
            systemd (commit c38499d476026d999558a7eee9c95ca2fa41e115</tt></font><font
          size="+1"><tt>)</tt><tt><br>
          </tt><tt>
            Version         : 239.2-1</tt></font></blockquote>
      I have a systemd.link file that gives my usb modem a more
      recognizable name. I saw some renaming errors in the journal and
      noticed that systemd also tried to rename my VPN device. This
      shouldn't happen and I investigated. Here's the result:</p>
    <p>It appears that the `50-usbmodem.link` file is being applied to
      the `tunvpn` device, even though the file has a MACAddress filter
      to match only the usbmodem.<br>
      <br>
      <br>
      I have the following file:<br>
    </p>
    <p>
      <blockquote type="cite"><font size="+1"><tt>/etc/systemd/network/50-usbmodem.link</tt><tt><br>
          </tt><tt><br>
          </tt><tt>[Match]</tt><tt><br>
          </tt><tt>MACAddress=aa:bb:cc:dd:ee:ff</tt><tt><br>
          </tt><tt><br>
          </tt><tt>[Link]</tt><tt><br>
          </tt><tt>Name=usbmodem</tt></font><br>
      </blockquote>
    </p>
    <p><br>
      And by running the following command, it can be seen that the
      problem really occurs.</p>
    <p>
      <blockquote type="cite"><font size="+1"><tt>$ udevadm test-builtin
            net_setup_link /sys/class/net/tunvpn/<br>
            <br>
            calling: test-builtin<br>
            Load module index<br>
            Parsed configuration file
            /etc/systemd/network/50-usbmodem.link<br>
            Created link configuration context.<br>
            ID_NET_DRIVER=tun<br>
            Config file /etc/systemd/network/50-usbmodem.link applies to
            device tunvpn<br>
            link_config: autonegotiation is unset or enabled, the speed
            and duplex are not writable.<br>
            ID_NET_LINK_FILE=/etc/systemd/network/50-usbmodem.link<br>
            ID_NET_NAME=usbmodem<br>
            Unload module index<br>
            Unloaded link configuration context.<br>
          </tt></font></blockquote>
      <br>
      The tun device has no ethernet address, as it's a L3 interface, so
      the MACAddress really really shouldn't match.
      <blockquote type="cite"><font size="+1"><tt>$ ip link show tunvpn</tt><tt><br>
          </tt><tt>xx: tunvpn:
            <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500
            qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen
            100<br>
                link/none </tt><tt></tt></font><br>
      </blockquote>
    </p>
    <p><br>
      I fixed this temporarily by adding the following line to the
      [Match] section:</p>
    <p>
      <blockquote type="cite">Driver=huawei_cdc_ncm</blockquote>
      <br>
      I'm not entirely sure, but this appears to be a bug.</p>
    <p>Maybe relevant section: <a moz-do-not-send="true"
href="https://github.com/systemd/systemd/blob/c38499d476026d999558a7eee9c95ca2fa41e115/src/udev/net/link-config.c#L218">https://github.com/systemd/systemd/blob/c38499d476026d999558a7eee9c95ca2fa41e115/src/udev/net/link-config.c#L218</a><br>
    </p>
    <p><br>
    </p>
  </body>
</html>