@@ -1233,17 +1233,21 @@ def process(self):
12331233 CsHelper .start_if_stopped ("ipsec" )
12341234
12351235 logging .debug ("Remote accessvpn data bag %s" , self .dbag )
1236+ config_changed = False
12361237 if not self .config .has_public_network ():
12371238 interface = self .config .address ().get_guest_if_by_network_id ()
12381239 if interface :
1239- self .configure_l2tpIpsec (interface .get_ip (), self .dbag [public_ip ])
1240+ config_changed = self .configure_l2tpIpsec (interface .get_ip (), self .dbag [public_ip ])
12401241 self .remoteaccessvpn_iptables (interface .get_device (), interface .get_ip (), self .dbag [public_ip ])
12411242 else :
1242- self .configure_l2tpIpsec (public_ip , self .dbag [public_ip ])
1243+ config_changed = self .configure_l2tpIpsec (public_ip , self .dbag [public_ip ])
12431244 self .remoteaccessvpn_iptables (self .dbag [public_ip ]['public_interface' ], public_ip , self .dbag [public_ip ])
12441245
12451246 CsHelper .execute ("ipsec update" )
1246- CsHelper .execute ("systemctl start xl2tpd" )
1247+ if config_changed :
1248+ CsHelper .execute ("systemctl restart xl2tpd" )
1249+ else :
1250+ CsHelper .execute ("systemctl start xl2tpd" )
12471251 CsHelper .execute ("ipsec rereadsecrets" )
12481252 else :
12491253 logging .debug ("Disabling remote access vpn ....." )
@@ -1266,21 +1270,23 @@ def configure_l2tpIpsec(self, left, obj):
12661270 l2tpfile = CsFile (l2tpconffile )
12671271 l2tpfile .addeq (" left=%s" % left )
12681272 l2tpfile .addeq (" leftid=%s" % obj ['vpn_server_ip' ])
1269- l2tpfile .commit ()
1273+ l2tp_changed = l2tpfile .commit ()
12701274
12711275 secret = CsFile (vpnsecretfilte )
12721276 secret .empty ()
12731277 secret .addeq (": PSK \" %s\" " % (psk ))
1274- secret .commit ()
1278+ secret_changed = secret .commit ()
12751279
12761280 xl2tpdconf = CsFile (xl2tpdconffile )
12771281 xl2tpdconf .addeq ("ip range = %s" % iprange )
12781282 xl2tpdconf .addeq ("local ip = %s" % localip )
1279- xl2tpdconf .commit ()
1283+ xl2tpd_changed = xl2tpdconf .commit ()
12801284
12811285 xl2tpoptions = CsFile (xl2tpoptionsfile )
12821286 xl2tpoptions .search ("ms-dns " , "ms-dns %s" % localip )
1283- xl2tpoptions .commit ()
1287+ xl2tpoptions_changed = xl2tpoptions .commit ()
1288+
1289+ return l2tp_changed or secret_changed or xl2tpd_changed or xl2tpoptions_changed
12841290
12851291 def remoteaccessvpn_iptables (self , publicdev , publicip , obj ):
12861292 localcidr = obj ['local_cidr' ]
0 commit comments