add prelocal table to manipulate locally destinated traffic
[project/netifd.git] / vlan.c
diff --git a/vlan.c b/vlan.c
index 9201979..354e12f 100644 (file)
--- a/vlan.c
+++ b/vlan.c
@@ -50,7 +50,7 @@ static int vlan_set_device_state(struct device *dev, bool up)
        }
 
        ret = device_claim(&vldev->dep);
-       if (ret)
+       if (ret < 0)
                return ret;
 
        system_vlan_add(vldev->dep.dev, vldev->id);
@@ -88,6 +88,10 @@ static void vlan_dev_cb(struct device_user *dep, enum device_event ev)
                vlan_dev_set_name(vldev, dep->dev);
                device_broadcast_event(&vldev->dev, ev);
                break;
+       case DEV_EVENT_TOPO_CHANGE:
+               /* Propagate topo changes */
+               device_broadcast_event(&vldev->dev, DEV_EVENT_TOPO_CHANGE);
+               break;
        default:
                break;
        }
@@ -98,6 +102,7 @@ static struct device *get_vlan_device(struct device *dev, int id, bool create)
        static const struct device_type vlan_type = {
                .name = "VLAN",
                .config_params = &device_attr_list,
+               .keep_link_status = true,
                .free = free_vlan_if,
        };
        struct vlan_device *vldev;