switch-fabric: fix port mirroring

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2023-11-14 11:00:06 +01:00
parent 2f5b612837
commit 04f10325a1
4 changed files with 9 additions and 11 deletions

View File

@@ -3,20 +3,17 @@
. /lib/functions.sh
port_mirror() {
for lan in $(ls -d /sys/class/net/lan* | cut -dn -f3 |sort -n); do
tc qdisc del dev lan$lan clsact
done
monitor=$(uci get switch.mirror.monitor)
analysis=$(uci get switch.mirror.analysis)
[ -n "$monitor" -a -n "$analysis" ] || return
tc qdisc del dev $analysis clsact
ifconfig $analysis up
for port in $monitor; do
tc qdisc del dev $port clsact
tc qdisc add dev $port clsact
tc filter add dev $port ingress matchall skip_sw action mirred egress mirror dev $analysis
tc filter add dev $port egress matchall skip_sw action mirred egress mirror dev $analysis
tc filter add dev $port ingress matchall action mirred egress mirror dev $analysis
tc filter add dev $port egress matchall action mirred egress mirror dev $analysis
done
}