aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/encoding
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2011-11-21 10:22:50 +0100
committerMartin Willi <martin@revosec.ch>2012-03-20 17:30:44 +0100
commitcbb6d765bc29963f3faaf945e4b321204a2f6cd2 (patch)
tree279c68e5972e511c128a083a66cfca3e52a39ae4 /src/libcharon/encoding
parent4ea258538e396949b6c8c626e80bf8cc3c191dc3 (diff)
downloadstrongswan-cbb6d765bc29963f3faaf945e4b321204a2f6cd2.tar.bz2
strongswan-cbb6d765bc29963f3faaf945e4b321204a2f6cd2.tar.xz
Fixed length calculation of delete payload
Diffstat (limited to 'src/libcharon/encoding')
-rw-r--r--src/libcharon/encoding/payloads/delete_payload.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/libcharon/encoding/payloads/delete_payload.c b/src/libcharon/encoding/payloads/delete_payload.c
index 7cf14cd25..f5bdb3809 100644
--- a/src/libcharon/encoding/payloads/delete_payload.c
+++ b/src/libcharon/encoding/payloads/delete_payload.c
@@ -211,9 +211,9 @@ METHOD(payload_t, get_header_length, int,
{
if (this->type == DELETE)
{
- return 8;
+ return 8 + this->spi_size;
}
- return 12;
+ return 12 + this->spi_size;
}
METHOD(payload_t, get_payload_type, payload_type_t,
@@ -255,6 +255,7 @@ 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:
@@ -336,11 +337,12 @@ delete_payload_t *delete_payload_create(payload_type_t type,
.destroy = _destroy,
},
.next_payload = NO_PAYLOAD,
- .payload_length = get_header_length(this),
.doi = IKEV1_DOI_IPSEC,
.protocol_id = protocol_id,
.spi_size = protocol_id == PROTO_AH || protocol_id == PROTO_ESP ? 4 : 0,
.type = type,
);
+ this->payload_length = get_header_length(this);
+
return &this->public;
}