From 5d596635f094939eaa89ef0b1fccc27298019fa6 Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Wed, 11 Mar 2015 10:24:06 +0200 Subject: network module: skip . and .. when reading interface names from /sys --- aconf/modules/network.lua | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'aconf/modules/network.lua') diff --git a/aconf/modules/network.lua b/aconf/modules/network.lua index 8c985ff..17e0127 100644 --- a/aconf/modules/network.lua +++ b/aconf/modules/network.lua @@ -262,18 +262,18 @@ M.register('net', Net, {ui_name='Network'}) M.permission.defaults('/net') return function(txn) - local ifaces = txn:fetch('/net/interfaces') - for _, name in ipairs(posix.dir(iface_sys_dir)) do - if not ifaces[name] and posix.stat( - M.path.join(iface_sys_dir, name), 'type' - ) == 'link' then - ifaces[name] = {} - if ifaces[name].class == 'logical' then ifaces[name] = nil - else - for _, version in ipairs{4, 6} do - ifaces[name]['ipv'..version].method = 'unconfigured' - end - end - end - end - end + local ifaces = txn:fetch('/net/interfaces') + for _, name in ipairs(posix.dir(iface_sys_dir)) do + if name:sub(1, 1) ~= '.' and not ifaces[name] and posix.stat( + M.path.join(iface_sys_dir, name), 'type' + ) == 'link' then + ifaces[name] = {} + if ifaces[name].class == 'logical' then ifaces[name] = nil + else + for _, version in ipairs{4, 6} do + ifaces[name]['ipv'..version].method = 'unconfigured' + end + end + end + end +end -- cgit v1.2.3