Store proposal number in proposal_t to reuse it in the selected proposal
According to RFC 5996 3.3.1, we MUST reuse the proposal number of the selected proposal in the SA payload reply.
This commit is contained in:
@@ -309,7 +309,7 @@ METHOD(proposal_substructure_t, get_proposal, proposal_t*,
|
||||
proposal_t *proposal;
|
||||
u_int64_t spi;
|
||||
|
||||
proposal = proposal_create(this->protocol_id);
|
||||
proposal = proposal_create(this->protocol_id, this->proposal_number);
|
||||
|
||||
enumerator = this->transforms->create_enumerator(this->transforms);
|
||||
while (enumerator->enumerate(enumerator, &transform))
|
||||
@@ -498,7 +498,7 @@ proposal_substructure_t *proposal_substructure_create_from_proposal(
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this->proposal_number = 0;
|
||||
this->proposal_number = proposal->get_number(proposal);
|
||||
this->protocol_id = proposal->get_protocol(proposal);
|
||||
|
||||
return &this->public;
|
||||
|
||||
@@ -204,8 +204,15 @@ METHOD(sa_payload_t, add_proposal, void,
|
||||
last->set_is_last_proposal(last, FALSE);
|
||||
}
|
||||
substruct->set_is_last_proposal(substruct, TRUE);
|
||||
substruct->set_proposal_number(substruct, count + 1);
|
||||
this->proposals->insert_last(this->proposals, proposal);
|
||||
if (proposal->get_number(proposal))
|
||||
{ /* use the selected proposals number, if any */
|
||||
substruct->set_proposal_number(substruct, proposal->get_number(proposal));
|
||||
}
|
||||
else
|
||||
{
|
||||
substruct->set_proposal_number(substruct, count + 1);
|
||||
}
|
||||
this->proposals->insert_last(this->proposals, substruct);
|
||||
compute_length(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user