Clear virtual IPs before storing assigned ones on the IKE_SA

Otherwise we'll end up with duplicate or invalid VIPs stored on the
IKE_SA.
This commit is contained in:
Tobias Brunner
2012-09-05 14:35:57 +02:00
parent 4c892fe533
commit d2e8f20d94
5 changed files with 43 additions and 1 deletions
+10 -1
View File
@@ -310,7 +310,7 @@ static void process_ike_update(private_ha_dispatcher_t *this,
ike_sa_t *ike_sa = NULL;
peer_cfg_t *peer_cfg = NULL;
auth_cfg_t *auth;
bool received_vip = FALSE, first_peer_addr = TRUE;
bool received_vip = FALSE, first_local_vip = TRUE, first_peer_addr = TRUE;
enumerator = message->create_attribute_enumerator(message);
while (enumerator->enumerate(enumerator, &attribute, &value))
@@ -344,9 +344,18 @@ static void process_ike_update(private_ha_dispatcher_t *this,
ike_sa->set_other_host(ike_sa, value.host->clone(value.host));
break;
case HA_LOCAL_VIP:
if (first_local_vip)
{
ike_sa->clear_virtual_ips(ike_sa, TRUE);
first_local_vip = FALSE;
}
ike_sa->add_virtual_ip(ike_sa, TRUE, value.host);
break;
case HA_REMOTE_VIP:
if (!received_vip)
{
ike_sa->clear_virtual_ips(ike_sa, FALSE);
}
ike_sa->add_virtual_ip(ike_sa, FALSE, value.host);
received_vip = TRUE;
break;