chiark / gitweb /
udev: add network link configuration tool
authorTom Gundersen <teg@jklm.no>
Fri, 25 Oct 2013 22:34:01 +0000 (00:34 +0200)
committerTom Gundersen <teg@jklm.no>
Sat, 26 Oct 2013 20:09:20 +0000 (22:09 +0200)
commitaf6f0d422c521374ee6a2dd92df5935a5a476ae5
treea6042b86dc3c90c97699e354946f8d3a43b4e5c4
parentca5c4105733ea439f89b0199cd3f92bc2f2a0b38
udev: add network link configuration tool

This tool applies hardware specific settings to network devices before they
are announced via libudev.

Settings that will probably eventually be supported are MTU, Speed,
DuplexMode, WakeOnLan, MACAddress, MACAddressPolicy (e.g., 'hardware',
'synthetic' or 'random'), Name and NamePolicy (replacing our current
interface naming logic). This patch only introduces support for
Description, as a proof of concept.

Some of these settings may later be overriden by a network management
daemon/script. However, these tools should always listen and wait on libudev
before touching a device (listening on netlink is not enough). This is no
different from how things used to be, as we always supported changing the
network interface name from udev rules, which does not work if someone
has already started using it.

The tool is configured by .link files in /etc/net/links/ (with the usual
overriding logic in /run and /lib). The first (in lexicographical order)
matching .link file is applied to a given device, and all others are ignored.

The .link files contain a [Match] section with (currently) the keys
MACAddress, Driver, Type (see DEVTYPE in udevadm info) and Path (this
matches on the stable device path as exposed as ID_PATH, and not the
unstable DEVPATH). A .link file matches a given device if all of the
specified keys do. Currently the keys are treated as plain strings,
but some limited globbing may later be added to the keys where it
makes sense.

Example:

/etc/net/links/50-wireless.link
[Match]
MACAddress=98:f2:e4:42:c6:92
Path=pci-0000:02:00.0-bcma-0
Type=wlan

[Link]
Description=The wireless link
Makefile.am
TODO
rules/85-net-configure-link.rules [new file with mode: 0644]
src/udev/net/.gitignore [new file with mode: 0644]
src/udev/net/Makefile [new symlink]
src/udev/net/link-config-gperf.gperf [new file with mode: 0644]
src/udev/net/link-config.c [new file with mode: 0644]
src/udev/net/link-config.h [new file with mode: 0644]
src/udev/udev-builtin-net_link.c [new file with mode: 0644]
src/udev/udev-builtin.c
src/udev/udev.h