From: Hongjun Ni Date: Thu, 14 Jun 2018 21:32:23 +0000 (+0800) Subject: Fix assert issue in ip_csum_add_even() X-Git-Tag: v18.07-rc1~100 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F55%2F13055%2F6;p=vpp.git Fix assert issue in ip_csum_add_even() ASSERT (ip_csum_with_carry (d, x) == c) will raise assert if d equals to zero while x not equals to zero. Change-Id: Ia9ccdbf801ae565eaadd49f04569d13bfc31cba8 Signed-off-by: Hongjun Ni --- diff --git a/src/vnet/ip/ip_packet.h b/src/vnet/ip/ip_packet.h index 3c532f10ffe..6c86e3e046e 100644 --- a/src/vnet/ip/ip_packet.h +++ b/src/vnet/ip/ip_packet.h @@ -107,7 +107,8 @@ ip_csum_add_even (ip_csum_t c, ip_csum_t x) /* Fold in carry from high bit. */ d -= d > c; - ASSERT (ip_csum_with_carry (d, x) == c); + ip_csum_t t = ip_csum_with_carry (d, x); + ASSERT ((t - c == 0) || (t - c == ~0)); return d; }