summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface-definitions/vpn_sstp.xml.in17
-rwxr-xr-xsmoketest/scripts/cli/test_vpn_sstp.py4
-rwxr-xr-xsrc/conf_mode/vpn_sstp.py12
-rwxr-xr-xsrc/migration-scripts/sstp/0-to-15
-rwxr-xr-xsrc/migration-scripts/sstp/2-to-321
5 files changed, 35 insertions, 24 deletions
diff --git a/interface-definitions/vpn_sstp.xml.in b/interface-definitions/vpn_sstp.xml.in
index 5ef503041..38c8c0fb8 100644
--- a/interface-definitions/vpn_sstp.xml.in
+++ b/interface-definitions/vpn_sstp.xml.in
@@ -26,24 +26,17 @@
</children>
</node>
#include <include/interface-mtu-68-1500.xml.i>
+ #include <include/accel-gateway-address.xml.i>
#include <include/accel-name-server.xml.i>
- <node name="network-settings">
+ <node name="client-ip-pool">
<properties>
- <help>Network settings</help>
+ <help>Client IP pools and gateway setting</help>
</properties>
<children>
- <node name="client-ip-settings">
- <properties>
- <help>Client IP pools and gateway setting</help>
- </properties>
- <children>
- #include <include/accel-client-subnet.xml.i>
- #include <include/accel-gateway-address.xml.i>
- </children>
- </node>
- #include <include/accel-client-ipv6-pool.xml.i>
+ #include <include/accel-client-subnet.xml.i>
</children>
</node>
+ #include <include/accel-client-ipv6-pool.xml.i>
<node name="ppp-options">
<properties>
<help>PPP (Point-to-Point Protocol) settings</help>
diff --git a/smoketest/scripts/cli/test_vpn_sstp.py b/smoketest/scripts/cli/test_vpn_sstp.py
index ca5b307dd..03ed23495 100755
--- a/smoketest/scripts/cli/test_vpn_sstp.py
+++ b/smoketest/scripts/cli/test_vpn_sstp.py
@@ -42,8 +42,8 @@ class TestVPNSSTPServer(BasicAccelPPPTest.BaseTest):
self.set(['ssl', 'cert-file', ssl_cert])
self.set(['ssl', 'key-file', ssl_key])
- self.set(['network-settings', 'client-ip-settings', 'subnet', '192.0.2.0/24'])
- self.set(['network-settings', 'client-ip-settings', 'gateway-address', '1.1.1.1'])
+ self.set(['client-ip-pool', 'subnet', '192.0.2.0/24'])
+ self.set(['gateway-address', '1.1.1.1'])
super().basic_config()
diff --git a/src/conf_mode/vpn_sstp.py b/src/conf_mode/vpn_sstp.py
index 15fcfcef3..3eece1922 100755
--- a/src/conf_mode/vpn_sstp.py
+++ b/src/conf_mode/vpn_sstp.py
@@ -224,16 +224,13 @@ def get_config(config=None):
#
# read in client IPv4 pool
- conf.set_level(base_path + ['network-settings', 'client-ip-settings'])
+ conf.set_level(base_path + ['client-ip-pool'])
if conf.exists(['subnet']):
sstp['client_ip_pool'] = conf.return_values(['subnet'])
- if conf.exists(['gateway-address']):
- sstp['client_gateway'] = conf.return_value(['gateway-address'])
-
#
# read in client IPv6 pool
- conf.set_level(base_path + ['network-settings', 'client-ipv6-pool'])
+ conf.set_level(base_path + ['client-ipv6-pool'])
if conf.exists(['prefix']):
for prefix in conf.list_nodes(['prefix']):
tmp = {
@@ -261,6 +258,9 @@ def get_config(config=None):
#
# read in network settings
conf.set_level(base_path)
+ if conf.exists(['gateway-address']):
+ sstp['client_gateway'] = conf.return_value(['gateway-address'])
+
if conf.exists(['name-server']):
for name_server in conf.return_values(['name-server']):
if is_ipv4(name_server):
@@ -268,8 +268,6 @@ def get_config(config=None):
else:
sstp['dnsv6'].append(name_server)
- #
- # read in network settings
if conf.exists(['mtu']):
sstp['mtu'] = conf.return_value(['mtu'])
diff --git a/src/migration-scripts/sstp/0-to-1 b/src/migration-scripts/sstp/0-to-1
index 0e8dd1c4b..dc65bdeab 100755
--- a/src/migration-scripts/sstp/0-to-1
+++ b/src/migration-scripts/sstp/0-to-1
@@ -107,9 +107,9 @@ else:
config.delete(radius_server)
# migrate SSL certificates
- old_ssl = new_base + ['sstp-settings', 'ssl-certs']
+ old_ssl = new_base + ['sstp-settings']
new_ssl = new_base + ['ssl']
- config.copy(old_ssl, new_ssl)
+ config.copy(old_ssl + ['ssl-certs'], new_ssl)
config.delete(old_ssl)
if config.exists(new_ssl + ['ca']):
@@ -121,7 +121,6 @@ else:
if config.exists(new_ssl + ['server-key']):
config.rename(new_ssl + ['server-key'], 'key-file')
-
try:
with open(file_name, 'w') as f:
f.write(config.to_string())
diff --git a/src/migration-scripts/sstp/2-to-3 b/src/migration-scripts/sstp/2-to-3
index dc96a2d30..963b2ba4b 100755
--- a/src/migration-scripts/sstp/2-to-3
+++ b/src/migration-scripts/sstp/2-to-3
@@ -49,9 +49,30 @@ else:
config.copy(config_mtu, base_path + ['mtu'])
config.delete(config_mtu)
+ config_gw = base_path + ['network-settings', 'client-ip-settings', 'gateway-address']
+ if config.exists(config_gw):
+ config.copy(config_gw, base_path + ['gateway-address'])
+ config.delete(config_gw)
+
+ config_client_ip = base_path + ['network-settings', 'client-ip-settings']
+ if config.exists(config_client_ip):
+ config.copy(config_client_ip, base_path + ['client-ip-pool'])
+ config.delete(config_client_ip)
+
+ config_client_ipv6 = base_path + ['network-settings', 'client-ipv6-pool']
+ if config.exists(config_client_ipv6):
+ config.copy(config_client_ipv6, base_path + ['client-ipv6-pool'])
+ config.delete(config_client_ipv6)
+
+ # all nodes now have been migrated out of network-settings - delete node
+ config_nw_settings = base_path + ['network-settings']
+ if config.exists(config_nw_settings):
+ config.delete(config_nw_settings)
+
try:
with open(file_name, 'w') as f:
f.write(config.to_string())
except OSError as e:
print("Failed to save the modified config: {}".format(e))
exit(1)
+