From 57e58b9bf9e9bbf4eeed0daf0515280376d7e611 Mon Sep 17 00:00:00 2001 From: Oskari Rauta Date: Fri, 1 Apr 2016 04:15:11 +0000 Subject: Update network.lua Fix display of WAN status when WAN is provided by using WWAN device or similar with other similar similar methods. Explanation: Before this, protocol was fetched from /etc/config/network for interface which often is wan_4 - but protocol is configured in file as wan, and therefore protocol is always none, since configuration is made for wan and then setup as wan_4 and possibly wan_6 if ipv6 is being used. This commit uses ubus to get used active protocol. For example, in case of qmi, it displays protocol as dhcp since even if I configured wan to use qmi, dhcp was used as a protocol for getting IP address. --- modules/luci-base/luasrc/model/network.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'modules/luci-base/luasrc/model/network.lua') diff --git a/modules/luci-base/luasrc/model/network.lua b/modules/luci-base/luasrc/model/network.lua index 81fc416fe..741daa481 100644 --- a/modules/luci-base/luasrc/model/network.lua +++ b/modules/luci-base/luasrc/model/network.lua @@ -666,8 +666,8 @@ function get_status_by_address(self, addr) end function get_wannet(self) - local net = self:get_status_by_route("0.0.0.0", 0) - return net and network(net) + local net, stat = self:get_status_by_route("0.0.0.0", 0) + return net and network(net, stat.proto) end function get_wandev(self) @@ -676,8 +676,8 @@ function get_wandev(self) end function get_wan6net(self) - local net = self:get_status_by_route("::", 0) - return net and network(net) + local net, stat = self:get_status_by_route("::", 0) + return net and network(net, stat.proto) end function get_wan6dev(self) -- cgit v1.2.3