Revision 741077bc
Added by Ermal Luçi over 15 years ago
etc/inc/vpn.inc | ||
---|---|---|
206 | 206 |
|
207 | 207 |
/* add an ipsec pinghosts entry */ |
208 | 208 |
if ($ph2ent['pinghost']) { |
209 |
$pfd = fopen("/var/db/ipsecpinghosts", "a");
|
|
209 |
$pfd = fopen("{$g['vardb_path']}/ipsecpinghosts", "a");
|
|
210 | 210 |
$iflist = get_configured_interface_list(); |
211 | 211 |
foreach ($iflist as $ifent => $ifname) { |
212 | 212 |
$interface_ip = get_interface_ip($ifent); |
213 | 213 |
$local_subnet = ipsec_idinfo_to_cidr($ph2ent['localid'], true); |
214 |
if (ip_in_subnet($interface_ip, $local_subnet)) |
|
214 |
if (ip_in_subnet($interface_ip, $local_subnet)) {
|
|
215 | 215 |
$srcip = $interface_ip; |
216 |
break; |
|
217 |
} |
|
216 | 218 |
} |
217 | 219 |
$dstip = $ph2ent['pinghost']; |
218 | 220 |
fwrite($pfd, "$srcip|$dstip|3\n"); |
Also available in: Unified diff
Use global variable and do not loop all entries undefinitely.