Fix unable to setup more than one Site2Site VPN Connection
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/435a98cd Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/435a98cd Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/435a98cd Branch: refs/heads/master Commit: 435a98cd3f3147ab6b222cd8a265d7101f0a3f12 Parents: 230c9cf Author: Michael Andersen <[email protected]> Authored: Tue Jan 12 10:36:37 2016 +0100 Committer: Michael Andersen <[email protected]> Committed: Tue Jan 12 11:24:35 2016 +0100 ---------------------------------------------------------------------- .../debian/config/opt/cloud/bin/configure.py | 16 ++++++++++------ .../debian/config/opt/cloud/bin/cs_site2sitevpn.py | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/435a98cd/systemvm/patches/debian/config/opt/cloud/bin/configure.py ---------------------------------------------------------------------- diff --git a/systemvm/patches/debian/config/opt/cloud/bin/configure.py b/systemvm/patches/debian/config/opt/cloud/bin/configure.py index 3e6d717..f616b6b 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/configure.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/configure.py @@ -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: http://git-wip-us.apache.org/repos/asf/cloudstack/blob/435a98cd/systemvm/patches/debian/config/opt/cloud/bin/cs_site2sitevpn.py ---------------------------------------------------------------------- diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_site2sitevpn.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_site2sitevpn.py index 02157b4..972c09a 100755 --- a/systemvm/patches/debian/config/opt/cloud/bin/cs_site2sitevpn.py +++ b/systemvm/patches/debian/config/opt/cloud/bin/cs_site2sitevpn.py @@ -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])
