udev: net_setup - allow matching on OriginalName=

This has been requested repeatedly, so let's give it a go. We explicitly do not allow matching
on names that have already been changed (from a previous udev run, or otherwise), and matching
on unpredictable names (ethX) is discouraged (but not currently disallowed).

We also currently allow:

[Match]
Name=veth0

[Link]
Name=my-name0
SomeOtherSetting=true

Which means that the link file will be applied the first time it is invoked, but
not on subsequent invocations, which may be surprising.
This commit is contained in:
Tom Gundersen
2014-12-04 18:53:47 +01:00
parent 03e8fdb346
commit 7eb08da4b3
8 changed files with 55 additions and 23 deletions
+1 -1
View File
@@ -654,7 +654,7 @@ static int netdev_load_one(Manager *manager, const char *filename) {
if (net_match_config(NULL, NULL, NULL, NULL, NULL,
netdev_raw->match_host, netdev_raw->match_virt,
netdev_raw->match_kernel, netdev_raw->match_arch,
NULL, NULL, NULL, NULL, NULL, NULL) <= 0)
NULL, NULL, NULL, NULL, NULL, NULL, false) <= 0)
return 0;
if (!NETDEV_VTABLE(netdev_raw)) {
+1 -1
View File
@@ -216,7 +216,7 @@ int network_get(Manager *manager, struct udev_device *device,
udev_device_get_driver(udev_device_get_parent(device)),
udev_device_get_property_value(device, "ID_NET_DRIVER"),
udev_device_get_devtype(device),
ifname)) {
ifname, false)) {
log_debug("%-*s: found matching network '%s'", IFNAMSIZ, ifname,
network->filename);
*ret = network;