mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 02:17:58 +00:00 
			
		
		
		
	 179d1b5770
			
		
	
	179d1b5770
	
	
	
		
			
			* add support for port mirroring * lagcp will be housed within this package aswell in future Signed-off-by: John Crispin <john@phrozen.org>
		
			
				
	
	
		
			24 lines
		
	
	
		
			579 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			579 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/sh
 | |
| 
 | |
| . /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
 | |
| 
 | |
| 	ifconfig $analysis up
 | |
| 	for port in $monitor; do
 | |
| 		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
 | |
| 	done
 | |
| }
 | |
| 
 | |
| port_mirror
 |