Compare commits

...

2 Commits

Author SHA1 Message Date
David Bauer
f7ab27cbaa gluon-core: support multi-port interfaces 2021-06-26 19:36:59 +02:00
David Bauer
e9c0465a4a gluon-core: update board.json interface path 2021-06-26 17:56:42 +02:00

View File

@ -20,17 +20,35 @@ local network_data = (board_data or {}).network
local function iface_exists(ifaces)
if not ifaces then return nil end
local ifnames = table.concat(ifaces, ' ')
for iface in ifaces:gmatch('%S+') do
for iface in ifaces do
if unistd.access('/sys/class/net/' .. iface:gsub('%..*$', '')) then
return ifaces
return ifnames
end
end
end
local lan_data = network_data.lan or {}
local wan_data = network_data.wan or {}
local lan_ifname = iface_exists((network_data.lan or {}).ifname)
local wan_ifname = iface_exists((network_data.wan or {}).ifname)
local lan_interfaces = lan_data.ports
local wan_interfaces = wan_data.ports
-- In case we have a single port for either WAN or LAN,
-- add it to the respective empty table, as devices and
-- ports is XOR in board.json
if lan_data.device ~= nil then
lan_interfaces = {lan_data.device}
end
if wan_data.device ~= nil then
wan_interfaces = {wan_data.device}
end
local lan_ifname = iface_exists(lan_interfaces)
local wan_ifname = iface_exists(wan_interfaces)
if platform.match('ar71xx', 'generic', {
'cpe210',