mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Fix gw detection in some case
This commit is contained in:
		
							parent
							
								
									bc9915a2cf
								
							
						
					
					
						commit
						208a706c76
					
				
					 1 changed files with 12 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -159,15 +159,24 @@ while true; do
 | 
			
		|||
		if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
 | 
			
		||||
			OMR_TRACKER_DEVICE_GATEWAY=$(uci -q get "network.$OMR_TRACKER_INTERFACE.gateway")
 | 
			
		||||
		fi
 | 
			
		||||
		if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
 | 
			
		||||
		if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ "$OMR_TRACKER_DEVICE_GATEWAY" = "0.0.0.0" ]; then
 | 
			
		||||
			OMR_TRACKER_DEVICE_GATEWAY=$(ubus call network.interface.$OMR_TRACKER_INTERFACE status | jsonfilter -q -e '@.route[0].nexthop' | tr -d "\n")
 | 
			
		||||
		fi
 | 
			
		||||
		if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
 | 
			
		||||
		if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ "$OMR_TRACKER_DEVICE_GATEWAY" = "0.0.0.0" ]; then
 | 
			
		||||
			OMR_TRACKER_DEVICE_GATEWAY=$(ubus call network.interface.$OMR_TRACKER_INTERFACE status | jsonfilter -q -e '@.route[1].nexthop' | tr -d "\n")
 | 
			
		||||
		fi
 | 
			
		||||
		if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ "$OMR_TRACKER_DEVICE_GATEWAY" = "0.0.0.0" ]; then
 | 
			
		||||
			OMR_TRACKER_DEVICE_GATEWAY=$(ubus call network.interface.$OMR_TRACKER_INTERFACE status | jsonfilter -q -e '@.inactive.route[0].nexthop' | tr -d "\n")
 | 
			
		||||
		fi
 | 
			
		||||
		if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
 | 
			
		||||
		if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ "$OMR_TRACKER_DEVICE_GATEWAY" = "0.0.0.0" ]; then
 | 
			
		||||
			OMR_TRACKER_DEVICE_GATEWAY=$(ubus call network.interface.$OMR_TRACKER_INTERFACE status | jsonfilter -q -e '@.inactive.route[1].nexthop' | tr -d "\n")
 | 
			
		||||
		fi
 | 
			
		||||
		if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ "$OMR_TRACKER_DEVICE_GATEWAY" = "0.0.0.0" ]; then
 | 
			
		||||
			OMR_TRACKER_DEVICE_GATEWAY=$(ubus call network.interface.${OMR_TRACKER_INTERFACE}_4 status 2>/dev/null | jsonfilter -q -e '@.inactive.route[0].nexthop' | tr -d "\n")
 | 
			
		||||
		fi
 | 
			
		||||
		if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ "$OMR_TRACKER_DEVICE_GATEWAY" = "0.0.0.0" ]; then
 | 
			
		||||
			OMR_TRACKER_DEVICE_GATEWAY=$(ubus call network.interface.${OMR_TRACKER_INTERFACE}_4 status 2>/dev/null | jsonfilter -q -e '@.inactive.route[1].nexthop' | tr -d "\n")
 | 
			
		||||
		fi
 | 
			
		||||
 | 
			
		||||
		# execute specific tracker
 | 
			
		||||
		if [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue