aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2021-03-25 18:47:48 +0100
committerKlement Sekera <ksekera@cisco.com>2021-03-31 11:46:54 +0000
commit68b493ff2fa04b3d283e9476e77ea2db116b1dd8 (patch)
treec77128701eff4cc5fe87d7c1c2964aa1ee5263d3
parent8f76064716f46b716b4900154c7ac8e110c65ae6 (diff)
nat: avoid creating negative zero checksum
Type: fix Signed-off-by: Klement Sekera <ksekera@cisco.com> Change-Id: Ibbb72e77c751b7e775620cfb160b52ceff2da86b
-rw-r--r--src/plugins/nat/nat44-ed/nat44_ed.c4
1 files changed, 3 insertions, 1 deletions
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