diff options
author | Ermal Luçi <eri@pfsense.org> | 2010-02-09 12:00:34 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2010-02-09 12:00:34 +0000 |
commit | 00fc80fe0582e41b91cd1612b906f0875adeef8b (patch) | |
tree | 0585dc8072f742c4dddb1ca5b7d468a424fd458c /etc/inc/vpn.inc | |
parent | e1d35ce8c433cbf604aeadf88c6d7f73464c2347 (diff) | |
download | pfsense-00fc80fe0582e41b91cd1612b906f0875adeef8b.zip pfsense-00fc80fe0582e41b91cd1612b906f0875adeef8b.tar.gz |
Ticket #332. Simplify creating the ipsecpinghosts file.
Diffstat (limited to 'etc/inc/vpn.inc')
-rw-r--r-- | etc/inc/vpn.inc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index facdf06..96e214a 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -194,6 +194,7 @@ function vpn_ipsec_configure($ipchg = false) $rgmap[$ph1ent['remote-gateway']] = $rg; /* step through each phase2 entry */ + $ipsecpinghosts = ""; foreach ($a_phase2 as $ph2ent) { $ikeid = $ph2ent['ikeid']; @@ -206,7 +207,6 @@ function vpn_ipsec_configure($ipchg = false) /* add an ipsec pinghosts entry */ if ($ph2ent['pinghost']) { - $pfd = fopen("{$g['vardb_path']}/ipsecpinghosts", "a"); $iflist = get_configured_interface_list(); foreach ($iflist as $ifent => $ifname) { $interface_ip = get_interface_ip($ifent); @@ -217,10 +217,16 @@ function vpn_ipsec_configure($ipchg = false) } } $dstip = $ph2ent['pinghost']; - fwrite($pfd, "$srcip|$dstip|3\n"); - fclose($pfd); + if (is_ipaddr($srcip)) + $ipsecpinghosts .= "{$srcip}|{$dstip}|3\n"; } } + $pfd = fopen("{$g['vardb_path']}/ipsecpinghosts", "w"); + if ($pfd) { + fwrite($pfd, $ipsecpinghosts); + fclose($pfd); + } + } } |