mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Fix gateway detection in status page
This commit is contained in:
parent
42a8d0317c
commit
83ff408cf9
1 changed files with 20 additions and 0 deletions
|
@ -577,6 +577,16 @@ function get_gateway(interface)
|
|||
end
|
||||
end
|
||||
end
|
||||
if gateway == "" then
|
||||
if dump and dump.inactive.route then
|
||||
local _, route
|
||||
for _, route in ipairs(dump.inactive.route) do
|
||||
if dump.inactive.route[_].target == "0.0.0.0" then
|
||||
gateway = dump.inactive.route[_].nexthop
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if gateway == "" then
|
||||
dump = require("luci.util").ubus("network.interface.%s_4" % interface, "status", {})
|
||||
|
@ -589,6 +599,16 @@ function get_gateway(interface)
|
|||
end
|
||||
end
|
||||
end
|
||||
if gateway == "" then
|
||||
if dump and dump.inactive.route then
|
||||
local _, route
|
||||
for _, route in ipairs(dump.inactive.route) do
|
||||
if dump.inactive.route[_].target == "0.0.0.0" then
|
||||
gateway = dump.inactive.route[_].nexthop
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return gateway
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue