VPP-1381: Fix the incorrect if condition when delete session for static mapping 91/14591/2
authorshubing guo <[email protected]>
Fri, 10 Aug 2018 05:59:50 +0000 (13:59 +0800)
committerDamjan Marion <[email protected]>
Fri, 31 Aug 2018 16:01:38 +0000 (16:01 +0000)
-- The session should not be deleted when either ip address or port doesn't same with static mapping.

Change-Id: I09ab7379947654d2780a8c40c5340ce430541b12
Signed-off-by: shubing guo <[email protected]>
(cherry picked from commit 060c3a7e5a2d23189a8c6348e767cd2018a58dd6)

src/plugins/nat/nat.c

index c16819a..618711f 100755 (executable)
@@ -1160,7 +1160,7 @@ int snat_add_static_mapping(ip4_address_t l_addr, ip4_address_t e_addr,
 
                       if (!addr_only)
                         {
-                          if ((s->out2in.addr.as_u32 != e_addr.as_u32) &&
+                          if ((s->out2in.addr.as_u32 != e_addr.as_u32) ||
                               (clib_net_to_host_u16 (s->out2in.port) != e_port))
                             continue;
                         }
@@ -1454,7 +1454,7 @@ int nat44_add_del_lb_static_mapping (ip4_address_t e_addr, u16 e_port,
                       if (!(is_lb_session (s)))
                         continue;
 
-                      if ((s->in2out.addr.as_u32 != local->addr.as_u32) &&
+                      if ((s->in2out.addr.as_u32 != local->addr.as_u32) ||
                           (clib_net_to_host_u16 (s->in2out.port) != local->port))
                         continue;