-- -- (C) 2013-20 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path local system_setup_ui_utils = require "system_setup_ui_utils" require "lua_utils" require "prefs_utils" prefsSkipRedis(true) if not (ntop.isnEdge() or ntop.isAppliance()) or not isAdministrator() then return end local sys_config if ntop.isnEdge() then package.path = dirs.installdir .. "/pro/scripts/lua/nedge/modules/system_config/?.lua;" .. package.path sys_config = require("nf_config"):create(true) else -- ntop.isAppliance() package.path = dirs.installdir .. "/scripts/lua/modules/system_config/?.lua;" .. package.path sys_config = require("appliance_config"):create(true) 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"], ",")) if (mode == "routing") then -- Ensure we are on static mode on the lan inteface local lan_iface = sys_config:getLanInterface() sys_config:setInterfaceMode(lan_iface, "static") end sys_config:save() end local function valuesToKeys(t) local res = {} for k, v in pairs(t or {}) do res[v] = 1 end return res end local function printIfSelected(iface, interfaces_set) print([[]]) end local print_page_body -- Interaface limits configuration local min_lan_ifaces = "1" local min_wan_ifaces = "1" local max_lan_ifaces = "1" local max_wan_ifaces = "" if mode == "routing" then -- nothing to change elseif mode == "bridging" then -- temporary limits - we need to support multiple LAN interfaces in C code max_wan_ifaces = "1" elseif mode == "passive" then min_wan_ifaces = "" end local lan_label local wan_label if mode == "passive" then lan_label = i18n("appliance.management") wan_label = i18n("appliance.capture_interfaces") else lan_label = i18n("nedge.lan") wan_label = i18n("nedge.wan") end print_page_body = function() printPageSection(i18n("prefs.network_interfaces")) local ifaces = sys_config:getAllInterfaces() print[[
]] printSaveButton() end system_setup_ui_utils.print_setup_page(print_page_body, sys_config)