Add selected WAN interfaces to the list of gateways if not already there

This commit is contained in:
Alfredo Cardigliano 2024-04-11 16:29:07 +02:00
parent 8076ddc67f
commit 925332d70f
2 changed files with 19 additions and 2 deletions

View file

@ -26,7 +26,7 @@ end
system_setup_ui_utils.process_apply_discard_config(sys_config)
local mode = sys_config:getOperatingMode()
if (_POST["lan_interfaces"] ~= nil) and (_POST["wan_interfaces"] ~= nil) then
sys_config:setLanWanIfaces(split(_POST["lan_interfaces"], ","), split(_POST["wan_interfaces"], ","))
@ -36,6 +36,13 @@ if (_POST["lan_interfaces"] ~= nil) and (_POST["wan_interfaces"] ~= nil) then
for _, lan_iface in ipairs(lan_ifaces) do
sys_config:setInterfaceMode(lan_iface, "static")
end
-- Add to the list of gateways if not already present
local wan_ifaces = sys_config:getWanInterfaces()
for _, wan_iface in ipairs(wan_ifaces) do
sys_config:addGateway(wan_iface)
end
end
sys_config:save()