mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Use traceroute to get gateway in final case
This commit is contained in:
		
							parent
							
								
									eb5f7c03e9
								
							
						
					
					
						commit
						85ba3b7c19
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -128,6 +128,9 @@ interface_multipath_settings() {
 | 
			
		|||
		if [ -z "$gateway" ] || [ "$( valid_subnet4 $gateway )" != "ok" ]; then 
 | 
			
		||||
			gateway=$(ubus call network.interface.${config}_4 status 2>/dev/null | jsonfilter -q -l 1 -e '@.route[@.target="0.0.0.0"].nexthop' | tr -d "\n")
 | 
			
		||||
		fi
 | 
			
		||||
		if [ -z "$gateway" ] || [ "$( valid_subnet4 $gateway )" != "ok" ]; then
 | 
			
		||||
			gateway=$(traceroute -m1 -i $iface 8.8.8.8 2>/dev/null | awk 'FNR==2{ print $2 }')
 | 
			
		||||
		fi
 | 
			
		||||
		network_get_subnet netmask $config
 | 
			
		||||
		[ -n "$netmask" ] && [ "$(echo $netmask | grep '/')" != "" ] && netmask=""
 | 
			
		||||
		[ -z "$netmask" ] && netmask=$(ip -4 addr show dev $iface | grep peer | awk '{print $4}' | cut -d/ -f2 | tr -d "\n")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue