diff options
author | 2019-11-26 18:43:25 -0800 | |
---|---|---|
committer | 2020-08-12 07:43:14 +0000 | |
commit | 2b9bf4f4a723d2bcedcbea096c30fe4f4fa7f2a1 (patch) | |
tree | 6e530dec1bdce214c3c754b5431b3d6279356e0f /src | |
parent | c7e400f8af801639ba9b855da78eb0d8fca9032f (diff) |
ip: init l3_hdr_offset when pushing an ip4 header
Type: fix
Change-Id: I87503b9a981724b1f3ff1c45a4a5f7a43024ca76
Signed-off-by: Florin Coras <fcoras@cisco.com>
(cherry picked from commit 757de9873bbaf2d21d107da42c6bbeb2804c7fcc)
Diffstat (limited to 'src')
-rw-r--r-- | src/vnet/ip/ip4.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/vnet/ip/ip4.h b/src/vnet/ip/ip4.h index 2a3743febb3..339b84b1b62 100644 --- a/src/vnet/ip/ip4.h +++ b/src/vnet/ip/ip4.h @@ -401,16 +401,14 @@ vlib_buffer_push_ip4 (vlib_main_t * vm, vlib_buffer_t * b, ih->src_address.as_u32 = src->as_u32; ih->dst_address.as_u32 = dst->as_u32; + vnet_buffer (b)->l3_hdr_offset = (u8 *) ih - b->data; + b->flags |= VNET_BUFFER_F_IS_IP4 | VNET_BUFFER_F_L3_HDR_OFFSET_VALID; + /* Offload ip4 header checksum generation */ if (csum_offload) { ih->checksum = 0; - b->flags |= VNET_BUFFER_F_OFFLOAD_IP_CKSUM | VNET_BUFFER_F_IS_IP4; - vnet_buffer (b)->l3_hdr_offset = (u8 *) ih - b->data; - vnet_buffer (b)->l4_hdr_offset = vnet_buffer (b)->l3_hdr_offset + - sizeof (*ih); - b->flags |= - VNET_BUFFER_F_L3_HDR_OFFSET_VALID | VNET_BUFFER_F_L4_HDR_OFFSET_VALID; + b->flags |= VNET_BUFFER_F_OFFLOAD_IP_CKSUM; } else ih->checksum = ip4_header_checksum (ih); |