mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Better max metric calculation
This commit is contained in:
		
							parent
							
								
									b50578d4a2
								
							
						
					
					
						commit
						ed7c5dae44
					
				
					 1 changed files with 23 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -48,13 +48,29 @@ interface_macaddr_count() {
 | 
			
		|||
 | 
			
		||||
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
 | 
			
		||||
	if [ "$1" != "omrvpn" ] && [ "$1" != "omr6in4" ]; then
 | 
			
		||||
		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
 | 
			
		||||
	elif [ "$1" = "omrvpn" ]; then
 | 
			
		||||
		uci -q batch <<-EOF >/dev/null
 | 
			
		||||
			set network.${config}.metric=1200
 | 
			
		||||
			commit network
 | 
			
		||||
			set openmptcprouter.${config}.metric=1200
 | 
			
		||||
			commit openmptcprouter
 | 
			
		||||
		EOF
 | 
			
		||||
	elif [ "$1" = "omr6in4" ]; then
 | 
			
		||||
		uci -q batch <<-EOF >/dev/null
 | 
			
		||||
			set network.${config}.metric=1201
 | 
			
		||||
			commit network
 | 
			
		||||
			set openmptcprouter.${config}.metric=1201
 | 
			
		||||
			commit openmptcprouter
 | 
			
		||||
		EOF
 | 
			
		||||
	fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue