summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2018-03-23 03:42:06 -0700
committerOle Trøan <otroan@employees.org>2018-03-23 11:48:49 +0000
commit3f2dd30b0bf7cf3d82c720d5065178c1fa628c6b (patch)
treef0c1b06ef5f78f91a20560486539b1a15e6a9315 /src/plugins/nat
parentde3682f510dd02055e124a2d7be831d203a7f402 (diff)
NAT44: fix ICMP checksum update crash (VPP-1205)
Change-Id: I3e4bbfe205c86cb0839dd5c542f083dbe6bea881 Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat')
-rwxr-xr-xsrc/plugins/nat/in2out.c3
-rwxr-xr-xsrc/plugins/nat/out2in.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/nat/in2out.c b/src/plugins/nat/in2out.c
index 8748013947c..8b565b1b6d3 100755
--- a/src/plugins/nat/in2out.c
+++ b/src/plugins/nat/in2out.c
@@ -794,6 +794,9 @@ static inline u32 icmp_in2out (snat_main_t *sm,
src_address /* changed member */);
ip0->checksum = ip_csum_fold (sum0);
+ if (icmp0->checksum == 0)
+ icmp0->checksum = 0xffff;
+
if (!icmp_is_error_message (icmp0))
{
new_id0 = sm0.port;
diff --git a/src/plugins/nat/out2in.c b/src/plugins/nat/out2in.c
index 7f811d97b59..ebd0dc4ba9a 100755
--- a/src/plugins/nat/out2in.c
+++ b/src/plugins/nat/out2in.c
@@ -644,6 +644,9 @@ static inline u32 icmp_out2in (snat_main_t *sm,
dst_address /* changed member */);
ip0->checksum = ip_csum_fold (sum0);
+ if (icmp0->checksum == 0)
+ icmp0->checksum = 0xffff;
+
if (!icmp_is_error_message (icmp0))
{
new_id0 = sm0.port;