From 68b493ff2fa04b3d283e9476e77ea2db116b1dd8 Mon Sep 17 00:00:00 2001 From: Klement Sekera Date: Thu, 25 Mar 2021 18:47:48 +0100 Subject: nat: avoid creating negative zero checksum Type: fix Signed-off-by: Klement Sekera Change-Id: Ibbb72e77c751b7e775620cfb160b52ceff2da86b --- src/plugins/nat/nat44-ed/nat44_ed.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/plugins/nat') diff --git a/src/plugins/nat/nat44-ed/nat44_ed.c b/src/plugins/nat/nat44-ed/nat44_ed.c index dc784d9ee92..6a0b962de6e 100644 --- a/src/plugins/nat/nat44-ed/nat44_ed.c +++ b/src/plugins/nat/nat44-ed/nat44_ed.c @@ -3330,7 +3330,9 @@ nat_6t_flow_ip4_translate (snat_main_t *sm, vlib_buffer_t *b, ip4_header_t *ip, ip_csum_t ip_sum = ip->checksum; ip_sum = ip_csum_sub_even (ip_sum, f->l3_csum_delta); ip->checksum = ip_csum_fold (ip_sum); - ASSERT (ip->checksum == ip4_header_checksum (ip)); + if (0xffff == ip->checksum) + ip->checksum = 0; + ASSERT (ip4_header_checksum_is_valid (ip)); } static_always_inline int -- cgit 1.2.3-korg