mfontanini / libtins

High-level, multiplatform C++ network packet sniffing and crafting library.
http://libtins.github.io/
BSD 2-Clause "Simplified" License
1.91k stars 375 forks source link

Malformed packet exception on ipv6 with esp header #373

Closed ayum closed 4 years ago

ayum commented 4 years ago

When ipv6 packet has esp header libtins throw malformed packet exception. Example pcap is attached to issue.

As i can see, a problem is that esp extension does not have ordinary extension header format. See rfc2406. It just has SPI and Sequence number and that is all, trailing bytes are encrypted and libtins' ipv6 parser cannot does much about it. Better just pass it to ipsec parser that can parse SPI, sequence number and trailing bytes will be RawPDU.

I'l try to do Pull Request

esp.pcap.zip