pt., 9 wrz 2022 o 04:32 LiXiong Liu <[email protected]> napisaĆ(a):
>
> ### swconfig & DSA VLAN Configuration Comparison
> Doesn't just support Tunnk on lan5,
> also need access to 192.168.1.1
> so must setting untagged at br-lan
>
> #switch-vlan
> config switch
> option name 'switch0'
> option reset '1'
> option enable_vlan '1'
>
> config switch_vlan
> option device 'switch0'
> option vlan '0'
> option vid '0'
> option ports '2 3 5 6'
>
> config switch_vlan
> option device 'switch0'
> option vlan '100'
> option vid '100'
> option ports '0 1 4t'
>
>
> #bridge-vlan
> config interface 'lan'
> option device 'br-lan'
> option proto 'static'
> option ipaddr '192.168.1.1'
> option netmask '255.255.255.0'
> option ip6assign '60'
> config device
> option name 'br-lan'
> option type 'bridge'
> list ports 'lan1'
> list ports 'lan2'
> list ports 'lan3'
> list ports 'lan4'
> list ports 'lan5'
>
> config bridge-vlan
> option device 'br-lan'
> option untagged '1'
> option vlan '1'
> list ports 'lan3'
> list ports 'lan4'
> list ports 'lan5'
>
> config bridge-vlan
> option device 'br-lan'
> option vlan '100'
> list ports 'lan1:u*'
> list ports 'lan1:u*'
> list ports 'lan5:t'
>
> #bridge vlan show
> port vlan-id
> lan1 100 PVID Egress Untagged
> lan2 100 PVID Egress Untagged
> lan3 1 PVID Egress Untagged
> lan4 1 PVID Egress Untagged
> lan5 1 PVID Egress Untagged
> 10
> br-lan 1 PVID Egress Untagged
> 10
>
We are using smth like this:
config bridge-vlan 'vlan1'
option name 'vlan1'
option device 'br-lan'
option vlan '1'
option flags 'untagged pvid'
option local '1'
list ports 'eth2:*'
list ports 'eth3:*'
And attached patch - not sure what is best. For sure any option to set
self br config looks good.
BR
Janusz
--- a/bridge.c
+++ b/bridge.c
@@ -233,7 +233,7 @@ bridge_set_local_vlan(struct bridge_stat
if (!vlan->local && add)
return;
- system_bridge_vlan(bst->dev.ifname, vlan->vid, add, BRVLAN_F_SELF);
+ system_bridge_vlan(bst->dev.ifname, vlan->vid, add, vlan->local_flags | BRVLAN_F_SELF);
}
static void
@@ -951,6 +951,7 @@ bridge_dump_vlan(struct blob_buf *b, str
blobmsg_add_u32(b, "id", vlan->vid);
blobmsg_add_u8(b, "local", vlan->local);
+ blobmsg_add_u32(b, "local_flags", vlan->local_flags);
p = blobmsg_open_array(b, "ports");
--- a/device.h
+++ b/device.h
@@ -293,6 +293,7 @@ struct bridge_vlan {
uint16_t vid;
bool local;
+ enum bridge_vlan_flags local_flags;
bool pending;
};
--- a/config.c
+++ b/config.c
@@ -312,6 +312,7 @@ config_parse_vlan(struct device *dev, st
enum {
BRVLAN_ATTR_VID,
BRVLAN_ATTR_LOCAL,
+ BRVLAN_ATTR_FLAGS,
BRVLAN_ATTR_PORTS,
BRVLAN_ATTR_ALIAS,
__BRVLAN_ATTR_MAX,
@@ -319,6 +320,7 @@ config_parse_vlan(struct device *dev, st
static const struct blobmsg_policy vlan_attrs[__BRVLAN_ATTR_MAX] = {
[BRVLAN_ATTR_VID] = { "vlan", BLOBMSG_TYPE_INT32 },
[BRVLAN_ATTR_LOCAL] = { "local", BLOBMSG_TYPE_BOOL },
+ [BRVLAN_ATTR_FLAGS] = { "flags", BLOBMSG_TYPE_STRING },
[BRVLAN_ATTR_PORTS] = { "ports", BLOBMSG_TYPE_ARRAY },
[BRVLAN_ATTR_ALIAS] = { "alias", BLOBMSG_TYPE_ARRAY },
};
@@ -338,6 +340,7 @@ config_parse_vlan(struct device *dev, st
unsigned int vid;
const char *val;
char *name_buf;
+ char *local_flags;
int name_len = 0;
int n_ports = 0;
int rem;
@@ -371,6 +374,15 @@ config_parse_vlan(struct device *dev, st
if (tb[BRVLAN_ATTR_LOCAL])
vlan->local = blobmsg_get_bool(tb[BRVLAN_ATTR_LOCAL]);
+ if (tb[BRVLAN_ATTR_FLAGS]) {
+ local_flags = blobmsg_get_string(tb[BRVLAN_ATTR_FLAGS]);
+
+ if (strstr(local_flags, "pvid"))
+ vlan->local_flags |= BRVLAN_F_PVID;
+ if (strstr(local_flags, "untagged"))
+ vlan->local_flags |= BRVLAN_F_UNTAGGED;
+ }
+
vlan->n_ports = n_ports;
vlan->ports = port = (struct bridge_vlan_port *)&vlan[1];
INIT_LIST_HEAD(&vlan->hotplug_ports);
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel