Bug 71293

Summary: Do not rename p2p network interfaces
Product: systemd Reporter: David Herrmann <dh.herrmann>
Component: generalAssignee: Tom Gundersen <teg>
Status: RESOLVED NOTOURBUG QA Contact: systemd-bugs
Severity: normal    
Priority: medium CC: dh.herrmann, radek
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description David Herrmann 2013-11-06 09:34:50 UTC
Hi

Wifi-P2P creates temporary devices for every P2P connection that is established. The kernel rule seems to be:
  if: wlan0
  p2p: p2p-wlan0-$num
So interface names are prefixed with "p2p" and suffixed with a unique number (starting at 0 and counting). Note that afaics $num is never decreased for a given interface (except on overflow) so the name is really unique for a single interface. Once the interface gets hotplugged, it starts at 0 again.

Note that p2p interfaces are siblings of the parent interface, not children. Like this:
lrwxrwxrwx 1 root root 0 Nov  6 10:31 p2p-wlan0-0 -> ../../devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/net/p2p-wlan0-0
lrwxrwxrwx 1 root root 0 Nov  6 10:31 wlan0 -> ../../devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/net/wlan0

This causes udev to try to rename the device to the same name as the real interface. udev shouldn't do that. In fact, if the real interface was already renamed, the p2p interface will pick up the name.

My proposed solution is to never rename devices that start with "p2p-". Comments?
I have no idea how to match interface-names in udev, so couldn't provide a patch, yet.

David
Comment 1 Kay Sievers 2013-11-06 12:57:34 UTC
Hmm, we should probably not try to be smart with kernel names coming in, they
are passed by tools, and can be any name the tool writer likes.

What might work more reliably is a sysfs attribute like:
  /sys/class/net/wlp3s0/name_assign_type

which indicates:
  - kernel-allocated name (plain enumerated names by drivers)
  - userspace passed-in at creation time (tools asked for that)
  - userspace renamed name (not a kernel name anymore)

The udev would only grab the first one to rename.
Comment 2 David Herrmann 2014-03-27 17:38:29 UTC
Just for completeness, if anyone cares, this is being worked on upstream [1]. I have local patches for udev and push it once the attribute is available in net-next.

[1] http://patchwork.ozlabs.org/project/netdev/list/?submitter=23807
Comment 3 Tom Gundersen 2014-08-19 16:07:16 UTC
Another update: the basic infrastructure is now in the kernel, and udev will use this. However, the patch for hooking this up for P2P in the kernel is not yet upstream. Will do that this cycle.
Comment 4 David Herrmann 2014-11-21 15:22:12 UTC
We pushed the infrastructure into the kernel. It's now up to the wifi daemons to make sure they implement P2P correctly. I'm not going to fix wpa_supplicant. If others set up devices correctly, this will not be a problem for Wifi-P2P.

Regardless of P2P, it's not our bug, so let wifi people deal with it. We pushed the core infrastructure into the kernel, so our job is more than done.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.