From fd2bec547014fae7a8fcba61b7f3030c4c2e49a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Al=D0=B5x=D0=B0nder=20Lysik=D0=BEv?=
 <alexander.lysikov@demlabs.net>
Date: Tue, 12 Nov 2019 13:16:03 +0500
Subject: [PATCH] added [vpn_old] section for old vpn server

---
 dist/share/configs/cellframe-node.cfg.tpl |  6 ++++++
 sources/main.c                            | 13 +++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/dist/share/configs/cellframe-node.cfg.tpl b/dist/share/configs/cellframe-node.cfg.tpl
index 57f30cd4b..dd9f78881 100644
--- a/dist/share/configs/cellframe-node.cfg.tpl
+++ b/dist/share/configs/cellframe-node.cfg.tpl
@@ -43,6 +43,12 @@ access_groups=expats,services,admins
 network_address=10.11.12.0
 network_mask=255.255.255.0
 
+# old VPN server
+[vpn_old]
+enabled=true
+network_address=10.11.11.0
+network_mask=255.255.255.0
+
 # Console interface server
 [conserver]
 enabled=true
diff --git a/sources/main.c b/sources/main.c
index e155887ba..dd64d8646 100644
--- a/sources/main.c
+++ b/sources/main.c
@@ -300,15 +300,14 @@ int main( int argc, const char **argv )
         log_it(L_CRITICAL,"Can't init dap chain network service datum pool module");
         return -69;
     }
-    // vpn server
 #ifndef _WIN32
-    /*
+    // vpn server
     if(dap_config_get_item_bool_default(g_config, "vpn", "enabled", false)) {
         if(dap_chain_net_srv_vpn_init(g_config) != 0) {
             log_it(L_ERROR, "Can't init dap chain network service vpn module");
             return -70;
         }
-    }*/
+    }
     // vpn client
     if(dap_chain_net_vpn_client_init(g_config) != 0) {
         log_it(L_ERROR, "Can't init dap chain network service vpn client");
@@ -423,11 +422,9 @@ int main( int argc, const char **argv )
 
 
     // VPN channel
-
-
-    if (dap_config_get_item_bool_default(g_config,"vpn","enabled",false)){
-        dap_stream_ch_vpn_init(dap_config_get_item_str_default(g_config, "vpn", "network_address", NULL),
-                   dap_config_get_item_str_default(g_config, "vpn", "network_mask", NULL));
+    if(dap_config_get_item_bool_default(g_config,"vpn_old","enabled",false)){
+        dap_stream_ch_vpn_init(dap_config_get_item_str_default(g_config, "vpn_old", "network_address", NULL),
+                   dap_config_get_item_str_default(g_config, "vpn_old", "network_mask", NULL));
 
     }
 
-- 
GitLab