Include source port in init hash for fragmented messages

This commit is contained in:
Tobias Brunner
2012-12-24 12:29:31 +01:00
parent 2f62bb1549
commit e645c15b9c
+8 -1
View File
@@ -975,7 +975,8 @@ static bool get_init_hash(private_ike_sa_manager_t *this, message_t *message,
return FALSE;
}
if (message->get_first_payload_type(message) == FRAGMENT_V1)
{ /* only hash the source IP and SPI for fragmented init messages */
{ /* only hash the source IP, port and SPI for fragmented init messages */
u_int16_t port;
u_int64_t spi;
src = message->get_source(message);
@@ -984,6 +985,12 @@ static bool get_init_hash(private_ike_sa_manager_t *this, message_t *message,
{
return FALSE;
}
port = src->get_port(src);
if (!this->hasher->allocate_hash(this->hasher,
chunk_from_thing(port), NULL))
{
return FALSE;
}
spi = message->get_initiator_spi(message);
return this->hasher->allocate_hash(this->hasher,
chunk_from_thing(spi), hash);