summaryrefslogtreecommitdiffhomepage
path: root/libs/core/luasrc
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-11-15 22:03:45 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-11-15 22:03:45 +0000
commitb30437329760a0dc2a92a41172802986e499a148 (patch)
treefa126017c847e922ae37f767f2b23c8672a20d61 /libs/core/luasrc
parent0f7d2d2525ac5f543b9b1060c2e9da349a7cb3d3 (diff)
libs/core: network model fixes
Diffstat (limited to 'libs/core/luasrc')
-rw-r--r--libs/core/luasrc/model/network.lua32
1 files changed, 11 insertions, 21 deletions
diff --git a/libs/core/luasrc/model/network.lua b/libs/core/luasrc/model/network.lua
index 7882c81a8..cc4200cb4 100644
--- a/libs/core/luasrc/model/network.lua
+++ b/libs/core/luasrc/model/network.lua
@@ -275,26 +275,14 @@ end
function del_network(self, n)
local r = uci_r:delete("network", n)
if r then
- uci_r:foreach("network", "alias",
- function(s)
- if s.interface == n then
- uci_r:delete("network", s['.name'])
- end
- end)
+ uci_r:delete_all("network", "alias",
+ function(s) return (s.interface == n) end)
- uci_r:foreach("network", "route",
- function(s)
- if s.interface == n then
- uci_r:delete("network", s['.name'])
- end
- end)
+ uci_r:delete_all("network", "route",
+ function(s) return (s.interface == n) end)
- uci_r:foreach("network", "route6",
- function(s)
- if s.interface == n then
- uci_r:delete("network", s['.name'])
- end
- end)
+ uci_r:delete_all("network", "route6",
+ function(s) return (s.interface == n) end)
uci_r:foreach("wireless", "wifi-iface",
function(s)
@@ -302,8 +290,6 @@ function del_network(self, n)
uci_r:delete("wireless", s['.name'], "network")
end
end)
-
- uci_r:delete("network", n)
end
return r
end
@@ -990,7 +976,11 @@ function wifinet.name(self)
end
function wifinet.ifname(self)
- return self.iwinfo.ifname or self.wdev
+ local ifname = self.iwinfo.ifname
+ if not ifname or ifname:match("^wifi%d") or ifname:match("^radio%d") then
+ ifname = self.wdev
+ end
+ return ifname
end
function wifinet.get_device(self)