Hello, seems that on some systems (in our cases s390x) a dual
port network device, is named ens11 and ens11d1 which doesn't exactly
looks normal (not sure if this in on purpose or not)

udevadm info -a -p /sys/class/net/ens11 | grep dev_id
    ATTR{dev_id}=="0x0"
udevadm info -a -p /sys/class/net/ens11d1 | grep dev_id
    ATTR{dev_id}=="0x1"

Seems that in src/udev/udev-builtin-net_id.c:201 we don't use dev_id,
if dev_id = 0.

Again, checking the idea in the header of udev-builtin-net_id.c, the
logic should be:

en (ethernet), s <slot>, f <function>, d <dev_id>, but is not specified
that dev_id is not use if dev_id = 0.

The logic should be ens11d0 and ens11d1, at least according to how it
is explained.

I've attached the patch which fixes this issue, if this is not really a
bug, then ignore the mail :)


-- 
Robert Milasan

L3 Support Engineer
SUSE Linux (http://www.suse.com)
email: [email protected]
GPG fingerprint: B6FE F4A8 0FA3 3040 3402  6FE7 2F64 167C 1909 6D1A
>From bc159a64961fc222f36139c8990f581d139f420d Mon Sep 17 00:00:00 2001
From: Robert Milasan <[email protected]>
Date: Mon, 5 May 2014 14:25:49 +0200
Subject: [PATCH] Use dev_id for network devices even if dev_id equals zero

Signed-off-by: Robert Milasan <[email protected]>
---
 src/udev/udev-builtin-net_id.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index c80c30a..e141774 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -198,7 +198,7 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) {
         l = strpcpyf(&s, l, "p%ds%d", bus, slot);
         if (func > 0 || is_pci_multifunction(names->pcidev))
                 l = strpcpyf(&s, l, "f%d", func);
-        if (dev_id > 0)
+        if (dev_id >= 0)
                 l = strpcpyf(&s, l, "d%d", dev_id);
         if (l == 0)
                 names->pci_path[0] = '\0';
-- 
1.8.4.5

_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to