[Bug 1235162] Re: Persistent net names via /etc/udev/rules.d/70-persistent-net.rules are ignored

TJ ubuntu at iam.tj
Sat Oct 5 12:50:43 UTC 2013


The issue seems to be triggered by the code in src/udev/udev-
event.c::rename_netif()

static int rename_netif(struct udev_event *event)
{
        struct udev_device *dev = event->dev;
        int sk;
        struct ifreq ifr;
        int err;

        log_debug("changing net interface name from '%s' to '%s'\n",
                  udev_device_get_sysname(dev), event->name);

        sk = socket(PF_INET, SOCK_DGRAM, 0);
        if (sk < 0) {
                err = -errno;
                log_error("error opening socket: %m\n");
                return err;
        }

        memset(&ifr, 0x00, sizeof(struct ifreq));
        strscpy(ifr.ifr_name, IFNAMSIZ, udev_device_get_sysname(dev));
        strscpy(ifr.ifr_newname, IFNAMSIZ, event->name);
        err = ioctl(sk, SIOCSIFNAME, &ifr);
        if (err >= 0) {
                print_kmsg("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname);
        } else {
                err = -errno;
                log_error("error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname);
        }
        close(sk);
        return err;
}

It seems as if the call to ioctl(sk, SIOCSIFNAME, &ifr) returns error
code -EEXIST (17, 0x11)).

$ man 7 netdevice | grep -A 2 SIOCSIFNAME
       SIOCSIFNAME
              Changes  the  name  of the interface specified in ifr_name to ifr_newname.  This is a privileged operation.  It is
              only allowed when the interface is not up.

"It is only allowed when the interface is not up" but the dmesg log
shows that the IPv6 protocol is already up on those interfaces

[ 19.251979] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 19.251985] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[ 19.251990] IPv6: ADDRCONF(NETDEV_UP): eth2: link is not ready
[ 19.251995] IPv6: ADDRCONF(NETDEV_UP): eth3: link is not ready
[ 19.251999] IPv6: ADDRCONF(NETDEV_UP): eth4: link is not ready
[ 22.029079] systemd-udevd[1348]: error changing net interface name eth2 to eth1: File exists

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1235162

Title:
  Persistent net names via /etc/udev/rules.d/70-persistent-net.rules are
  ignored

Status in “systemd” package in Ubuntu:
  New

Bug description:
  systemd-udev 204.

  Installing 13.10 amd64 on a multi-homed server. There are 5 ethernet
  interfaces, one on the mobo and four on a PCIe adapter.

  udev created "/etc/udev/rules.d/70-persistent-net.rules" and I later
  edited the NAME= assignments to match the device naming required.

  These rules are being ignored and I can't find any indication as to
  why.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1235162/+subscriptions



More information about the foundations-bugs mailing list