Accept packets that use tcp segment offloading.

When checksum offloading is enabled, we now forward packets that
have 0 header lengths set - and assume that they have TSO enabled.

If checksum offloading is not enabled, we drop the packets.

Addresses GH-1829
This commit is contained in:
Johanna Amann 2021-10-28 16:55:02 +02:00
parent 20d1b89caa
commit e14b695497
5 changed files with 20 additions and 6 deletions

View file

@ -415,7 +415,11 @@ public:
uint16_t PayloadLen() const
{
if ( ip4 )
return ntohs(ip4->ip_len) - ip4->ip_hl * 4;
{
// prevent overflow in case of segment offloading/zeroed header length.
auto total_len = ntohs(ip4->ip_len);
return total_len ? total_len - ip4->ip_hl * 4 : 0;
}
return ntohs(ip6->ip6_plen) + 40 - ip6_hdrs->TotalLength();
}