fixed CREATE_CHILD_SA transaction dispatching
This commit is contained in:
@@ -44,7 +44,6 @@ transaction_t *transaction_create(ike_sa_t *ike_sa, message_t *request)
|
|||||||
{
|
{
|
||||||
iterator_t *iterator;
|
iterator_t *iterator;
|
||||||
payload_t *current;
|
payload_t *current;
|
||||||
notify_payload_t *notify;
|
|
||||||
transaction_t *transaction = NULL;
|
transaction_t *transaction = NULL;
|
||||||
|
|
||||||
if (!request->get_request(request))
|
if (!request->get_request(request))
|
||||||
@@ -74,34 +73,35 @@ transaction_t *transaction_create(ike_sa_t *ike_sa, message_t *request)
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* look for a REKEY_SA notify */
|
/* check protocol of SA payload */
|
||||||
iterator = request->get_payload_iterator(request);
|
iterator = request->get_payload_iterator(request);
|
||||||
while (iterator->has_next(iterator))
|
while (iterator->iterate(iterator, (void**)¤t))
|
||||||
{
|
{
|
||||||
iterator->current(iterator, (void**)¤t);
|
if (current->get_type(current) == SECURITY_ASSOCIATION)
|
||||||
if (current->get_type(current) != NOTIFY)
|
|
||||||
{
|
{
|
||||||
continue;
|
iterator_t *prop_iter;
|
||||||
}
|
proposal_substructure_t *prop_struct;
|
||||||
notify = (notify_payload_t*)current;
|
sa_payload_t *sa_payload = (sa_payload_t*)current;
|
||||||
if (notify->get_notify_type(notify) != REKEY_SA)
|
|
||||||
{
|
prop_iter = sa_payload->create_proposal_substructure_iterator(sa_payload, TRUE);
|
||||||
continue;
|
if (prop_iter->iterate(prop_iter, (void**)&prop_struct))
|
||||||
}
|
{
|
||||||
switch (notify->get_protocol_id(notify))
|
switch (prop_struct->get_protocol_id(prop_struct))
|
||||||
{
|
{
|
||||||
case PROTO_IKE:
|
case PROTO_IKE:
|
||||||
/* TODO: transaction = rekey_ike_sa_create(ike_sa); */
|
/* TODO: transaction = (transaction_t*)
|
||||||
break;
|
rekey_ike_sa_create(ike_sa); */
|
||||||
case PROTO_AH:
|
break;
|
||||||
case PROTO_ESP:
|
case PROTO_AH:
|
||||||
/* we do not handle rekeying of CHILD_SAs in a special
|
case PROTO_ESP:
|
||||||
* transaction, as the procedure is nearly equal
|
transaction = (transaction_t*)
|
||||||
* to create a new CHILD_SA. */
|
create_child_sa_create(ike_sa);
|
||||||
transaction = (transaction_t*)create_child_sa_create(ike_sa);
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
break;
|
||||||
break;
|
}
|
||||||
|
}
|
||||||
|
prop_iter->destroy(prop_iter);
|
||||||
}
|
}
|
||||||
if (transaction)
|
if (transaction)
|
||||||
{
|
{
|
||||||
@@ -109,13 +109,6 @@ transaction_t *transaction_create(ike_sa_t *ike_sa, message_t *request)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
iterator->destroy(iterator);
|
iterator->destroy(iterator);
|
||||||
if (!transaction)
|
|
||||||
{
|
|
||||||
/* we have not found a REKEY_SA notify for IKE. This means
|
|
||||||
* we create a new CHILD_SA, or rekey an existing one.
|
|
||||||
* Both cases are handled with the create_child_sa transaction. */
|
|
||||||
transaction = (transaction_t*)create_child_sa_create(ike_sa);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case INFORMATIONAL:
|
case INFORMATIONAL:
|
||||||
@@ -126,16 +119,14 @@ transaction_t *transaction_create(ike_sa_t *ike_sa, message_t *request)
|
|||||||
}
|
}
|
||||||
u_int payload_count = 0;
|
u_int payload_count = 0;
|
||||||
iterator = request->get_payload_iterator(request);
|
iterator = request->get_payload_iterator(request);
|
||||||
while (iterator->has_next(iterator))
|
while (iterator->iterate(iterator, (void**)¤t))
|
||||||
{
|
{
|
||||||
payload_count++;
|
payload_count++;
|
||||||
iterator->current(iterator, (void**)¤t);
|
|
||||||
switch (current->get_type(current))
|
switch (current->get_type(current))
|
||||||
{
|
{
|
||||||
case DELETE:
|
case DELETE:
|
||||||
{
|
{
|
||||||
delete_payload_t *delete_payload;
|
delete_payload_t *delete_payload = (delete_payload_t*)current;
|
||||||
delete_payload = (delete_payload_t*)current;
|
|
||||||
switch (delete_payload->get_protocol_id(delete_payload))
|
switch (delete_payload->get_protocol_id(delete_payload))
|
||||||
{
|
{
|
||||||
case PROTO_IKE:
|
case PROTO_IKE:
|
||||||
|
|||||||
Reference in New Issue
Block a user