summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip4_forward.c
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2019-08-03 14:36:39 -0400
committerJohn Lo <loj@cisco.com>2019-08-03 14:36:39 -0400
commit3bc6bc21fb79a9da4ec674f5e6a3303e7e2be625 (patch)
treebdbcc110b99bacfe3851836cefdda1826e710589 /src/vnet/ip/ip4_forward.c
parent46eb1950a13b7b01afcc83cb3d8ce59012dfee46 (diff)
ip: fix ip6/udp checksum for pkts using buffer chaining
Fix ip6_tcp_udp_icmp_compute_checksum to work properly for packets with multiple buffers. Fix ip4_tcp_udp_compute_checksum to exit upon detecting error. Type: fix Signed-off-by: John Lo <loj@cisco.com> Change-Id: I673547f4479d72cd60757383343fc562cff10265
Diffstat (limited to 'src/vnet/ip/ip4_forward.c')
-rw-r--r--src/vnet/ip/ip4_forward.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index 03b0f3e740a..754bb21fe67 100644
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -1188,6 +1188,9 @@ ip4_tcp_udp_compute_checksum (vlib_main_t * vm, vlib_buffer_t * p0,
break;
ASSERT (p0->flags & VLIB_BUFFER_NEXT_PRESENT);
+ if (!(p0->flags & VLIB_BUFFER_NEXT_PRESENT))
+ return 0xfefe;
+
p0 = vlib_get_buffer (vm, p0->next_buffer);
data_this_buffer = vlib_buffer_get_current (p0);
n_this_buffer = clib_min (p0->current_length, n_bytes_left);