summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc/model/network.lua
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-base/luasrc/model/network.lua')
-rw-r--r--modules/luci-base/luasrc/model/network.lua37
1 files changed, 22 insertions, 15 deletions
diff --git a/modules/luci-base/luasrc/model/network.lua b/modules/luci-base/luasrc/model/network.lua
index cce559aab..7f7397032 100644
--- a/modules/luci-base/luasrc/model/network.lua
+++ b/modules/luci-base/luasrc/model/network.lua
@@ -813,6 +813,7 @@ function del_wifinet(self, net)
end
function get_status_by_route(self, addr, mask)
+ local route_statuses = { }
local _, object
for _, object in ipairs(utl.ubus()) do
local net = object:match("^network%.interface%.(.+)")
@@ -822,12 +823,14 @@ function get_status_by_route(self, addr, mask)
local rt
for _, rt in ipairs(s.route) do
if not rt.table and rt.target == addr and rt.mask == mask then
- return net, s
+ route_statuses[net] = s
end
end
end
end
end
+
+ return route_statuses
end
function get_status_by_address(self, addr)
@@ -856,24 +859,28 @@ function get_status_by_address(self, addr)
end
end
-function get_wannet(self)
- local net, stat = self:get_status_by_route("0.0.0.0", 0)
- return net and network(net, stat.proto)
-end
+function get_wan_networks(self)
+ local k, v
+ local wan_nets = { }
+ local route_statuses = self:get_status_by_route("0.0.0.0", 0)
-function get_wandev(self)
- local _, stat = self:get_status_by_route("0.0.0.0", 0)
- return stat and interface(stat.l3_device or stat.device)
-end
+ for k, v in pairs(route_statuses) do
+ wan_nets[#wan_nets+1] = network(k, v.proto)
+ end
-function get_wan6net(self)
- local net, stat = self:get_status_by_route("::", 0)
- return net and network(net, stat.proto)
+ return wan_nets
end
-function get_wan6dev(self)
- local _, stat = self:get_status_by_route("::", 0)
- return stat and interface(stat.l3_device or stat.device)
+function get_wan6_networks(self)
+ local k, v
+ local wan6_nets = { }
+ local route_statuses = self:get_status_by_route("::", 0)
+
+ for k, v in pairs(route_statuses) do
+ wan6_nets[#wan6_nets+1] = network(k, v.proto)
+ end
+
+ return wan6_nets
end
function get_switch_topologies(self)