summaryrefslogtreecommitdiffhomepage
path: root/libs/core
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-10-31 21:38:36 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-10-31 21:38:36 +0000
commit0a8fa4e4a53d5b75961d286cf503536a51b072d6 (patch)
tree6c30ebd12289f748f509f0aba7c016a8e42c0374 /libs/core
parentb3b708a585759ca506e857ce5030d83ddd190b1e (diff)
libs/core: support not-yet-existing interfaces in network model
Diffstat (limited to 'libs/core')
-rw-r--r--libs/core/luasrc/model/network.lua15
1 files changed, 13 insertions, 2 deletions
diff --git a/libs/core/luasrc/model/network.lua b/libs/core/luasrc/model/network.lua
index bb98f8223..54008b54b 100644
--- a/libs/core/luasrc/model/network.lua
+++ b/libs/core/luasrc/model/network.lua
@@ -102,7 +102,7 @@ function _set(c, s, o, v)
if type(v) == "boolean" then v = v and "1" or "0" end
return uci_r:set(c, s, o, v)
else
- return uci_r:del(c, s, o, v)
+ return uci_r:delete(c, s, o)
end
end
@@ -372,10 +372,21 @@ end
function get_interfaces(self)
local iface
local ifaces = { }
+ local seen = { }
-- find normal interfaces
+ uci_r:foreach("network", "interface",
+ function(s)
+ for iface in utl.imatch(s.ifname) do
+ if not _iface_ignore(iface) and not _wifi_iface(iface) then
+ seen[iface] = true
+ ifaces[#ifaces+1] = interface(iface)
+ end
+ end
+ end)
+
for iface in utl.kspairs(ifs) do
- if not _iface_ignore(iface) and not _wifi_iface(iface) then
+ if not (seen[iface] or _iface_ignore(iface) or _wifi_iface(iface)) then
ifaces[#ifaces+1] = interface(iface)
end
end