diff options
author | Florin Coras <fcoras@cisco.com> | 2017-07-27 00:34:12 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2017-08-02 00:03:45 +0000 |
commit | fdbc38249a8c672937a74667dcfaafa2cfd292e7 (patch) | |
tree | 266d4b90330e508163c560ba01226c3248d5a39c /src/vnet/ip | |
parent | a0a908f1dfb679c384ab34ee3c1a2a63ba2448df (diff) |
Make ip csum configurable in vlib buffer functions
Also fixes csum computation for lisp control plane 4o6 encapsulated control
messages.
Change-Id: I991e0b5c0d16dc51e0b5bdc79e1d752270b34765
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/ip')
-rw-r--r-- | src/vnet/ip/ip4.h | 5 | ||||
-rw-r--r-- | src/vnet/ip/ip6.h | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/vnet/ip/ip4.h b/src/vnet/ip/ip4.h index 872b516cfa9..8f9a8e27bf5 100644 --- a/src/vnet/ip/ip4.h +++ b/src/vnet/ip/ip4.h @@ -329,7 +329,8 @@ u32 ip4_tcp_udp_validate_checksum (vlib_main_t * vm, vlib_buffer_t * p0); */ always_inline void * vlib_buffer_push_ip4 (vlib_main_t * vm, vlib_buffer_t * b, - ip4_address_t * src, ip4_address_t * dst, int proto) + ip4_address_t * src, ip4_address_t * dst, int proto, + u8 csum_offload) { ip4_header_t *ih; @@ -348,7 +349,7 @@ vlib_buffer_push_ip4 (vlib_main_t * vm, vlib_buffer_t * b, ih->dst_address.as_u32 = dst->as_u32; /* Offload ip4 header checksum generation */ - if (1) + if (csum_offload) { ih->checksum = 0; b->flags |= VNET_BUFFER_F_OFFLOAD_IP_CKSUM | VNET_BUFFER_F_IS_IP4; diff --git a/src/vnet/ip/ip6.h b/src/vnet/ip/ip6.h index cf52994e720..fa922725d4a 100644 --- a/src/vnet/ip/ip6.h +++ b/src/vnet/ip/ip6.h @@ -576,6 +576,7 @@ vlib_buffer_push_ip6 (vlib_main_t * vm, vlib_buffer_t * b, sizeof (ip6h->src_address)); clib_memcpy (ip6h->dst_address.as_u8, dst->as_u8, sizeof (ip6h->src_address)); + b->flags |= VNET_BUFFER_F_IS_IP6; return ip6h; } |