mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-29 01:22:25 +00:00
ipq807x: cig.wf186w: Add MPSK Dynamic VLAN support
When a MPSK VLAN netdev is created on the cig.wf186w board, this script will configure switch0 via swconfig for the corresponding VLAN Signed-off-by: Paul White <paul@shasta.cloud>
This commit is contained in:
40
feeds/ipq807x/ipq807x/base-files/etc/hotplug.d/net/50-dvlan
Normal file
40
feeds/ipq807x/ipq807x/base-files/etc/hotplug.d/net/50-dvlan
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
debug() {
|
||||
logger -t HOTPLUG-DVLAN "$*"
|
||||
}
|
||||
|
||||
if [ "${INTERFACE:0:4}" != "wlan" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$(board_name)" in
|
||||
"cig,wf186w")
|
||||
wan_iface="eth0"
|
||||
switch_dev="switch0"
|
||||
switch_wan_port=4
|
||||
switch_cpu_port=6
|
||||
;;
|
||||
|
||||
*)
|
||||
exit 0
|
||||
esac
|
||||
|
||||
VSTR="$(echo $INTERFACE | egrep -o 'v([0-9]+)$')"
|
||||
[ -z "$VSTR" ] && exit 0
|
||||
VID="${VSTR:1}"
|
||||
[ $VID -lt 1 -o $VID -gt 4096 ] && exit 0
|
||||
|
||||
if [ "$ACTION" = "add" ]; then
|
||||
debug "[$INTERFACE] Dynamic VLAN $VID added, configuring switch"
|
||||
swconfig dev ${switch_dev} vlan $VID set ports "${switch_wan_port}t ${switch_cpu_port}t"
|
||||
elif [ "$ACTION" = "remove" ]; then
|
||||
let cnt="$(bridge vlan show vid $VID | egrep "^wlan" | wc -l)"
|
||||
debug "[$INTERFACE] Dynamic VLAN interface removed, references left = $cnt"
|
||||
if [ $cnt -eq 0 ]; then
|
||||
debug "[$INTERFACE] No more references, removing $VID from switch"
|
||||
swconfig dev ${switch_dev} vlan $VID set ports ""
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user