Fix unable to setup more than one Site2Site VPN Connection

This commit is contained in:
Michael Andersen 2016-01-12 10:36:37 +01:00
parent 230c9cf59e
commit 435a98cd3f
2 changed files with 11 additions and 7 deletions

View File

@ -462,16 +462,20 @@ class CsSite2SiteVpn(CsDataBag):
if m:
self.confips.append(m.group(1))
for public_ip in self.dbag:
if public_ip == "id":
for vpn in self.dbag:
if vpn == "id":
continue
dev = CsHelper.get_device(public_ip)
local_ip = self.dbag[vpn]['local_public_ip']
dev = CsHelper.get_device(local_ip)
if dev == "":
logging.error("Request for ipsec to %s not possible because ip is not configured", public_ip)
logging.error("Request for ipsec to %s not possible because ip is not configured", local_ip)
continue
CsHelper.start_if_stopped("ipsec")
self.configure_iptables(dev, self.dbag[public_ip])
self.configure_ipsec(self.dbag[public_ip])
self.configure_iptables(dev, self.dbag[vpn])
self.configure_ipsec(self.dbag[vpn])
# Delete vpns that are no longer in the configuration
for ip in self.confips:

View File

@ -19,7 +19,7 @@ from pprint import pprint
def merge(dbag, vpn):
key = vpn['local_public_ip']
key = vpn['peer_gateway_ip']
op = vpn['create']
if key in dbag.keys() and not op:
del(dbag[key])