interface: Add missing ip4 udp->checksum = 0 prior to computing checksum 04/28304/1
authorSteven Luong <sluong@cisco.com>
Mon, 27 Jan 2020 18:37:56 +0000 (10:37 -0800)
committerAndrew Yourtchenko <ayourtch@gmail.com>
Wed, 12 Aug 2020 15:59:46 +0000 (15:59 +0000)
For ip4 tcp, ip6 tcp, and ip6 udp packet, we set checksum = 0 prior to
computing the checksum. We missed ip4 udp case. This oversight requires all
clients to set udp->checksum = 0 if ip4 udp checksum offload is needed.

Type: fix

Signed-off-by: Steven Luong <sluong@cisco.com>
Change-Id: Ic608811e82099f3bec469e123671e9b281f38d76
(cherry picked from commit 03328ec8bb86b93fa70bb6b2a9b37c40e686a1f7)

src/vnet/interface_output.c

index ec92c38..549ed91 100644 (file)
@@ -204,7 +204,10 @@ calc_checksums (vlib_main_t * vm, vlib_buffer_t * b)
          th->checksum = ip4_tcp_udp_compute_checksum (vm, b, ip4);
        }
       else if (b->flags & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM)
-       uh->checksum = ip4_tcp_udp_compute_checksum (vm, b, ip4);
+       {
+         uh->checksum = 0;
+         uh->checksum = ip4_tcp_udp_compute_checksum (vm, b, ip4);
+       }
     }
   else if (is_ip6)
     {