Revision 7a58a4ca
Added by Jim Pingle over 13 years ago
etc/inc/vpn.inc | ||
---|---|---|
168 | 168 |
$rgmap[$ph1ent['remote-gateway']] = $rg; |
169 | 169 |
|
170 | 170 |
/* step through each phase2 entry */ |
171 |
foreach ($a_phase2 as $ph2ent) { |
|
171 |
if (is_array($a_phase2)) { |
|
172 |
foreach ($a_phase2 as $ph2ent) { |
|
172 | 173 |
|
173 |
$ikeid = $ph2ent['ikeid']; |
|
174 |
$ikeid = $ph2ent['ikeid'];
|
|
174 | 175 |
|
175 |
if (isset($ph2ent['disabled'])) |
|
176 |
continue; |
|
176 |
if (isset($ph2ent['disabled']))
|
|
177 |
continue;
|
|
177 | 178 |
|
178 |
if ($ikeid != $ph1ent['ikeid']) |
|
179 |
continue; |
|
179 |
if ($ikeid != $ph1ent['ikeid'])
|
|
180 |
continue;
|
|
180 | 181 |
|
181 |
/* add an ipsec pinghosts entry */ |
|
182 |
if ($ph2ent['pinghost']) { |
|
183 |
$iflist = get_configured_interface_list(); |
|
184 |
foreach ($iflist as $ifent => $ifname) { |
|
185 |
$interface_ip = get_interface_ip($ifent); |
|
186 |
$local_subnet = ipsec_idinfo_to_cidr($ph2ent['localid'], true); |
|
187 |
if (ip_in_subnet($interface_ip, $local_subnet)) { |
|
188 |
$srcip = $interface_ip; |
|
189 |
break; |
|
182 |
/* add an ipsec pinghosts entry */ |
|
183 |
if ($ph2ent['pinghost']) { |
|
184 |
$iflist = get_configured_interface_list(); |
|
185 |
foreach ($iflist as $ifent => $ifname) { |
|
186 |
$interface_ip = get_interface_ip($ifent); |
|
187 |
$local_subnet = ipsec_idinfo_to_cidr($ph2ent['localid'], true); |
|
188 |
if (ip_in_subnet($interface_ip, $local_subnet)) { |
|
189 |
$srcip = $interface_ip; |
|
190 |
break; |
|
191 |
} |
|
190 | 192 |
} |
193 |
$dstip = $ph2ent['pinghost']; |
|
194 |
if (is_ipaddr($srcip)) |
|
195 |
$ipsecpinghosts .= "{$srcip}|{$dstip}|3\n"; |
|
191 | 196 |
} |
192 |
$dstip = $ph2ent['pinghost']; |
|
193 |
if (is_ipaddr($srcip)) |
|
194 |
$ipsecpinghosts .= "{$srcip}|{$dstip}|3\n"; |
|
197 |
} |
|
198 |
$pfd = fopen("{$g['vardb_path']}/ipsecpinghosts", "w"); |
|
199 |
if ($pfd) { |
|
200 |
fwrite($pfd, $ipsecpinghosts); |
|
201 |
fclose($pfd); |
|
195 | 202 |
} |
196 | 203 |
} |
197 |
$pfd = fopen("{$g['vardb_path']}/ipsecpinghosts", "w"); |
|
198 |
if ($pfd) { |
|
199 |
fwrite($pfd, $ipsecpinghosts); |
|
200 |
fclose($pfd); |
|
201 |
} |
|
202 |
|
|
203 | 204 |
} |
204 | 205 |
} |
205 | 206 |
|
Also available in: Unified diff
Only do foreach on the p2's if it's actually an array.