Skip to content

Commit

Permalink
Merge pull request #1080 from pony1k/fix/network.scandevices-get-lower
Browse files Browse the repository at this point in the history
Fix lime-config fail when there is no lower iface
  • Loading branch information
G10h4ck authored Feb 12, 2024
2 parents 0c8a915 + d5befee commit 8b577bf
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions packages/lime-system/files/usr/lib/lua/lime/network.lua
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ end
function network._get_lower(dev)
local lower_if_path = utils.unsafe_shell("ls -d /sys/class/net/" .. dev .. "/lower*")
local lower_if_table = utils.split(lower_if_path, "_")
return lower_if_table[#lower_if_table]:gsub("\n", "")
local lower_if = lower_if_table[#lower_if_table]
return lower_if and lower_if:gsub("\n", "")
end

function network.scandevices()
Expand Down Expand Up @@ -248,19 +249,23 @@ function network.scandevices()
--! or just lan.
if dev:match("^lan%d*$") then
local lower_if = network._get_lower(dev)
devices[lower_if] = { nobridge = true }
devices[dev] = {}
utils.log( "network.scandevices.dev_parser found LAN port %s " ..
"and marking %s as nobridge", dev, lower_if )
if lower_if then
devices[lower_if] = { nobridge = true }
devices[dev] = {}
utils.log( "network.scandevices.dev_parser found LAN port %s " ..
"and marking %s as nobridge", dev, lower_if )
end
end

--! With DSA, the WAN is named wan. Copying the code from the lan case.
if dev:match("^wan$") then
local lower_if = network._get_lower(dev)
devices[lower_if] = { nobridge = true }
devices[dev] = {}
utils.log( "network.scandevices.dev_parser found WAN port %s " ..
"and marking %s as nobridge", dev, lower_if )
if lower_if then
devices[lower_if] = { nobridge = true }
devices[dev] = {}
utils.log( "network.scandevices.dev_parser found WAN port %s " ..
"and marking %s as nobridge", dev, lower_if )
end
end

if dev:match("^wlan%d+"..wireless.wifiModeSeparator.."%w+$") then
Expand Down

0 comments on commit 8b577bf

Please sign in to comment.