ikev1: Accept IPComp proposals with 4 octet long CPI values

While they SHOULD be sent as 16-bit values according to RFC 3173
a responder MUST be able to accept CPI values encoded in four bytes.
This commit is contained in:
Tobias Brunner 2014-11-04 18:24:16 +01:00
parent 42e0a317c6
commit 4141f01671
1 changed files with 2 additions and 2 deletions

View File

@ -345,7 +345,7 @@ METHOD(payload_t, verify, status_t,
switch (this->protocol_id)
{
case PROTO_IPCOMP:
if (this->spi.len != 2)
if (this->spi.len != 2 && this->spi.len != 4)
{
DBG1(DBG_ENC, "invalid CPI length in IPCOMP proposal");
return FAILED;
@ -536,7 +536,7 @@ METHOD(proposal_substructure_t, get_cpi, bool,
{
if (cpi)
{
*cpi = *((u_int16_t*)this->spi.ptr);
*cpi = htons(untoh16(this->spi.ptr + this->spi.len - 2));
}
enumerator->destroy(enumerator);
return TRUE;