libs/core: non-bridge handling fix in network model
authorJo-Philipp Wich <jow@openwrt.org>
Sat, 24 Sep 2011 03:31:00 +0000 (03:31 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sat, 24 Sep 2011 03:31:00 +0000 (03:31 +0000)
libs/core/luasrc/model/network.lua

index 26344c2cc1aae84526fe0b350f9d089f96501164..983483d82d02fe39ca8a0ee770eb1b09db87e2dd 100644 (file)
@@ -791,26 +791,23 @@ function network.get_interfaces(self)
                ifaces[#ifaces+1] = nfs[ifn]
        end
 
-       local num = { }
-       local wfs = { }
-       uci_r:foreach("wireless", "wifi-iface",
-               function(s)
-                       if s.device then
-                               num[s.device] = num[s.device] and num[s.device] + 1 or 1
-                               if s.network == self.sid then
-                                       ifn = "%s.network%d" %{ s.device, num[s.device] }
-                                       wfs[ifn] = interface(ifn, self)
+       if self:is_bridge() then
+               local num = { }
+               local wfs = { }
+               uci_r:foreach("wireless", "wifi-iface",
+                       function(s)
+                               if s.device then
+                                       num[s.device] = num[s.device] and num[s.device] + 1 or 1
+                                       if s.network == self.sid then
+                                               ifn = "%s.network%d" %{ s.device, num[s.device] }
+                                               wfs[ifn] = interface(ifn, self)
+                                       end
                                end
-                       end
-               end)
-
-       for ifn in utl.kspairs(wfs) do
-               ifaces[#ifaces+1] = wfs[ifn]
+                       end)
 
-               -- only bridges may cover more than one interface
-               --if not self:is_bridge() then
-               --      break
-               --end
+               for ifn in utl.kspairs(wfs) do
+                       ifaces[#ifaces+1] = wfs[ifn]
+               end
        end
 
        return ifaces