summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/ip4.h4
-rwxr-xr-xsrc/vnet/ip/ip4_forward.c9
2 files changed, 9 insertions, 4 deletions
diff --git a/src/vnet/ip/ip4.h b/src/vnet/ip/ip4.h
index 71640defb21..19198bcb66b 100644
--- a/src/vnet/ip/ip4.h
+++ b/src/vnet/ip/ip4.h
@@ -42,6 +42,7 @@
#include <vnet/ip/ip4_packet.h>
#include <vnet/ip/lookup.h>
+#include <vnet/buffer.h>
#include <vnet/feature/feature.h>
typedef struct ip4_mfib_t
@@ -346,7 +347,8 @@ 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;
- ih->checksum = ip4_header_checksum (ih);
+ ih->checksum = 0;
+ b->flags |= VNET_BUFFER_F_OFFLOAD_IP_CKSUM | VNET_BUFFER_F_IS_IP4;
return ih;
}
#endif /* included_ip_ip4_h */
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index 8dd927d4afd..4a9e7919140 100755
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -2457,7 +2457,8 @@ ip4_rewrite_inline (vlib_main_t * vm,
}
/* Verify checksum. */
- ASSERT (ip0->checksum == ip4_header_checksum (ip0));
+ ASSERT ((ip0->checksum == ip4_header_checksum (ip0)) ||
+ (p0->flags | VNET_BUFFER_F_OFFLOAD_IP_CKSUM));
}
else
{
@@ -2492,7 +2493,8 @@ ip4_rewrite_inline (vlib_main_t * vm,
}
/* Verify checksum. */
- ASSERT (ip1->checksum == ip4_header_checksum (ip1));
+ ASSERT ((ip1->checksum == ip4_header_checksum (ip1)) ||
+ (p1->flags | VNET_BUFFER_F_OFFLOAD_IP_CKSUM));
}
else
{
@@ -2630,7 +2632,8 @@ ip4_rewrite_inline (vlib_main_t * vm,
ip0->ttl = ttl0;
- ASSERT (ip0->checksum == ip4_header_checksum (ip0));
+ ASSERT ((ip0->checksum == ip4_header_checksum (ip0)) ||
+ (p0->flags | VNET_BUFFER_F_OFFLOAD_IP_CKSUM));
if (PREDICT_FALSE (ttl0 <= 0))
{