Add a new condition to mark IKE_SAs that are currently being reauthenticated

This commit is contained in:
Tobias Brunner
2012-09-06 11:23:11 +02:00
parent 4c91845452
commit 873b63b771
2 changed files with 9 additions and 9 deletions
+4 -9
View File
@@ -251,11 +251,6 @@ struct private_ike_sa_t {
* Flush auth configs once established? * Flush auth configs once established?
*/ */
bool flush_auth_cfg; bool flush_auth_cfg;
/**
* TRUE if we are currently reauthenticating this IKE_SA
*/
bool is_reauthenticating;
}; };
/** /**
@@ -1491,7 +1486,7 @@ METHOD(ike_sa_t, reauth, status_t,
DBG0(DBG_IKE, "reauthenticating IKE_SA %s[%d]", DBG0(DBG_IKE, "reauthenticating IKE_SA %s[%d]",
get_name(this), this->unique_id); get_name(this), this->unique_id);
} }
this->is_reauthenticating = TRUE; set_condition(this, COND_REAUTHENTICATING, TRUE);
this->task_manager->queue_ike_reauth(this->task_manager); this->task_manager->queue_ike_reauth(this->task_manager);
return this->task_manager->initiate(this->task_manager); return this->task_manager->initiate(this->task_manager);
} }
@@ -1508,7 +1503,7 @@ METHOD(ike_sa_t, reestablish, status_t,
bool restart = FALSE; bool restart = FALSE;
status_t status = FAILED; status_t status = FAILED;
if (this->is_reauthenticating) if (has_condition(this, COND_REAUTHENTICATING))
{ /* only reauthenticate if we have children */ { /* only reauthenticate if we have children */
if (this->child_sas->get_count(this->child_sas) == 0 if (this->child_sas->get_count(this->child_sas) == 0
#ifdef ME #ifdef ME
@@ -1608,7 +1603,7 @@ METHOD(ike_sa_t, reestablish, status_t,
enumerator = this->child_sas->create_enumerator(this->child_sas); enumerator = this->child_sas->create_enumerator(this->child_sas);
while (enumerator->enumerate(enumerator, (void**)&child_sa)) while (enumerator->enumerate(enumerator, (void**)&child_sa))
{ {
if (this->is_reauthenticating) if (has_condition(this, COND_REAUTHENTICATING))
{ {
switch (child_sa->get_state(child_sa)) switch (child_sa->get_state(child_sa))
{ {
@@ -1703,7 +1698,7 @@ METHOD(ike_sa_t, retransmit, status_t,
} }
case IKE_DELETING: case IKE_DELETING:
DBG1(DBG_IKE, "proper IKE_SA delete failed, peer not responding"); DBG1(DBG_IKE, "proper IKE_SA delete failed, peer not responding");
if (this->is_reauthenticating) if (has_condition(this, COND_REAUTHENTICATING))
{ {
DBG1(DBG_IKE, "delete during reauthentication failed, " DBG1(DBG_IKE, "delete during reauthentication failed, "
"trying to reestablish IKE_SA anyway"); "trying to reestablish IKE_SA anyway");
+5
View File
@@ -175,6 +175,11 @@ enum ike_condition_t {
* Peer has been authenticated using XAuth * Peer has been authenticated using XAuth
*/ */
COND_XAUTH_AUTHENTICATED = (1<<9), COND_XAUTH_AUTHENTICATED = (1<<9),
/**
* This IKE_SA is currently being reauthenticated
*/
COND_REAUTHENTICATING = (1<<10),
}; };
/** /**