summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2015-09-02 14:30:49 +0200
committerKay Sievers <kay@vrfy.org>2015-09-02 14:30:49 +0200
commitc069f477792bf78385ebdcaf1dc37ae57e0e8c88 (patch)
tree82ce79b0ccb141efd0cd88dcf0ed1b39b1305b29 /src
parent28bc259c01f82509462d2699ce7cc5b476439e3b (diff)
parent54683f0f9b97a8f88aaf4fbb45b4d729057b101c (diff)
Merge pull request #1119 from teg/virtio-names
udev: net_id - support predictable ifnames on virtio buses
Diffstat (limited to 'src')
-rw-r--r--src/udev/udev-builtin-net_id.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 6e7e1271fb..589f1f7822 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -280,8 +280,16 @@ static int names_pci(struct udev_device *dev, struct netnames *names) {
assert(names);
parent = udev_device_get_parent(dev);
+
+ /* there can only ever be one virtio bus per parent device, so we can
+ safely ignore any virtio buses. see
+ <http://lists.linuxfoundation.org/pipermail/virtualization/2015-August/030331.html> */
+ while (parent && streq_ptr("virtio", udev_device_get_subsystem(parent)))
+ parent = udev_device_get_parent(parent);
+
if (!parent)
return -ENOENT;
+
/* check if our direct parent is a PCI device with no other bus in-between */
if (streq_ptr("pci", udev_device_get_subsystem(parent))) {
names->type = NET_PCI;