Fix detection of predictable network interface names
authorMichael Prokop <mika@grml.org>
Fri, 31 May 2019 14:41:50 +0000 (16:41 +0200)
committerMichael Prokop <mika@grml.org>
Fri, 31 May 2019 15:32:13 +0000 (17:32 +0200)
commit2860f131b65664467209350e16f39f75b7b27af0
treec385cc4b723aea5d2cc19b0cba7acbbf3dc47474
parent7e1e9b8dbdcf2ad71aff50ffdb032eb9df8a9e64
Fix detection of predictable network interface names

E.g. virtio drivers might have the properties ID_NET_NAME_PATH=enp0s18
and ID_NET_NAME_SLOT=ens18. If we check only for ID_NET_NAME_PATH, then
we end up with a network configuration for enp0s18, while the actual
network interface name will be ens18.

So instead look at all present network devices, iterate over them
(ignoring the virtual interfaces like bridges + vboxnet) and
check for present ID_NET_NAME_* settings, using the following precedence
(as defined in link_config_apply() of systemd/src/udev/net/link-config.c):

* ID_NET_NAME_FROM_DATABASE
* ID_NET_NAME_ONBOARD
* ID_NET_NAME_SLOT
* ID_NET_NAME_PATH
* ID_NET_NAME_MAC

Closes: #929810
grml-debootstrap