diff options
author | Hongjun Ni <hongjun.ni@intel.com> | 2018-06-15 05:32:23 +0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-06-26 19:54:12 +0000 |
commit | 79c38af0fded49e65fd09fbd9bfa1dda8af475ec (patch) | |
tree | 141b1932f2d046264e52eafd5a70885be74e7ea1 /src/vnet | |
parent | 352c2c40c720acefaa49ade61cf9e8fdef3c846f (diff) |
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 <hongjun.ni@intel.com>
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/ip/ip_packet.h | 3 |
1 files changed, 2 insertions, 1 deletions
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; } |