Bug 85440 - Ordering of .link files is inverted
Summary: Ordering of .link files is inverted
Status: RESOLVED NOTABUG
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Tom Gundersen
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-25 14:11 UTC by Vincent Bernat
Modified: 2015-01-06 06:56 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
udev: fix ordering of .link files (2.05 KB, text/plain)
2014-10-25 14:11 UTC, Vincent Bernat
Details

Description Vincent Bernat 2014-10-25 14:11:11 UTC
Created attachment 108391 [details]
udev: fix ordering of .link files

Hi!

Whatever I put in /etc/systemd/network, udev is still only using /lib/systemd/network/99-default.link. I am using systemd-215 from Debian but this is still true for the one in git. See:

$ udevadm test-builtin net_setup_link /sys/class/net/lan
calling: test-builtin
load module index
timestamp of '/etc/systemd/network' changed
timestamp of '/lib/systemd/network' changed
Parsed configuration file /etc/systemd/network/wlan.link
Parsed configuration file /etc/systemd/network/lan.link
Parsed configuration file /lib/systemd/network/99-default.link
Created link configuration context.
ID_NET_DRIVER=e1000e
Config file /lib/systemd/network/99-default.link applies to device lan
ID_NET_NAME=eno1
unload module index
Unloaded link configuration context.

My lan.link should match. When I apply the attached patch, the issue is fixed.
Comment 1 Tom Gundersen 2014-12-09 08:26:47 UTC
Thanks for the report and the patch. This is indeed annoying.

The issue is that numbers are sorted before letters (regular strcmp()), a workaround is to rename your custom link files to 50-lan.link and 50-wlan.link.

I
Comment 2 Vincent Bernat 2014-12-09 09:32:35 UTC
Independantly of the ordering of letters and numbers, the ordering seem to be inverted. "wlan.link" is ordered before "lan.link".
Comment 3 Zbigniew Jedrzejewski-Szmek 2015-01-06 05:15:36 UTC
According to the man page: "The first (in lexical order) of the link files that matches a given device is applied."

Using your example of wlan.link, lan.link, and 99-default.link, lexographical sorting is 99-default.link, lan.link, wlan.link. Assuming they all match, 99-default.link wins.
Comment 4 Vincent Bernat 2015-01-06 06:56:57 UTC
Yes, you are right, I was confused by the output of udevadm.


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.