diff --git a/iopsys-brcm63xx-arm/base-files/sbin/vlanconf b/iopsys-brcm63xx-arm/base-files/sbin/vlanconf index 66b1a42db0d89773ab4f5e75c17dd9deb13cef3c..90f7e64df0859fd8800571ca062bad2e588b07da 100755 --- a/iopsys-brcm63xx-arm/base-files/sbin/vlanconf +++ b/iopsys-brcm63xx-arm/base-files/sbin/vlanconf @@ -11,6 +11,7 @@ MACADDR="" TYPE="8021q" PRIORITY=0 VLANID=1 +TVLANID=0 ROUTED=1 BRIDGED=0 UNMANAGED=0 @@ -242,13 +243,12 @@ create_vlan() { vlanCtl_cmdPushVlanTag # If type is 8021ad, push inner tag. [ $TYPE == "8021ad" ] && vlanCtl_cmdPushVlanTag + # Set pbits and vid in tag number 0, which is always the outer tag of the frame. # + TAGINDEX=0 + vlanCtl_cmdSetTagVid $VLANID $TAGINDEX + vlanCtl_cmdSetTagPbits $PRIORITY $TAGINDEX fi - # Set pbits and vid in tag number 0, which is always the outer tag of the frame. # - TAGINDEX=0 - vlanCtl_cmdSetTagVid $VLANID $TAGINDEX - vlanCtl_cmdSetTagPbits $PRIORITY $TAGINDEX - if [ $TYPE == "8021ad" ]; then # If type is 8021ad, push inner tag. TAGINDEX=1 @@ -267,6 +267,15 @@ create_vlan() { TAGRULEID="-1" vlanCtl_insertTagRule $IFNAME $DIRECTION $TAGS $POSITION $TAGRULEID + # If translation is enabled on this interface, modify outgoing VLAN ID + if [ $TVLANID -ne 0 ]; then + TAGINDEX=0 + vlanCtl_cmdSetTagVid $VLANID $TAGINDEX + vlanCtl_cmdSetTagPbits $PRIORITY $TAGINDEX + TAGS=1 + vlanCtl_insertTagRule $IFNAME $DIRECTION $TAGS $POSITION $TAGRULEID + fi + # ======== Set rx rules ======== # # Note: Always set bridge interface rx rules at the bottom of the tables @@ -287,7 +296,13 @@ create_vlan() { TAGINDEX=1 [ $TYPE == "8021ad" ] && vlanCtl_filterOnTagVid $INNER_VLANID $TAGINDEX - # Do not pop the vlan tag in case of bridged interface + # If VLAN translated vlan id is configured, then on ingress, + # write the translated vlan id into the header + if [ $TVLANID -ne 0 ]; then + TAGINDEX=0 + vlanCtl_cmdSetTagVid $TVLANID $TAGINDEX + + fi # Append this rule to the bottom of rx tag rule table-1 and table-2 # using VLANCTL_POSITION_APPEND. @@ -361,14 +376,12 @@ create_vlan() { # Set rule to the top of tx tag rule table-0, table-1 and table-2. DIRECTION="tx" - TAGS=0 + TAGS=1 POSITION="rule-insert-before" TAGRULEID="-1" vlanCtl_insertTagRule $IFNAME $DIRECTION $TAGS $POSITION $TAGRULEID if [ $BRIDGED -eq 1 ]; then - TAGS=1 - vlanCtl_insertTagRule $IFNAME $DIRECTION $TAGS $POSITION $TAGRULEID TAGS=2 vlanCtl_insertTagRule $IFNAME $DIRECTION $TAGS $POSITION $TAGRULEID fi @@ -381,17 +394,25 @@ create_vlan() { vlanCtl_setReceiveVlanDevice $NAME if [ $BRIDGED -eq 1 ]; then - # Insert the vlan header into the frame and forward - vlanCtl_cmdPushVlanTag - TAGINDEX=0 - vlanCtl_cmdSetTagVid $VLANID $TAGINDEX - vlanCtl_cmdSetTagPbits $PRIORITY $TAGINDEX - # Set rule to the top of tx tag rule table-0, table-1 and table-2. # + # Insert the vlan header into the frame and forward if its + # a L2 bridge else, unconditionally forward to the rx vlan + # interface + if [ $UNMANAGED -eq 1 ]; then + vlanCtl_cmdPushVlanTag + TAGINDEX=0 + vlanCtl_cmdSetTagVid $VLANID $TAGINDEX + vlanCtl_cmdSetTagPbits $PRIORITY $TAGINDEX + fi + DIRECTION="rx" TAGS=0 POSITION="rule-insert-last" TAGRULEID="" vlanCtl_insertTagRule $IFNAME $DIRECTION $TAGS $POSITION $TAGRULEID + TAGS=1 + vlanCtl_insertTagRule $IFNAME $DIRECTION $TAGS $POSITION $TAGRULEID + TAGS=2 + vlanCtl_insertTagRule $IFNAME $DIRECTION $TAGS $POSITION $TAGRULEID else # Filter on receive interface and not allow for multicast. # If hit, drop the frame. @@ -517,6 +538,7 @@ while [ -n "$2" ]; do -t|--type) TYPE="$3"; shift;; -p|--priority) PRIORITY="$3"; shift;; -v|--vlan-id) VLANID="$3"; shift;; + --translated-vlan-id) TVLANID="$3"; shift;; --inner-vlan-id) INNER_VLANID="$3"; shift;; --inner-priority) INNER_PRIORITY="$3"; shift;; --dscp) DSCP="$3"; shift;;