mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Network update: remove support for untagged vlan
This commit is contained in:
parent
d10bc99924
commit
1b55211c8a
5 changed files with 11 additions and 93 deletions
|
|
@ -1224,7 +1224,6 @@ static int handle_inner_vid(void)
|
|||
char *cur_vid = NULL;
|
||||
|
||||
cur_vid = fetch_and_configure_inner_vid(br_inst, "8021q", "");
|
||||
cur_vid = (!cur_vid) ? fetch_and_configure_inner_vid(br_inst, "untagged", "") : NULL;
|
||||
|
||||
//loop device section with type 8021ad and fetch the br_inst of it,
|
||||
//if same br_inst then add vid as inner_vid
|
||||
|
|
@ -1270,12 +1269,10 @@ static int configure_device_type(const struct bridge_port_args *data, char *type
|
|||
char *cur_vid = NULL;
|
||||
|
||||
cur_vid = fetch_and_configure_inner_vid(data->br_inst, "8021q", "");
|
||||
cur_vid = (!cur_vid) ? fetch_and_configure_inner_vid(data->br_inst, "untagged", "") : NULL;
|
||||
|
||||
//apply the vid of the interface as the inner_vid of 8021ad port
|
||||
if (cur_vid != NULL && cur_vid[0] != '\0')
|
||||
dmuci_set_value_by_section(data->bridge_port_sec, "inner_vid", cur_vid);
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2408,7 +2405,7 @@ static int set_BridgingBridgePort_DefaultUserPriority(char *refparam, struct dmc
|
|||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct bridge_port_args *)data)->bridge_port_sec, "type", &type);
|
||||
if (DM_STRLEN(type) == 0 || (DM_LSTRCMP(type, "untagged") != 0 && DM_LSTRCMP(type, "8021q") != 0))
|
||||
if (DM_STRLEN(type) == 0 || DM_LSTRCMP(type, "8021q") != 0)
|
||||
return FAULT_9007;
|
||||
|
||||
return 0;
|
||||
|
|
@ -2463,7 +2460,7 @@ static int set_BridgingBridgePort_PVID(char *refparam, struct dmctx *ctx, void *
|
|||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct bridge_port_args *)data)->bridge_port_sec, "type", &type);
|
||||
if (DM_STRLEN(type) == 0 || (DM_LSTRCMP(type, "untagged") != 0 && DM_LSTRCMP(type, "8021q") != 0))
|
||||
if (DM_STRLEN(type) == 0 || DM_LSTRCMP(type, "8021q") != 0)
|
||||
return FAULT_9007;
|
||||
|
||||
return 0;
|
||||
|
|
@ -2504,9 +2501,9 @@ static int get_BridgingBridgePort_TPID(char *refparam, struct dmctx *ctx, void *
|
|||
char *type = NULL;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct bridge_port_args *)data)->bridge_port_sec, "type", &type);
|
||||
if (type && (DM_LSTRCMP(type, "8021q") == 0 || DM_LSTRCMP(type, "untagged") == 0))
|
||||
if (DM_LSTRCMP(type, "8021q") == 0)
|
||||
*value = "33024";
|
||||
else if (type && DM_LSTRCMP(type, "8021ad") == 0)
|
||||
else if (DM_LSTRCMP(type, "8021ad") == 0)
|
||||
*value = "34984";
|
||||
else
|
||||
*value = "37120";
|
||||
|
|
@ -3083,7 +3080,7 @@ static int get_BridgingBridgeVLANPort_Untagged(char *refparam, struct dmctx *ctx
|
|||
{
|
||||
char *type;
|
||||
dmuci_get_value_by_section_string(((struct bridge_vlanport_args *)data)->bridge_vlanport_sec, "type", &type);
|
||||
*value = (DM_LSTRCMP(type, "untagged") == 0) ? "1" : "0";
|
||||
*value = (DM_STRLEN(type) == 0) ? "1" : "0";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -3098,7 +3095,7 @@ static int set_BridgingBridgeVLANPort_Untagged(char *refparam, struct dmctx *ctx
|
|||
return 0;
|
||||
case VALUESET:
|
||||
string_to_bool(value, &b);
|
||||
dmuci_set_value_by_section(((struct bridge_vlanport_args *)data)->bridge_vlanport_sec, "type", (b) ? "untagged" : "8021q");
|
||||
dmuci_set_value_by_section(((struct bridge_vlanport_args *)data)->bridge_vlanport_sec, "type", (!b) ? "8021q" : "");
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -314,7 +314,6 @@ static int browseEthernetVLANTerminationInst(struct dmctx *dmctx, DMNODE *parent
|
|||
dmuci_get_value_by_section_string(p->config_section, "name", &name);
|
||||
dmuci_get_value_by_section_string(p->dmmap_section, "is_vlan_ter", &is_vlan);
|
||||
if (DM_LSTRCMP(type, "bridge") == 0 ||
|
||||
DM_LSTRCMP(type, "untagged") == 0 ||
|
||||
(*name == 0 && DM_LSTRCMP(is_vlan, "1") != 0) ||
|
||||
(*name != 0 && !ethernet___check_vlan_termination_section(name)))
|
||||
continue;
|
||||
|
|
@ -483,7 +482,6 @@ static int delObjEthernetVLANTermination(char *refparam, struct dmctx *ctx, void
|
|||
dmuci_get_value_by_section_string(s_dev, "type", &type);
|
||||
dmuci_get_value_by_section_string(s_dev, "name", &name);
|
||||
if (DM_LSTRCMP(type, "bridge") == 0 ||
|
||||
DM_LSTRCMP(type, "untagged") == 0 ||
|
||||
(*name == 0 && DM_LSTRCMP(is_vlan, "1") != 0) ||
|
||||
(*name != 0 && !ethernet___check_vlan_termination_section(name)))
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -272,7 +272,6 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
dmuci_get_value_by_section_string(s, "name", &name);
|
||||
dmuci_get_value_by_section_string(s, "ifname", &ifname);
|
||||
if (DM_LSTRCMP(type, "bridge") == 0 ||
|
||||
DM_LSTRCMP(type, "untagged") == 0 ||
|
||||
(*name == 0 && DM_LSTRCMP(is_vlan, "1") != 0) ||
|
||||
(*name != 0 && !ethernet___check_vlan_termination_section(name)))
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -332,31 +332,6 @@ static int delete_ip_intertace_instance(struct uci_section *s)
|
|||
if (strcmp(section_name(int_ss), int_sec_name) != 0 && DM_STRCMP(int_device, buf) != 0)
|
||||
continue;
|
||||
|
||||
char *device = get_device( section_name(int_ss));
|
||||
|
||||
/* Remove the device section corresponding to this interface if exists and no interface used it
|
||||
And it doesn't link to Device.Bridging.Bridge. Object */
|
||||
if (device && *device && DM_LSTRNCMP(device, "br-", 3) != 0) {
|
||||
bool device_found = false;
|
||||
|
||||
uci_foreach_sections("network", "interface", ss) {
|
||||
dmuci_get_value_by_section_string(ss, "device", &int_device);
|
||||
if (strcmp(section_name(ss), section_name(int_ss)) != 0 && DM_STRCMP(int_device, buf) != 0 && DM_STRSTR(int_device, device)) {
|
||||
device_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!device_found) {
|
||||
uci_foreach_option_eq_safe("network", "device", "name", device, stmp, ss) {
|
||||
char *device_type;
|
||||
dmuci_get_value_by_section_string(ss, "type", &device_type);
|
||||
if (DM_LSTRCMP(device_type, "untagged") == 0) dmuci_delete_by_section(ss, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* remove dmmap section related to this interface */
|
||||
get_dmmap_section_of_config_section("dmmap_network", "interface", section_name(int_ss), &ss);
|
||||
dmuci_delete_by_section(ss, NULL, NULL);
|
||||
|
|
@ -454,42 +429,6 @@ static bool interface_section_with_dhcpv6_exists(const char *sec_name)
|
|||
return false;
|
||||
}
|
||||
|
||||
static void set_ip_interface_device_option(struct uci_section *section, char *linker, char *instance, bool is_br_sec)
|
||||
{
|
||||
struct uci_section *s = NULL;
|
||||
bool device_exists = false;
|
||||
char int_device[64];
|
||||
|
||||
if (is_br_sec) {
|
||||
snprintf(int_device, sizeof(int_device), "%s", linker);
|
||||
goto end;
|
||||
} else {
|
||||
snprintf(int_device, sizeof(int_device), "%s.1", linker);
|
||||
}
|
||||
|
||||
// Check if device exists
|
||||
uci_foreach_option_eq("network", "device", "name", int_device, s) {
|
||||
device_exists = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// if device dosn't exist ==> create a new device section
|
||||
if (!device_exists) {
|
||||
char device_name[32];
|
||||
|
||||
snprintf(device_name, sizeof(device_name), "dev_ip_int_%s", instance);
|
||||
|
||||
dmuci_add_section("network", "device", &s);
|
||||
dmuci_rename_section_by_section(s, device_name);
|
||||
dmuci_set_value_by_section(s, "type", "untagged");
|
||||
dmuci_set_value_by_section(s, "ifname", linker);
|
||||
dmuci_set_value_by_section(s, "name", int_device);
|
||||
}
|
||||
|
||||
end:
|
||||
dmuci_set_value_by_section(section, "device", int_device);
|
||||
}
|
||||
|
||||
static int delObjIPInterfaceIPv6(void *data, unsigned char del_action, char *dmmap_file_name, char *section_type, char *option_name)
|
||||
{
|
||||
struct uci_section *s = NULL, *stmp = NULL, *dmmap_s = NULL;
|
||||
|
|
@ -1409,15 +1348,6 @@ static int set_IPInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *
|
|||
return 0;
|
||||
}
|
||||
|
||||
// Remove the device section corresponding to this interface if exists
|
||||
char *device = get_device(section_name((struct uci_section *)data));
|
||||
uci_foreach_option_eq_safe("network", "device", "name", device, stmp, s) {
|
||||
char *type;
|
||||
dmuci_get_value_by_section_string(s, "type", &type);
|
||||
if (DM_LSTRCMP(type, "untagged") == 0) dmuci_delete_by_section(s, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
char *mac_vlan = DM_STRCHR(linker_buf, '_');
|
||||
if (mac_vlan) {
|
||||
// Check if there is an interface that has the same ifname ==> if yes, remove it
|
||||
|
|
@ -1504,14 +1434,14 @@ static int set_IPInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *
|
|||
}
|
||||
}
|
||||
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "device", linker_buf);
|
||||
|
||||
// Check if the Ethernet.Link. maps to macvlan, if yes then keep only device name
|
||||
char *mac_vlan = DM_STRCHR(linker_buf, '_');
|
||||
if (!is_br_sec && mac_vlan) {
|
||||
*mac_vlan = 0;
|
||||
dmuci_set_value_by_section(eth_link_s, "device", linker_buf);
|
||||
}
|
||||
|
||||
set_ip_interface_device_option((struct uci_section *)data, linker_buf, instance, is_br_sec);
|
||||
}
|
||||
} else if (DM_STRNCMP(value, ppp_iface, DM_STRLEN(ppp_iface)) == 0) {
|
||||
struct uci_section *ppp_s = get_dup_section_in_dmmap_opt("dmmap_ppp", "interface", "name", linker_buf);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ config interface 'wan'
|
|||
option proto 'dhcp'
|
||||
option hostname 'iopsysWrt-44D43771B810'
|
||||
option vendorid 'eg400'
|
||||
option device 'eth0.1'
|
||||
option device 'eth0'
|
||||
option reqopts '12 43'
|
||||
option sendopts '60:iopsystest 61:iopsys'
|
||||
option macaddr '44:D4:37:71:B8:12'
|
||||
|
|
@ -38,12 +38,6 @@ config interface 'wan6'
|
|||
option proto 'dhcpv6'
|
||||
option device '@wan'
|
||||
|
||||
config device 'ethwan'
|
||||
option type 'untagged'
|
||||
option ifname 'eth0'
|
||||
option name 'eth0.1'
|
||||
option macaddr '44:D4:37:71:B8:12'
|
||||
|
||||
config device 'br_test_1'
|
||||
option name 'br-test'
|
||||
option type 'bridge'
|
||||
|
|
@ -60,13 +54,13 @@ config interface 'lan100'
|
|||
option macaddr '44:D4:37:71:B8:13'
|
||||
|
||||
config device 'eth1_100'
|
||||
option type 'untagged'
|
||||
option type '8021q'
|
||||
option ifname 'eth1'
|
||||
option name 'eth1.100'
|
||||
option vid '100'
|
||||
|
||||
config device 'eth2_100'
|
||||
option type 'untagged'
|
||||
option type '8021q'
|
||||
option ifname 'eth2'
|
||||
option name 'eth2.100'
|
||||
option vid '100'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue