From 2b16257896c7e60924f905a5e7832e5d5ae7b833 Mon Sep 17 00:00:00 2001
From: Ruben Barkow <rubo77@users.noreply.github.com>
Date: Mon, 6 Aug 2018 21:36:05 +0200
Subject: [PATCH] gluon-web-mesh-vpn-fastd: clarify config of default crypto
 method (#1502)

---
 docs/features/vpn.rst                                         | 4 ++--
 .../lib/gluon/config-mode/model/admin/mesh_vpn_fastd.lua      | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/docs/features/vpn.rst b/docs/features/vpn.rst
index 81eef151c..81b6dfceb 100644
--- a/docs/features/vpn.rst
+++ b/docs/features/vpn.rst
@@ -32,8 +32,9 @@ increase throughput, although in practice the gain is minimal.
 
 **Site configuration:**
 
-1) Install ``gluon-web-mesh-vpn-fastd`` in ``site.mk``
+1) Add the feature ``web-mesh-vpn-fastd`` in ``site.mk``
 2) Set ``mesh_vpn.fastd.configurable = true`` in ``site.conf``
+3) Optionally add ``null`` to the ``mesh_vpn.fastd.methods`` table if you want "Performance mode" as default (not recommended)
 
 **Gateway configuration:**
 
@@ -54,4 +55,3 @@ socket can be interrogated, after installing for example `socat`.
        opkg update
        opkg install socat
        socat - UNIX-CONNECT:/var/run/fastd.mesh_vpn.socket
-
diff --git a/package/gluon-web-mesh-vpn-fastd/luasrc/lib/gluon/config-mode/model/admin/mesh_vpn_fastd.lua b/package/gluon-web-mesh-vpn-fastd/luasrc/lib/gluon/config-mode/model/admin/mesh_vpn_fastd.lua
index a41f291e3..a60056936 100644
--- a/package/gluon-web-mesh-vpn-fastd/luasrc/lib/gluon/config-mode/model/admin/mesh_vpn_fastd.lua
+++ b/package/gluon-web-mesh-vpn-fastd/luasrc/lib/gluon/config-mode/model/admin/mesh_vpn_fastd.lua
@@ -11,6 +11,7 @@ mode.template = "mesh-vpn-fastd"
 
 local methods = uci:get('fastd', 'mesh_vpn', 'method')
 if util.contains(methods, 'null') then
+	-- performance mode will only be used as default, if it is present in site.mesh_vpn.fastd.methods
 	mode.default = 'performance'
 else
 	mode.default = 'security'
@@ -19,6 +20,8 @@ end
 function mode:write(data)
 	local site = require 'gluon.site'
 
+	-- methods will be recreated and filled with the original values from site.mesh_vpn.fastd.methods
+	-- if performance mode was selected, and the method 'null' was not present in the original table, it will be added
 	local methods = {}
 	if data == 'performance' then
 		table.insert(methods, 'null')
-- 
GitLab