From 226b0f36c74f7739dbf498ad0093e9e208a7db6f Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Tue, 13 Dec 2011 11:30:35 +0100 Subject: [PATCH] Fixed SPI size calculation in DELETE payload --- src/libcharon/encoding/payloads/delete_payload.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/libcharon/encoding/payloads/delete_payload.c b/src/libcharon/encoding/payloads/delete_payload.c index 3222e9fbe..dec1ba72a 100644 --- a/src/libcharon/encoding/payloads/delete_payload.c +++ b/src/libcharon/encoding/payloads/delete_payload.c @@ -264,7 +264,6 @@ METHOD(delete_payload_t, add_spi, void, case PROTO_ESP: this->spi_count++; this->payload_length += sizeof(spi); - this->spi_size += sizeof(spi); this->spis = chunk_cat("mc", this->spis, chunk_from_thing(spi)); break; default: @@ -362,17 +361,17 @@ delete_payload_t *delete_payload_create(payload_type_t type, ); this->payload_length = get_header_length(this); - if (type == DELETE_V1) + if (protocol_id == PROTO_IKE) { - if (protocol_id == PROTO_IKE) + if (type == DELETE_V1) { this->spi_size = 16; } - else - { - this->doi = IKEV1_DOI_IPSEC, - this->spi_size = 4; - } + } + else + { + this->doi = IKEV1_DOI_IPSEC, + this->spi_size = 4; } return &this->public; }