mirror of
				https://github.com/Ysurac/openmptcprouter-feeds.git
				synced 2025-03-09 15:40:03 +00:00 
			
		
		
		
	Check Multipath status only if gateway up
This commit is contained in:
		
							parent
							
								
									848bb74e16
								
							
						
					
					
						commit
						af13d7f2c9
					
				
					 2 changed files with 18 additions and 18 deletions
				
			
		| 
						 | 
				
			
			@ -383,7 +383,7 @@ function interfaces_status()
 | 
			
		|||
		local tracker_ip = uci:get("shadowsocks-libev","tracker","local_address") or ""
 | 
			
		||||
		local tracker_port = uci:get("shadowsocks-libev","tracker","local_port")
 | 
			
		||||
		if tracker_ip ~= "" then
 | 
			
		||||
			mArray.openmptcprouter["ss_addr"] = sys.exec("curl -s -4 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m 5 http://ip.openmptcprouter.com")
 | 
			
		||||
			mArray.openmptcprouter["ss_addr"] = sys.exec("curl -s -4 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m 3 http://ip.openmptcprouter.com")
 | 
			
		||||
		else
 | 
			
		||||
			mArray.openmptcprouter["ss_addr"] = ""
 | 
			
		||||
		end
 | 
			
		||||
| 
						 | 
				
			
			@ -519,20 +519,6 @@ function interfaces_status()
 | 
			
		|||
		    connectivity = 'ERROR'
 | 
			
		||||
	    end
 | 
			
		||||
 | 
			
		||||
	    if mArray.openmptcprouter["dns"] == true then
 | 
			
		||||
		    -- Test if multipath can work on the connection
 | 
			
		||||
		    local multipath_available
 | 
			
		||||
		    local multipath_available_state = ut.trim(sys.exec("omr-mptcp-intf " .. ifname .. " | grep 'Nay, Nay, Nay'"))
 | 
			
		||||
		    if multipath_available_state == "" then
 | 
			
		||||
			multipath_available = 'OK'
 | 
			
		||||
		    else
 | 
			
		||||
			multipath_available = 'ERROR'
 | 
			
		||||
		    end
 | 
			
		||||
	    else
 | 
			
		||||
		multipath_available = 'NO CHECK'
 | 
			
		||||
	    end
 | 
			
		||||
	    
 | 
			
		||||
 | 
			
		||||
	    -- Detect WAN gateway status
 | 
			
		||||
	    local gw_ping = 'UP'
 | 
			
		||||
	    if gateway == "" then
 | 
			
		||||
| 
						 | 
				
			
			@ -554,6 +540,20 @@ function interfaces_status()
 | 
			
		|||
	    if gateway == "" then
 | 
			
		||||
		    connectivity = 'ERROR'
 | 
			
		||||
	    end
 | 
			
		||||
 | 
			
		||||
	    if mArray.openmptcprouter["dns"] == true and ifname ~= "" and gateway ~= "" and gw_ping == "UP" then
 | 
			
		||||
		    -- Test if multipath can work on the connection
 | 
			
		||||
		    local multipath_available
 | 
			
		||||
		    local multipath_available_state = ut.trim(sys.exec("omr-mptcp-intf " .. ifname .. " | grep 'Nay, Nay, Nay'"))
 | 
			
		||||
		    if multipath_available_state == "" then
 | 
			
		||||
			multipath_available = 'OK'
 | 
			
		||||
		    else
 | 
			
		||||
			multipath_available = 'ERROR'
 | 
			
		||||
		    end
 | 
			
		||||
	    else
 | 
			
		||||
		multipath_available = 'NO CHECK'
 | 
			
		||||
	    end
 | 
			
		||||
 | 
			
		||||
	    
 | 
			
		||||
	    -- Detect if WAN get an IPv6
 | 
			
		||||
	    local ipv6_discover = 'NONE'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,10 +1,10 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
uci -q batch <<-EOF >/dev/null
 | 
			
		||||
	add_list dhcp.dnsmasq.ipset='/multipath-tcp.org/ss_rules_dst_bypass'
 | 
			
		||||
	add_list dhcp.@dnsmasq[-1].ipset='/multipath-tcp.org/ss_rules_dst_bypass'
 | 
			
		||||
	commit dhcp
 | 
			
		||||
EOF
 | 
			
		||||
curl -s -4 -m 5 --interface $1 http://www.multipath-tcp.org
 | 
			
		||||
curl -s -4 -m 3 --interface $1 http://www.multipath-tcp.org
 | 
			
		||||
uci -q batch <<-EOF >/dev/null
 | 
			
		||||
	del_list dhcp.dnsmasq.ipset='/multipath-tcp.org/ss_rules_dst_bypass'
 | 
			
		||||
	del_list dhcp.@dnsmasq[-1].ipset='/multipath-tcp.org/ss_rules_dst_bypass'
 | 
			
		||||
	commit dhcp
 | 
			
		||||
EOF
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue