ip-packet: Fix removal of TFC padding for IPv6

The IPv6 length field denotes the payload length after the 40 bytes header.

Fixes: 293515f95c ("libipsec: remove extra RFC4303 TFC padding appended to inner payload")
This commit is contained in:
Tobias Brunner
2014-10-14 14:10:33 +02:00
parent 283229bcb7
commit 15dee933de
+1 -1
View File
@@ -247,7 +247,7 @@ ip_packet_t *ip_packet_create(chunk_t packet)
}
ip = (struct ip6_hdr*)packet.ptr;
/* remove any RFC 4303 TFC extra padding */
packet.len = min(packet.len, untoh16(&ip->ip6_plen));
packet.len = min(packet.len, 40 + untoh16(&ip->ip6_plen));
/* we only handle packets without extension headers, just skip the
* basic IPv6 header */
payload = chunk_skip(packet, 40);