From f60abe38fb6f833246f6d2b69001697e13ae08bc Mon Sep 17 00:00:00 2001
From: Rahul <rahul.thakur@iopsys.eu>
Date: Tue, 23 Mar 2021 18:04:59 +0530
Subject: [PATCH] iopsys-brcm63xx-arm: fix untagged bridge behaviour

I am satisfied now that the regression test failure is not software
issues, scripts need to be looked at in isolation
---
 iopsys-brcm63xx-arm/base-files/sbin/vlanconf | 33 ++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/iopsys-brcm63xx-arm/base-files/sbin/vlanconf b/iopsys-brcm63xx-arm/base-files/sbin/vlanconf
index 2ba68bcba..b20681b08 100755
--- a/iopsys-brcm63xx-arm/base-files/sbin/vlanconf
+++ b/iopsys-brcm63xx-arm/base-files/sbin/vlanconf
@@ -167,6 +167,13 @@ vlanCtl_cmdConfigDscp2PbitMap()
 	vlanctl --if $1 --cfg-dscp2pbits $2 $3
 }
 
+vlanCtl_filterOnEtherType()
+{
+#	_v "vlanctl --filter-ethertype $ETHERTYPE"
+#	vlanctl --filter-ethertype $ETHERTYPE"
+	TAGRULE="$TAGRULE --filter-ethertype $1"
+}
+
 vlanCtl_filterOnPbit()
 {
 #	_v "vlanctl --filter-pbits $PRIORITY $TAGINDEX"
@@ -504,6 +511,32 @@ create_vlan() {
 		vlanCtl_setReceiveVlanDevice $NAME
 
 		if [ $BRIDGED -eq 1 ]; then
+			# filter tagged and double tagged packets on untagged interface,
+			# else the bridge is as good as transparent
+			vlanCtl_filterOnEtherType "0x8100"
+			vlanCtl_cmdDropFrame
+
+			# Set rule to the top of rx tag rule table-1 to drop tagged packets
+			DIRECTION="rx"
+			TAGS=1
+			POSITION="rule-insert-before"
+			TAGRULEID="-1"
+			vlanCtl_insertTagRule $IFNAME $DIRECTION $TAGS $POSITION $TAGRULEID
+
+			vlanCtl_initTagRule
+			vlanCtl_setReceiveVlanDevice $NAME
+			vlanCtl_filterOnEtherType "0x88A8"
+			vlanCtl_cmdDropFrame
+
+			# Set rule to the top of rx tag rule table-2 to drop double tagged packets
+			DIRECTION="rx"
+			TAGS=2
+			POSITION="rule-insert-before"
+			TAGRULEID="-1"
+			vlanCtl_insertTagRule $IFNAME $DIRECTION $TAGS $POSITION $TAGRULEID
+
+			vlanCtl_initTagRule
+			vlanCtl_setReceiveVlanDevice $NAME
 			# Insert the vlan header into the frame and forward if its
 			# a L2 bridge else, unconditionally forward to the rx vlan
 			# interface
-- 
GitLab