make vlan devices virtual to avoid avl tree issues with changing ifnames when bound...
[project/netifd.git] / vlan.c
diff --git a/vlan.c b/vlan.c
index 9a6e2b6..d1fb70b 100644 (file)
--- a/vlan.c
+++ b/vlan.c
@@ -106,7 +106,7 @@ static struct device *get_vlan_device(struct device *dev, int id, bool create)
        vldev = calloc(1, sizeof(*vldev));
        snprintf(vldev->dev.ifname, IFNAMSIZ, "%s.%d", dev->ifname, id);
 
-       device_init(&vldev->dev, &vlan_type, NULL);
+       device_init_virtual(&vldev->dev, &vlan_type, NULL);
        vldev->dev.default_config = true;
 
        vldev->set_state = vldev->dev.set_state;
@@ -145,7 +145,7 @@ struct device *get_vlan_device_chain(const char *ifname, bool create)
 
        s = split_vlan(buf);
        dev = device_get(buf, create);
-       if (!dev && !create)
+       if (!dev)
                goto error;
 
        do {