libs/core: more fixes for network model
[oweals/luci.git] / libs / core / luasrc / model / network.lua
index 0267bb437cd93d6fa5b139959b8f9cbef073f775..dd2bdfb90633517a20677dcd4d54f1b10e7d4941 100644 (file)
@@ -20,7 +20,6 @@ limitations under the License.
 local type, next, pairs, ipairs, loadfile, table, tonumber, math, i18n
        = type, next, pairs, ipairs, loadfile, table, tonumber, math, luci.i18n
 
-local error = error
 local require = require
 
 local nxo = require "nixio"
@@ -774,7 +773,7 @@ function protocol.is_floating(self)
 end
 
 function protocol.is_empty(self)
-       if self:is_virtual() then
+       if self:is_floating() then
                return false
        else
                local rv = true
@@ -838,12 +837,12 @@ function protocol.get_interface(self)
        else
                local ifn = nil
                local num = { }
-               for ifn in utl.imatch(_uci_state:get("network", self.sid, "ifname")) do
+               for ifn in utl.imatch(_uci_real:get("network", self.sid, "ifname")) do
                        ifn = ifn:match("^[^:/]+")
                        return ifn and interface(ifn, self)
                end
                ifn = nil
-               _uci_state:foreach("wireless", "wifi-iface",
+               _uci_real:foreach("wireless", "wifi-iface",
                        function(s)
                                if s.device then
                                        num[s.device] = num[s.device] and num[s.device] + 1 or 1