device: look up full device name before traversing vlan chain
authorFelix Fietkau <nbd@nbd.name>
Mon, 27 Jul 2020 11:27:52 +0000 (13:27 +0200)
committerFelix Fietkau <nbd@nbd.name>
Mon, 27 Jul 2020 11:27:53 +0000 (13:27 +0200)
The user may have configured a VLAN device with explicit settings and the same
name by adding a config device section

Signed-off-by: Felix Fietkau <nbd@nbd.name>
device.c

index 5e3a74149c021650355d67e393d900a2db207bc4..e484c0970b14c07777b0a7f05f26cc8093d4fc31 100644 (file)
--- a/device.c
+++ b/device.c
@@ -572,13 +572,14 @@ device_get(const char *name, int create)
 {
        struct device *dev;
 
-       if (strchr(name, '.'))
+       dev = avl_find_element(&devices, name, dev, avl);
+
+       if (!dev && strchr(name, '.'))
                return get_vlan_device_chain(name, create);
 
        if (name[0] == '@')
                return device_alias_get(name + 1);
 
-       dev = avl_find_element(&devices, name, dev, avl);
        if (dev) {
                if (create > 1 && !dev->external) {
                        system_if_apply_settings(dev, &dev->settings, dev->settings.flags);