[LEDE-DEV] [PATCH netifd 6/7] vlandev: Rework 8021ad/8021q detection based on vlandevice type
Hans Dedecker
dedeckeh at gmail.com
Fri Sep 23 06:08:22 PDT 2016
Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
vlandev.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/vlandev.c b/vlandev.c
index b065c27..7e46251 100644
--- a/vlandev.c
+++ b/vlandev.c
@@ -20,14 +20,12 @@
#include "system.h"
enum {
- VLANDEV_ATTR_TYPE,
VLANDEV_ATTR_IFNAME,
VLANDEV_ATTR_VID,
__VLANDEV_ATTR_MAX
};
static const struct blobmsg_policy vlandev_attrs[__VLANDEV_ATTR_MAX] = {
- [VLANDEV_ATTR_TYPE] = { "type", BLOBMSG_TYPE_STRING },
[VLANDEV_ATTR_IFNAME] = { "ifname", BLOBMSG_TYPE_STRING },
[VLANDEV_ATTR_VID] = { "vid", BLOBMSG_TYPE_INT32 },
};
@@ -40,6 +38,8 @@ static const struct uci_blob_param_list vlandev_attr_list = {
.next = { &device_attr_list },
};
+static struct device_type vlan8021q_device_type;
+
struct vlandev_device {
struct device dev;
struct device_user parent;
@@ -158,15 +158,10 @@ vlandev_apply_settings(struct vlandev_device *mvdev, struct blob_attr **tb)
struct vlandev_config *cfg = &mvdev->config;
struct blob_attr *cur;
- cfg->proto = VLAN_PROTO_8021Q;
+ cfg->proto = (mvdev->dev.type == &vlan8021q_device_type) ?
+ VLAN_PROTO_8021Q : VLAN_PROTO_8021AD;
cfg->vid = 1;
- if ((cur = tb[VLANDEV_ATTR_TYPE]))
- {
- if(!strcmp(blobmsg_data(cur), "8021ad"))
- cfg->proto = VLAN_PROTO_8021AD;
- }
-
if ((cur = tb[VLANDEV_ATTR_VID]))
cfg->vid = (uint16_t) blobmsg_get_u32(cur);
}
--
1.9.1
More information about the Lede-dev
mailing list