luci-base: fix syntax error in luci.model.network
[project/luci.git] / modules / luci-base / luasrc / model / network.lua
index 81fc416..9cd7c87 100644 (file)
@@ -22,7 +22,7 @@ module "luci.model.network"
 
 
 IFACE_PATTERNS_VIRTUAL  = { }
-IFACE_PATTERNS_IGNORE   = { "^wmaster%d", "^wifi%d", "^hwsim%d", "^imq%d", "^ifb%d", "^mon%.wlan%d", "^sit%d", "^gre%d", "^lo$" }
+IFACE_PATTERNS_IGNORE   = { "^wmaster%d", "^wifi%d", "^hwsim%d", "^imq%d", "^ifb%d", "^mon%.wlan%d", "^sit%d", "^gre%d", "^gretap%d", "^ip6gre%d", "^ip6tnl%d", "^tunl%d", "^lo$" }
 IFACE_PATTERNS_WIRELESS = { "^wlan%d", "^wl%d", "^ath%d", "^%w+%.network%d" }
 
 
@@ -190,7 +190,7 @@ function _iface_ignore(x)
                        return true
                end
        end
-       return _iface_virtual(x)
+       return false
 end
 
 
@@ -216,7 +216,7 @@ function init(cursor)
                        _tunnel[name] = true
                end
 
-               if _tunnel[name] or not _iface_ignore(name) then
+               if _tunnel[name] or not (_iface_ignore(name) or _iface_virtual(name)) then
                        _interfaces[name] = _interfaces[name] or {
                                idx      = i.ifindex or n,
                                name     = name,
@@ -500,7 +500,7 @@ function get_interfaces(self)
        _uci:foreach("network", "interface",
                function(s)
                        for iface in utl.imatch(s.ifname) do
-                               if not _iface_ignore(iface) and not _wifi_iface(iface) then
+                               if not _iface_ignore(iface) and not _iface_virtual(iface) and not _wifi_iface(iface) then
                                        seen[iface] = true
                                        nfs[iface] = interface(iface)
                                end
@@ -508,7 +508,7 @@ function get_interfaces(self)
                end)
 
        for iface in utl.kspairs(_interfaces) do
-               if not (seen[iface] or _iface_ignore(iface) or _wifi_iface(iface)) then
+               if not (seen[iface] or _iface_ignore(iface) or _iface_virtual(iface) or _wifi_iface(iface)) then
                        nfs[iface] = interface(iface)
                end
        end
@@ -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)