summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--device.h2
-rw-r--r--macvlan.c1
-rw-r--r--system-linux.c3
-rw-r--r--vlan.c1
-rw-r--r--vlandev.c1
5 files changed, 7 insertions, 1 deletions
diff --git a/device.h b/device.h
index 73b2656..adf72c5 100644
--- a/device.h
+++ b/device.h
@@ -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);
diff --git a/macvlan.c b/macvlan.c
index e5a4891..019a7ff 100644
--- a/macvlan.c
+++ b/macvlan.c
@@ -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;
diff --git a/vlan.c b/vlan.c
index 28b1441..354e12f 100644
--- a/vlan.c
+++ b/vlan.c
@@ -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;
diff --git a/vlandev.c b/vlandev.c
index 36a5c63..7b2038e 100644
--- a/vlandev.c
+++ b/vlandev.c
@@ -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,