luci-base: fix luci.model.network.ignore_interface()

Fix the underlying _iface_ignore() function to not ignore virtual interfaces,
in order to let ignore_interface() return true for PPP and similar devices.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2016-04-26 20:54:52 +02:00
parent 9151103356
commit 4983a9b034

View file

@ -190,7 +190,7 @@ function _iface_ignore(x)
return true return true
end end
end end
return _iface_virtual(x) return false
end end
@ -216,7 +216,7 @@ function init(cursor)
_tunnel[name] = true _tunnel[name] = true
end 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 { _interfaces[name] = _interfaces[name] or {
idx = i.ifindex or n, idx = i.ifindex or n,
name = name, name = name,
@ -500,7 +500,7 @@ function get_interfaces(self)
_uci:foreach("network", "interface", _uci:foreach("network", "interface",
function(s) function(s)
for iface in utl.imatch(s.ifname) do 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 seen[iface] = true
nfs[iface] = interface(iface) nfs[iface] = interface(iface)
end end
@ -508,7 +508,7 @@ function get_interfaces(self)
end) end)
for iface in utl.kspairs(_interfaces) do 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) nfs[iface] = interface(iface)
end end
end end