From 83ff408cf9f42dd15e7cfaa6ce3972c7b710be3a Mon Sep 17 00:00:00 2001 From: Ycarus Date: Thu, 3 Jan 2019 11:47:40 +0100 Subject: [PATCH] Fix gateway detection in status page --- .../luasrc/controller/openmptcprouter.lua | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua index 1b40f74a0..ae1fcbfa7 100644 --- a/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua +++ b/luci-app-openmptcprouter/luasrc/controller/openmptcprouter.lua @@ -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