From 6b4ccbf5adbbd56e4219036030215d8e6572a173 Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Sun, 20 Mar 2022 18:55:11 -0700 Subject: [PATCH] advancedconfig: tun wan only (#310) * Prevent tunnel traffic being sent over the mesh (unless explicitly enabled) * Boolean settings will use default value if value not yet set --- files/www/cgi-bin/advancedconfig | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/files/www/cgi-bin/advancedconfig b/files/www/cgi-bin/advancedconfig index cc6a2abf..60c39419 100755 --- a/files/www/cgi-bin/advancedconfig +++ b/files/www/cgi-bin/advancedconfig @@ -179,7 +179,7 @@ local settings = { { key = "aredn.@tunnel[0].maxclients", type = "string", - desc = "Specifies the maximum number of tunnel clients this node can serve; must be an integer in the range [0,100]. (Only applies if tunnel software is installed)", + desc = "Specifies the maximum number of tunnel clients this node can serve; must be an integer in the range [0,100].", default = "10", precallback = "restrictTunnelLimitToValidRange()", postcallback = "adjustTunnelInterfaceCount()" @@ -187,11 +187,17 @@ local settings = { { key = "aredn.@tunnel[0].maxservers", type = "string", - desc = "Specifies the maximum number of tunnel servers to which this node can connect; must be an integer in the range [0,100]. (Only applies if tunnel software is installed)", + desc = "Specifies the maximum number of tunnel servers to which this node can connect; must be an integer in the range [0,100].", default = "10", precallback = "restrictTunnelLimitToValidRange()", postcallback = "adjustTunnelInterfaceCount()" }, + { + key = "aredn.@tunnel[0].wanonly", + type = "boolean", + desc = "Prevents tunnel traffic from being routed over the mesh network itself.", + default = "1" + }, { key = "aredn.@meshstatus[0].lowmem", type = "string", @@ -627,10 +633,15 @@ do html.print([[]] .. setting.key .. [[]]) if setting.type == "string" then html.print("") - elseif setting.type == "boolean" and sval == "1" then - html.print("OFFON") - elseif setting.type == "boolean" and sval == "0" then - html.print("OFFON") + elseif setting.type == "boolean" then + if sval == "" then + sval = setting.default + end + if sval == "1" then + html.print("OFFON") + else + html.print("OFFON") + end elseif setting.type == "none" then html.print("Click EXECUTE button to trigger this action") end