mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Check if mac address are not duplicated
This commit is contained in:
		
							parent
							
								
									67d14971b5
								
							
						
					
					
						commit
						5c68e7063a
					
				
					 1 changed files with 17 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -39,6 +39,13 @@ global_multipath_settings() {
 | 
			
		|||
	[ -z "$mptcp_ndiffports_num_subflows" ] || sysctl -qw /sys/module/mptcp_ndiffports/parameters/num_subflows="$mptcp_ndiffports_num_subflows"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface_macaddr_count() {
 | 
			
		||||
	local intf="$1"
 | 
			
		||||
	local dmacaddr="$2"
 | 
			
		||||
	config_get macaddr "$intf" macaddr
 | 
			
		||||
	[ "$macaddr" = "$dmacaddr" ] && nbmac=$((nbmac+1))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface_multipath_settings() {
 | 
			
		||||
	local mode iface proto
 | 
			
		||||
	local config="$1"
 | 
			
		||||
| 
						 | 
				
			
			@ -88,6 +95,16 @@ interface_multipath_settings() {
 | 
			
		|||
	uci -q set openmptcprouter.${config}="interface"
 | 
			
		||||
	uci -q set openmptcprouter.${config}.multipath="$mode"
 | 
			
		||||
 | 
			
		||||
	config_get macaddr "$config" macaddr ""
 | 
			
		||||
	[ -n "$maccaddr" ] && {
 | 
			
		||||
		nbmac=0
 | 
			
		||||
		config_foreach interface_macaddr_count interface $macaddr
 | 
			
		||||
		[ "$nbmac" != "1" ] && {
 | 
			
		||||
			logger -t "MPTCP" "Duplicate MAC saved, removing"
 | 
			
		||||
			uci -q delete network.${config}.macaddr
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	[ "$enabled" = "0" ] && return 0
 | 
			
		||||
	[ -n "$intf" ] && [ "$iface" != "$intf" ] && return 0
 | 
			
		||||
	[ -z "$iface" ] && return 0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue