1
0
Fork 0
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:
Ycarus 2019-01-03 11:47:40 +01:00
parent 42a8d0317c
commit 83ff408cf9

View file

@ -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