mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
This should fix ipsec status for natted tunnel(s).
This commit is contained in:
parent
909890c4f0
commit
f3c338b3b3
@ -329,12 +329,17 @@ function ipsec_phase2_status(& $spd,& $sad,& $ph1ent,& $ph2ent) {
|
||||
$rmt_ip = ipsec_get_phase1_dst($ph1ent);
|
||||
|
||||
$loc_id = ipsec_idinfo_to_cidr($ph2ent['localid'],true);
|
||||
if (!empty($ph2ent['natlocalid']))
|
||||
$natloc_id = ipsec_idinfo_to_cidr($ph2ent['natlocalid'],true);
|
||||
$rmt_id = ipsec_idinfo_to_cidr($ph2ent['remoteid'],true);
|
||||
|
||||
/* check for established SA in both directions */
|
||||
if( ipsec_lookup_ipsec_sa($spd,$sad,"out",$loc_ip,$rmt_ip,$loc_id,$rmt_id) &&
|
||||
ipsec_lookup_ipsec_sa($spd,$sad,"in",$rmt_ip,$loc_ip,$rmt_id,$loc_id))
|
||||
return true;
|
||||
if( ipsec_lookup_ipsec_sa($spd,$sad,"out",$loc_ip,$rmt_ip,$loc_id,$rmt_id)) {
|
||||
if (empty($ph2ent['natlocalid']) && ipsec_lookup_ipsec_sa($spd,$sad,"in",$rmt_ip,$loc_ip,$rmt_id,$loc_id))
|
||||
return true;
|
||||
else if (!empty($ph2ent['natlocalid']) && ipsec_lookup_ipsec_sa($spd,$sad,"in",$rmt_ip,$loc_ip,$rmt_id,$natloc_id))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user