Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

network: Do not configure protocols on DSA switch port network devices by default. #1161

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions packages/lime-system/files/usr/lib/lua/lime/network.lua
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,18 @@ function network.configure()

for _,protoParams in pairs(deviceProtos) do
local args = utils.split(protoParams, network.protoParamsSeparator)
if args[1] == "manual" then break end -- If manual is specified do not configure interface
local protoModule = "lime.proto."..args[1]
for k,v in pairs(flags) do args[k] = v end
if utils.isModuleAvailable(protoModule) then
local protoName = args[1]
if protoName == "manual" then break end -- If manual is specified do not configure interface
local protoModule = "lime.proto."..protoName
local needsConfig = utils.isModuleAvailable(protoModule)
if protoName ~= 'lan' and not flags["specific"] then
--! Work around issue 1121. Do not configure any other
--! protocols than lime.proto.lan on dsa devices unless there
--! is a config net section for the device.
needsConfig = needsConfig and not utils.is_dsa(device)
end
if needsConfig then
for k,v in pairs(flags) do args[k] = v end
local proto = require(protoModule)
xpcall(function() proto.configure(args) ; proto.setup_interface(device, args) end,
function(errmsg) print(errmsg) ; print(debug.traceback()) end)
Expand Down
9 changes: 3 additions & 6 deletions packages/lime-system/files/usr/lib/lua/lime/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -593,13 +593,10 @@ function utils.deepcompare(t1,t2)
return true
end

function utils.is_dsa()
function utils.is_dsa(port)
--! Code adapted from Jow https://forum.openwrt.org/t/how-to-detect-dsa/111868/4
local shell_output = utils.unsafe_shell("grep -s DEVTYPE=dsa /sys/class/net/*/uevent")
if shell_output ~= "" and shell_output ~= nil then
return true
end
return false
port = port or "*"
return 0 == os.execute("grep -sq DEVTYPE=dsa /sys/class/net/"..port.."/uevent")
end

return utils
Loading