diff options
author | Florian Eckert <fe@dev.tdt.de> | 2018-05-09 13:13:20 +0200 |
---|---|---|
committer | Florian Eckert <fe@dev.tdt.de> | 2018-05-09 14:19:58 +0200 |
commit | f50de419592d58160f15a04978b0de6e94b854fb (patch) | |
tree | d99ae65d64a0e6b9dc66f2d58f992d4a6dce0fa4 /applications/luci-app-mwan3 | |
parent | e4f77ace8b4fe9fd4c5d73e604eb1b8c6b480ed8 (diff) |
luci-app-mwan3: honor dynamic interface to get gateway ip
If a logical interface setup and adds in the protocol handler a dynamic
interface then the gateway is configured in the dynamic interface and the
setting up logical interface does not have a gateway specified.
To fix this check first if a dynamic interface is present and use this
gateway ip if found and if no dynamich interface is set then check for a
gateway in the logical interface.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Diffstat (limited to 'applications/luci-app-mwan3')
-rw-r--r-- | applications/luci-app-mwan3/luasrc/controller/mwan3.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua index d5fc4a3ed..01e40d994 100644 --- a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua +++ b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua @@ -114,8 +114,14 @@ function diagnosticsData(interface, task) end function get_gateway(inteface) - local dump = require("luci.util").ubus("network.interface.%s" % interface, "status", {}) - local gateway + local gateway = nil + local dump = nil + + dump = require("luci.util").ubus("network.interface.%s_4" % interface, "status", {}) + if not dump then + dump = require("luci.util").ubus("network.interface.%s" % interface, "status", {}) + end + if dump and dump.route then local _, route for _, route in ipairs(dump.route) do |