1
0
This repository has been archived on 2025-01-10. You can view files and clone it, but cannot push or open issues or pull requests.
alacn1_pace_v5471/squashfs-root/bin/bcm53125_portbasedvlanctl
Anderson Luiz Alves 0464e230c1 stock 103961
2017-07-30 16:48:04 -03:00

52 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
# /bin/igmpctl $1
# $1 or $ARG = del or add
SWITCHNAME=${1:-}
ACCESSTYPE=${2:-}
ACTION=${3:-}
PORTS=${4:-}
if [ "${ARG:-}" = '' ]; then
. /etc/bewan/init.d/setparam
fi
NAME="bcm53125_portbasedvlanctl"
DEFAULTPORTMAP=0x1FF
CPUPORT=8
local port
case "$ACTION" in
del)
base_log "${NAME} : restoring default port-based vlan map for all ports" debug
for port in 0 1 2 3 4
do
switchctl $SWITCHNAME $ACCESSTYPE -S P${port}_VLAN_FORWARD_MASK=$DEFAULTPORTMAP
done
;;
add)
base_log "${NAME} : new port-based VLAN with ports $PORTS" debug
# Compute portmap
local portmask=0
for port in `strip $PORTS`
do
portmask=$(($portmask + (1 << $port)))
done
# Add CPU port
portmask=$(($portmask + (1 << $CPUPORT)))
# Write new portmap in register
for port in `strip $PORTS`
do
switchctl $SWITCHNAME $ACCESSTYPE -S P${port}_VLAN_FORWARD_MASK=$portmask
done
;;
*)
base_log "${NAME} : undefined action!" debug
;;
esac