From e82488f10f20f464961c5c7b381b4a419bca0bbc Mon Sep 17 00:00:00 2001 From: Matus Fabian Date: Thu, 18 Jan 2018 03:38:45 -0800 Subject: NAT44: asymmetrical static mapping rule (VPP-1135) add option to NAT44 static mapping API/CLI to make rule asymmetrical (rule match only out2in direction) Change-Id: If262a3ff375a24d3059f0de1f1ac387a4fe09475 Signed-off-by: Matus Fabian --- src/plugins/nat/nat_api.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/plugins/nat/nat_api.c') diff --git a/src/plugins/nat/nat_api.c b/src/plugins/nat/nat_api.c index f3d353fa20e..f23efa8d89f 100644 --- a/src/plugins/nat/nat_api.c +++ b/src/plugins/nat/nat_api.c @@ -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; -- cgit 1.2.3-korg