diff options
author | Felix Fietkau <nbd@openwrt.org> | 2014-10-20 22:07:18 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-10-20 22:07:20 +0200 |
commit | 5a4eb870afc69e9fa93fdccb8a42f75e8e357f4e (patch) | |
tree | 894f3c5937cf1f8941f0121f75c6dc283cce2bec | |
parent | fd7d5b43d85b2e3bb2eee98644bca833c6202048 (diff) |
device: make link status detection optional for vlan devices
Fixes a race condition that triggers endless link loss / detect calls
when VLAN devices are created.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r-- | device.h | 2 | ||||
-rw-r--r-- | macvlan.c | 1 | ||||
-rw-r--r-- | system-linux.c | 3 | ||||
-rw-r--r-- | vlan.c | 1 | ||||
-rw-r--r-- | vlandev.c | 1 |
5 files changed, 7 insertions, 1 deletions
@@ -47,6 +47,8 @@ struct device_type { struct list_head list; const char *name; + bool keep_link_status; + const struct uci_blob_param_list *config_params; struct device *(*create)(const char *name, struct blob_attr *attr); @@ -258,6 +258,7 @@ macvlan_create(const char *name, struct blob_attr *attr) const struct device_type macvlan_device_type = { .name = "MAC VLAN", .config_params = &macvlan_attr_list, + .keep_link_status = true, .create = macvlan_create, .config_init = macvlan_config_init, diff --git a/system-linux.c b/system-linux.c index 7955cec..7ae9e27 100644 --- a/system-linux.c +++ b/system-linux.c @@ -322,7 +322,8 @@ static int cb_rtnl_event(struct nl_msg *msg, void *arg) goto out; device_set_ifindex(dev, ifi->ifi_index); - device_set_link(dev, ifi->ifi_flags & IFF_LOWER_UP ? true : false); + if (!dev->type->keep_link_status) + device_set_link(dev, ifi->ifi_flags & IFF_LOWER_UP ? true : false); out: return 0; @@ -102,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; @@ -246,6 +246,7 @@ vlandev_create(const char *name, struct blob_attr *attr) const struct device_type vlandev_device_type = { .name = "VLANDEV", .config_params = &vlandev_attr_list, + .keep_link_status = true, .create = vlandev_create, .config_init = vlandev_config_init, |