ip: fix assert in ip4_ttl_inc 39/35439/2
authorAloys Augustin <aloaugus@cisco.com>
Thu, 24 Feb 2022 15:44:23 +0000 (15:44 +0000)
committerBeno�t Ganne <bganne@cisco.com>
Fri, 18 Mar 2022 08:25:11 +0000 (08:25 +0000)
There is no need to verify the checksum for packets that have the IP
checksum offload flag set. This uses the same logic as
ip4_ttl_and_checksum_check.

Type: fix

Signed-off-by: Aloys Augustin <aloaugus@cisco.com>
Change-Id: I177b07212a992362a4c965c074dcecf1e504c593

src/vnet/ip/ip4_forward.c

index 3c67bb3..3556d35 100644 (file)
@@ -2055,7 +2055,9 @@ ip4_ttl_inc (vlib_buffer_t * b, ip4_header_t * ip)
   ttl += 1;
   ip->ttl = ttl;
 
-  ASSERT (ip4_header_checksum_is_valid (ip));
+  ASSERT (ip4_header_checksum_is_valid (ip) ||
+         (vnet_buffer (b)->oflags & VNET_BUFFER_OFFLOAD_F_IP_CKSUM) ||
+         (vnet_buffer (b)->oflags & VNET_BUFFER_OFFLOAD_F_OUTER_IP_CKSUM));
 }
 
 /* Decrement TTL & update checksum.