diff options
author | Jakub Grajciar <Jakub.Grajciar@pantheon.tech> | 2017-10-30 14:56:17 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2017-11-03 14:55:14 +0000 |
commit | 96be8e88109b3e166b76f58e552dbe438d73bb73 (patch) | |
tree | e52ae6fe6cddc070a21b0fe0bf5955ea80c88d1b /src/vnet | |
parent | 0dc11a11207d64a81f937cde0d38a80629b937e2 (diff) |
vnet: ip4/6_local->don't drop packet if marked for TCP/UDP offload cksum calculation
Change-Id: I62f625a93e5d818caef382316035cd5447bd8fef
Signed-off-by: Jakub Grajciar <Jakub.Grajciar@pantheon.tech>
Diffstat (limited to 'src/vnet')
-rwxr-xr-x | src/vnet/ip/ip4_forward.c | 19 | ||||
-rw-r--r-- | src/vnet/ip/ip6_forward.c | 15 |
2 files changed, 26 insertions, 8 deletions
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c index 8b21869a410..4c559d59df3 100755 --- a/src/vnet/ip/ip4_forward.c +++ b/src/vnet/ip/ip4_forward.c @@ -1498,7 +1498,9 @@ ip4_local_validate_l4 (vlib_main_t * vm, vlib_buffer_t * p, ip4_header_t * ip, } #define ip4_local_do_l4_check(is_tcp_udp, flags) \ - (is_tcp_udp && !(flags & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED)) + (is_tcp_udp && !(flags & VNET_BUFFER_F_L4_CHECKSUM_COMPUTED \ + || flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM \ + || flags & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM)) static inline uword ip4_local_inline (vlib_main_t * vm, @@ -1574,9 +1576,13 @@ ip4_local_inline (vlib_main_t * vm, is_tcp_udp1 = is_udp1 || proto1 == IP_PROTOCOL_TCP; good_tcp_udp0 = - (p0->flags & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0; - good_tcp_udp1 = - (p1->flags & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0; + (p0->flags & VNET_BUFFER_F_L4_CHECKSUM_CORRECT + && !(p0->flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM + || p0->flags & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM)) != 0; + good_tcp_udp1 = (p1->flags & VNET_BUFFER_F_L4_CHECKSUM_CORRECT + && !(p1->flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM + || p1->flags & + VNET_BUFFER_F_OFFLOAD_UDP_CKSUM)) != 0; if (PREDICT_FALSE (ip4_local_do_l4_check (is_tcp_udp0, p0->flags) || ip4_local_do_l4_check (is_tcp_udp1, @@ -1731,8 +1737,11 @@ ip4_local_inline (vlib_main_t * vm, is_udp0 = proto0 == IP_PROTOCOL_UDP; is_tcp_udp0 = is_udp0 || proto0 == IP_PROTOCOL_TCP; + good_tcp_udp0 = - (p0->flags & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0; + (p0->flags & VNET_BUFFER_F_L4_CHECKSUM_CORRECT + && !(p0->flags & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM + || p0->flags & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM)) != 0; if (PREDICT_FALSE (ip4_local_do_l4_check (is_tcp_udp0, p0->flags))) { diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c index 6b89ec38aae..7a8b5ed2d98 100644 --- a/src/vnet/ip/ip6_forward.c +++ b/src/vnet/ip/ip6_forward.c @@ -1341,8 +1341,14 @@ ip6_local_inline (vlib_main_t * vm, vlib_node_runtime_t * node, is_tcp_udp0 = ip6_next_proto_is_tcp_udp (p0, ip0, &udp_offset0); is_tcp_udp1 = ip6_next_proto_is_tcp_udp (p1, ip1, &udp_offset1); - good_l4_csum0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0; - good_l4_csum1 = (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0; + good_l4_csum0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT + && !(flags0 & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM + || flags0 & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM)) + != 0; + good_l4_csum1 = (flags1 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT + && !(flags1 & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM + || flags1 & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM)) + != 0; len_diff0 = 0; len_diff1 = 0; @@ -1506,7 +1512,10 @@ ip6_local_inline (vlib_main_t * vm, vlib_node_runtime_t * node, type0 = lm->builtin_protocol_by_ip_protocol[ip0->protocol]; flags0 = p0->flags; is_tcp_udp0 = ip6_next_proto_is_tcp_udp (p0, ip0, &udp_offset0); - good_l4_csum0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT) != 0; + good_l4_csum0 = (flags0 & VNET_BUFFER_F_L4_CHECKSUM_CORRECT + && !(flags0 & VNET_BUFFER_F_OFFLOAD_TCP_CKSUM + || flags0 & VNET_BUFFER_F_OFFLOAD_UDP_CKSUM)) + != 0; len_diff0 = 0; if (PREDICT_TRUE (is_tcp_udp0)) |