mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Fix metric and txqueuelen
This commit is contained in:
		
							parent
							
								
									701c0339de
								
							
						
					
					
						commit
						34caf3ee14
					
				
					 1 changed files with 29 additions and 11 deletions
				
			
		| 
						 | 
				
			
			@ -46,25 +46,39 @@ interface_macaddr_count() {
 | 
			
		|||
	[ "$macaddr" = "$dmacaddr" ] && nbmac=$((nbmac+1))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface_max_metric() {
 | 
			
		||||
	local config="$1"
 | 
			
		||||
	config_get metric "$config" metric
 | 
			
		||||
	if [ "$metric" = "$count" ]; then
 | 
			
		||||
		count=$((count+1))
 | 
			
		||||
		config_set "$config" metric $count
 | 
			
		||||
	fi
 | 
			
		||||
	if [ "$metric" -gt "$count" ]; then
 | 
			
		||||
		count=$metric
 | 
			
		||||
	fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
interface_multipath_settings() {
 | 
			
		||||
	local mode iface proto
 | 
			
		||||
	local mode iface proto metric
 | 
			
		||||
	local config="$1"
 | 
			
		||||
	local intf="$2"
 | 
			
		||||
	local enabled
 | 
			
		||||
 | 
			
		||||
	config_get enabled "$config" auto "1"
 | 
			
		||||
	config_get iface "$config" ifname
 | 
			
		||||
	config_get txqueuelen "$config" txqueuelen
 | 
			
		||||
	[ -z "$iface" ] && iface=$(ifstatus "$config" | jsonfilter -q -e '@["l3_device"]')
 | 
			
		||||
	if [ "$(uci -q get openmptcprouter.${config}.metric)" = "" ]; then
 | 
			
		||||
		count=$(($count+1))
 | 
			
		||||
		count=$((count+1))
 | 
			
		||||
		metric=$count
 | 
			
		||||
	else
 | 
			
		||||
		count="$(uci -q get openmptcprouter.${config}.metric)"
 | 
			
		||||
		metric="$(uci -q get openmptcprouter.${config}.metric)"
 | 
			
		||||
	fi
 | 
			
		||||
	config_set "$config" metric $count
 | 
			
		||||
	uci -q set network.${config}.metric=$count
 | 
			
		||||
	uci -q set openmptcprouter.${config}.metric=$count
 | 
			
		||||
	config_set "$config" metric $metric
 | 
			
		||||
	uci -q set network.${config}.metric=$metric
 | 
			
		||||
	uci -q set openmptcprouter.${config}.metric=$metric
 | 
			
		||||
	config_get mode "$config" multipath
 | 
			
		||||
	id=$count
 | 
			
		||||
	id=$metric
 | 
			
		||||
	[ "$mode" = "" ] && {
 | 
			
		||||
		mode="$(uci -q get openmptcprouter.${config}.multipath)"
 | 
			
		||||
		[ -n "$mode" ] && uci -q set network.${config}.multipath="$mode"
 | 
			
		||||
| 
						 | 
				
			
			@ -221,11 +235,11 @@ interface_multipath_settings() {
 | 
			
		|||
			#echo "ip route replace default via $gateway dev $iface"
 | 
			
		||||
			ip route replace default via $gateway dev $iface
 | 
			
		||||
		}
 | 
			
		||||
		[ "$mode" = "off" ] && {
 | 
			
		||||
			ifconfig $iface txqueuelen 50 > /dev/null 2>&1
 | 
			
		||||
		} || {
 | 
			
		||||
		if [ "$txqueuelen" != "" ]; then
 | 
			
		||||
			ifconfig $iface txqueuelen $txqueuelen > /dev/null 2>&1
 | 
			
		||||
		else
 | 
			
		||||
			ifconfig $iface txqueuelen 100 > /dev/null 2>&1
 | 
			
		||||
		}
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
	if [ "$(uci -q get openmptcprouter.settings.disable_ipv6)" != "1" ] && [ "$config" != "omr6in4" ]; then
 | 
			
		||||
		# IPv6 Updates:
 | 
			
		||||
| 
						 | 
				
			
			@ -398,6 +412,10 @@ start_service() {
 | 
			
		|||
 | 
			
		||||
	mptcpintf=""
 | 
			
		||||
	master=""
 | 
			
		||||
	count="0"
 | 
			
		||||
	config_load openmptcprouter
 | 
			
		||||
	config_foreach interface_max_metric interface
 | 
			
		||||
	
 | 
			
		||||
	config_load network
 | 
			
		||||
	#config_foreach remove route
 | 
			
		||||
	#config_foreach remove route6
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue