← Back to team overview

kernel-packages team mailing list archive

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

 

Following "ioctl(sk, SIOCSIFNAME, &ifr)" through the kernel:

net/core/dev_ioctl::dev_ioctl()
 net/core/dev_ioctl.c::dev_ifsioc()
  net/core/dev.c::dev_change_name()
   net/core/dev.c::dev_get_valid_name()
    net/core/dev.c::__dev_get_by_name()


struct net_device *dev_get_by_name_rcu(struct net *net, const char *name)
{
        struct net_device *dev;
        struct hlist_head *head = dev_name_hash(net, name);

        hlist_for_each_entry_rcu(dev, head, name_hlist)
                if (!strncmp(dev->name, name, IFNAMSIZ))
                        return dev;

        return NULL;
}

static int dev_get_valid_name(struct net *net,
                              struct net_device *dev,
                              const char *name)
{
        BUG_ON(!net);

        if (!dev_valid_name(name))
                return -EINVAL;

        if (strchr(name, '%'))
                return dev_alloc_name_ns(net, dev, name);
        else if (__dev_get_by_name(net, name))
                return -EEXIST;
        else if (dev->name != name)
                strlcpy(dev->name, name, IFNAMSIZ);

        return 0;
}

So this seems to be where the IOCTL error originates, but there needs to
be an explanation.

Looking at the 'git damage' and commit history for 'net/core/dev.c' in
particular there are some control-group related changes that look like
they may be implicated. They certainly seem to be in the appropriate
time-frame since earlier kernels don't have the problem (I have another
server with 12.04 LTS and Linux 3.2.0 which has 10 Ethernet ports which
are renamed correctly).


** Also affects: linux (Ubuntu)
   Importance: Undecided
       Status: New

** Summary changed:

- Persistent net names via /etc/udev/rules.d/70-persistent-net.rules are ignored
+ Persistent net names via /etc/udev/rules.d/70-persistent-net.rules fail

** Description changed:

  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.
+ These rules are apparently ignored but it transpires that the kernel is
+ returning -EEXIST from net/core/dev.c::dev_get_valid_name().
+ 
+ This renaming works in earlier versions, specifically on a 12.04 LTS
+ server with ten Ethernet interfaces, and is therefore a regression.

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

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

Status in “linux” package in Ubuntu:
  New
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 apparently ignored but it transpires that the kernel
  is returning -EEXIST from net/core/dev.c::dev_get_valid_name().

  This renaming works in earlier versions, specifically on a 12.04 LTS
  server with ten Ethernet interfaces, and is therefore a regression.

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