diff options
author | Kay Sievers <kay@vrfy.org> | 2013-01-08 14:54:12 +0100 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2013-01-08 14:54:12 +0100 |
commit | 72bc96f07868d532596477604b6fb41633ebd124 (patch) | |
tree | edfd7d094aca0f82c1437577c3c8e3955147ba95 /src | |
parent | dee4c244254bb49d1ffa8bd7171ae9cce596d2d0 (diff) |
udev: net_id - skip stacked network devices
Diffstat (limited to 'src')
-rw-r--r-- | src/udev/udev-builtin-net_id.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index d5db762e80..1975c6d62c 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -366,6 +366,7 @@ static int ieee_oui(struct udev_device *dev, struct netnames *names, bool test) static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool test) { const char *s; + const char *p; unsigned int i; const char *devtype; const char *prefix = "en"; @@ -380,6 +381,16 @@ static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool if (i != 1) return 0; + /* skip stacked devices, like VLANs, ... */ + s = udev_device_get_sysattr_value(dev, "ifindex"); + if (!s) + return EXIT_FAILURE; + p = udev_device_get_sysattr_value(dev, "iflink"); + if (!p) + return EXIT_FAILURE; + if (strcmp(s, p) != 0) + return 0; + devtype = udev_device_get_devtype(dev); if (devtype) { if (streq("wlan", devtype)) |