moved AUTH_LIFETIME handling in its own task (cleaner separation, proper payload order)

This commit is contained in:
Martin Willi
2007-12-03 10:52:18 +00:00
parent 8e78e43220
commit 7805ad302d
8 changed files with 294 additions and 34 deletions
+1 -23
View File
@@ -297,22 +297,6 @@ static status_t collect_other_init_data(private_ike_auth_t *this, message_t *mes
return NEED_MORE;
}
/**
* add the AUTH_LIFETIME notify to the message
*/
static void add_auth_lifetime(private_ike_auth_t *this, message_t *message)
{
chunk_t chunk;
u_int32_t lifetime;
lifetime = this->ike_sa->get_statistic(this->ike_sa, STAT_REAUTH_TIME);
if (lifetime)
{
chunk = chunk_from_thing(lifetime);
*(u_int32_t*)chunk.ptr = htonl(lifetime);
message->add_notify(message, FALSE, AUTH_LIFETIME, chunk);
}
}
/**
* Implementation of task_t.build to create AUTH payload from EAP data
@@ -343,7 +327,6 @@ static status_t build_auth_eap(private_ike_auth_t *this, message_t *message)
this->ike_sa->get_my_host(this->ike_sa),
this->ike_sa->get_other_host(this->ike_sa),
this->ike_sa->get_other_id(this->ike_sa));
add_auth_lifetime(this, message);
return SUCCESS;
}
return NEED_MORE;
@@ -600,7 +583,6 @@ static status_t build_r(private_ike_auth_t *this, message_t *message)
this->ike_sa->get_my_host(this->ike_sa),
this->ike_sa->get_other_host(this->ike_sa),
this->ike_sa->get_other_id(this->ike_sa));
add_auth_lifetime(this, message);
return SUCCESS;
}
@@ -666,12 +648,8 @@ static status_t process_i(private_ike_auth_t *this, message_t *message)
/* handled in ike_mobike task */
break;
case AUTH_LIFETIME:
{
chunk_t data = notify->get_notification_data(notify);
u_int32_t lifetime = ntohl(*(u_int32_t*)data.ptr);
this->ike_sa->set_auth_lifetime(this->ike_sa, lifetime);
/* handled in ike_auth_lifetime task */
break;
}
default:
{
if (type < 16383)