diff options
author | Matus Fabian <matfabia@cisco.com> | 2018-01-18 03:38:45 -0800 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2018-01-22 09:44:45 +0000 |
commit | e82488f10f20f464961c5c7b381b4a419bca0bbc (patch) | |
tree | 4290bfe3a03ede14234a48b9e70fe3794cefdcfb /src/plugins/nat/nat_api.c | |
parent | 352ecd95c9cef74e1726f750dae86c1f97999275 (diff) |
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 <matfabia@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat_api.c')
-rw-r--r-- | src/plugins/nat/nat_api.c | 10 |
1 files changed, 6 insertions, 4 deletions
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; |