diff options
author | Ermal Luçi <eri@pfsense.org> | 2010-02-03 15:06:24 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2010-02-03 15:06:24 +0000 |
commit | 741077bcc662706d030e8b13fb787ef6f935eb0d (patch) | |
tree | b7f6e1e7b0830e6d4cd9a64f1603649de917e519 | |
parent | 920af30f8c093fa8ce878ed4401b5d752613905e (diff) | |
download | pfsense-741077bcc662706d030e8b13fb787ef6f935eb0d.zip pfsense-741077bcc662706d030e8b13fb787ef6f935eb0d.tar.gz |
Use global variable and do not loop all entries undefinitely.
-rw-r--r-- | etc/inc/vpn.inc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 6aa792e..6b11053 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -206,13 +206,15 @@ function vpn_ipsec_configure($ipchg = false) /* add an ipsec pinghosts entry */ if ($ph2ent['pinghost']) { - $pfd = fopen("/var/db/ipsecpinghosts", "a"); + $pfd = fopen("{$g['vardb_path']}/ipsecpinghosts", "a"); $iflist = get_configured_interface_list(); foreach ($iflist as $ifent => $ifname) { $interface_ip = get_interface_ip($ifent); $local_subnet = ipsec_idinfo_to_cidr($ph2ent['localid'], true); - if (ip_in_subnet($interface_ip, $local_subnet)) + if (ip_in_subnet($interface_ip, $local_subnet)) { $srcip = $interface_ip; + break; + } } $dstip = $ph2ent['pinghost']; fwrite($pfd, "$srcip|$dstip|3\n"); |