Fix nat44 identity mapping 65/9865/2
authorDave Barach <dave@barachs.net>
Mon, 18 Dec 2017 13:11:37 +0000 (08:11 -0500)
committerDamjan Marion <dmarion.lists@gmail.com>
Mon, 18 Dec 2017 15:35:20 +0000 (15:35 +0000)
Set l_addr to the interface address if the interface address is known
when the identity mapping is created.

Change-Id: I61af0f5248c9d86d23a24457b342b2e1fb4ac726
Signed-off-by: Dave Barach <dave@barachs.net>
src/plugins/nat/nat.c

index ef26d22..6aa2d81 100644 (file)
@@ -466,7 +466,12 @@ int snat_add_static_mapping(ip4_address_t l_addr, ip4_address_t e_addr,
           return 0;
         }
         else
+        {
           e_addr.as_u32 = first_int_addr->as_u32;
+          /* Identity mapping? */
+          if (l_addr.as_u32 == 0)
+            l_addr.as_u32 = e_addr.as_u32;
+        }
     }
 
   m_key.addr = e_addr;