NAT44: asymmetrical static mapping rule (VPP-1135)
[vpp.git] / src / plugins / nat / nat_api.c
index f3d353f..f23efa8 100644 (file)
@@ -711,7 +711,7 @@ static void
   rv = snat_add_static_mapping (local_addr, external_addr, local_port,
                                external_port, vrf_id, mp->addr_only,
                                external_sw_if_index, proto, mp->is_add,
-                               mp->twice_nat);
+                               mp->twice_nat, mp->out2in_only);
 
   REPLY_MACRO (VL_API_NAT44_ADD_DEL_STATIC_MAPPING_REPLY);
 }
@@ -732,7 +732,8 @@ static void *vl_api_nat44_add_del_static_mapping_t_print
                clib_net_to_host_u16 (mp->local_port),
                clib_net_to_host_u16 (mp->external_port));
 
-  s = format (s, "twice_nat %d ", mp->twice_nat);
+  s = format (s, "twice_nat %d out2in_only %d ",
+             mp->twice_nat, mp->out2in_only);
 
   if (mp->vrf_id != ~0)
     s = format (s, "vrf %d", clib_net_to_host_u32 (mp->vrf_id));
@@ -764,6 +765,7 @@ send_nat44_static_mapping_details (snat_static_mapping_t * m,
   rmp->protocol = snat_proto_to_ip_proto (m->proto);
   rmp->context = context;
   rmp->twice_nat = m->twice_nat;
+  rmp->out2in_only = m->out2in_only;
 
   vl_api_send_msg (reg, (u8 *) rmp);
 }
@@ -861,7 +863,7 @@ static void
 
   rv =
     snat_add_static_mapping (addr, addr, port, port, vrf_id, mp->addr_only,
-                            sw_if_index, proto, mp->is_add, 0);
+                            sw_if_index, proto, mp->is_add, 0, 0);
 
   REPLY_MACRO (VL_API_NAT44_ADD_DEL_IDENTITY_MAPPING_REPLY);
 }
@@ -1259,7 +1261,7 @@ static void *vl_api_nat44_add_del_lb_static_mapping_t_print
   u8 *s;
 
   s = format (0, "SCRIPT: nat44_add_del_lb_static_mapping ");
-  s = format (s, "is_add %d twice_nat %d out2in_only ",
+  s = format (s, "is_add %d twice_nat %d out2in_only %d ",
              mp->is_add, mp->twice_nat, mp->out2in_only);
 
   FINISH;