Commit e5a672bc authored by Jonas Höglund's avatar Jonas Höglund

Revert "Support setting interface mode for vlans"

This reverts commit c71d6bf1.
parent ec5a7a7d
......@@ -1382,30 +1382,17 @@ int system_vlan_del(struct device *dev)
int system_vlandev_add(struct device *vlandev, struct device *dev, struct vlandev_config *cfg)
{
char proto[20];
char cmd[256];
switch (cfg->proto) {
case VLAN_PROTO_UNTAGGED:
strcpy(proto, "untagged");
break;
case VLAN_PROTO_8021Q:
strcpy(proto, "8021q");
break;
case VLAN_PROTO_8021AD:
strcpy(proto, "8021ad");
break;
}
if(vlanconf_exists()) {
snprintf(cmd, 256,
"/sbin/vlanconf create --name %s --ifname %s --type %s \
--vlan-id %d --priority %d --inner-vlan-id %d --inner-priority %d --dscp %d \
--unicast-mode %s --multicast-mode %s",
vlandev->ifname, dev->ifname, proto,
cfg->vid, cfg->priority, cfg->inner_vid, cfg->inner_priority, cfg->dscp,
(cfg->ucmode == UNICAST_MODE_TRANS) ? "trans":"reg",
(cfg->mcmode == MULTICAST_MODE_ONT) ? "ont":"rg");
char cmd[256];
if (cfg->proto == VLAN_PROTO_UNTAGGED)
snprintf(cmd, 256, "/sbin/vlanconf create --name %s --ifname %s --type untagged", vlandev->ifname, dev->ifname);
else
snprintf(cmd, 256,
"/sbin/vlanconf create --name %s --ifname %s --type %s \
--vlan-id %d --priority %d \
--inner-vlan-id %d --inner-priority %d --dscp %d",
vlandev->ifname, dev->ifname, (cfg->proto == VLAN_PROTO_8021AD)?"8021ad":"8021q",
cfg->vid, cfg->priority, cfg->inner_vid, cfg->inner_priority, cfg->dscp);
return system(cmd);
}
......
......@@ -159,17 +159,8 @@ enum vlan_proto {
VLAN_PROTO_8021AD = 0x88A8
};
enum iface_mode {
MULTICAST_MODE_RG,
MULTICAST_MODE_ONT,
UNICAST_MODE_TRANS,
UNICAST_MODE_REG,
};
struct vlandev_config {
enum vlan_proto proto;
enum iface_mode ucmode;
enum iface_mode mcmode;
uint16_t vid;
uint16_t priority;
uint16_t inner_vid;
......
......@@ -27,8 +27,6 @@ enum {
VLANDEV_ATTR_INNER_VID,
VLANDEV_ATTR_INNER_PRIORITY,
VLANDEV_ATTR_DSCP,
VLANDEV_ATTR_UCMODE,
VLANDEV_ATTR_MCMODE,
__VLANDEV_ATTR_MAX
};
......@@ -39,8 +37,6 @@ static const struct blobmsg_policy vlandev_attrs[__VLANDEV_ATTR_MAX] = {
[VLANDEV_ATTR_INNER_VID] = { "inner_vid", BLOBMSG_TYPE_INT32 },
[VLANDEV_ATTR_INNER_PRIORITY] = { "inner_priority", BLOBMSG_TYPE_INT32 },
[VLANDEV_ATTR_DSCP] = { "dscp", BLOBMSG_TYPE_INT32 },
[VLANDEV_ATTR_UCMODE] = { "ucmode", BLOBMSG_TYPE_STRING },
[VLANDEV_ATTR_MCMODE] = { "mcmode", BLOBMSG_TYPE_STRING },
};
static const struct uci_blob_param_list vlandev_attr_list = {
......@@ -54,11 +50,6 @@ static const struct uci_blob_param_list vlandev_attr_list = {
static struct device_type vlan8021q_device_type;
static struct device_type vlanuntagged_device_type;
const char ucmode_trans[] = "trans";
const char ucmode_reg[] = "reg";
const char mcmode_rg[] = "rg";
const char mcmode_ont[] = "ont";
void
vlandev_base_cb(struct device_user *dev, enum device_event ev)
{
......@@ -165,7 +156,6 @@ vlandev_apply_settings(struct vlandev_device *mvdev, struct blob_attr **tb)
{
struct vlandev_config *cfg = &mvdev->config;
struct blob_attr *cur;
const char *mode;
cfg->proto = (mvdev->dev.type == &vlan8021q_device_type) ?
VLAN_PROTO_8021Q : VLAN_PROTO_8021AD;
......@@ -189,24 +179,6 @@ vlandev_apply_settings(struct vlandev_device *mvdev, struct blob_attr **tb)
if ((cur = tb[VLANDEV_ATTR_DSCP]))
cfg->dscp = (uint16_t) blobmsg_get_u32(cur);
if ((cur = tb[VLANDEV_ATTR_UCMODE])) {
mode = blobmsg_get_string(tb[VLANDEV_ATTR_UCMODE]);
if (strncmp(mode, ucmode_trans, strlen(ucmode_trans)) == 0)
cfg->ucmode = UNICAST_MODE_TRANS;
else if (strncmp(mode, ucmode_reg, strlen(ucmode_reg)) == 0)
cfg->ucmode = UNICAST_MODE_REG;
}
if ((cur = tb[VLANDEV_ATTR_MCMODE])) {
mode = blobmsg_get_string(tb[VLANDEV_ATTR_MCMODE]);
if (strncmp(mode, mcmode_rg, strlen(mcmode_rg) == 0))
cfg->mcmode = MULTICAST_MODE_RG;
else if (strncmp(mode, mcmode_ont, strlen(mcmode_ont) == 0))
cfg->mcmode = MULTICAST_MODE_ONT;
}
}
static enum dev_change_type
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment