diff options
author | Matus Fabian <matfabia@cisco.com> | 2017-10-24 04:13:49 -0700 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2017-10-25 16:18:54 +0000 |
commit | 36ea2d6d3a67a60534a7c2b58551688858a1ce7f (patch) | |
tree | 1cb424c70e1f1557e2354eb50559a346adb3314b /src/plugins/nat/nat_api.c | |
parent | ac1f96d7cdfb845c08400d27ec566b991e32e24b (diff) |
One armed NAT (VPP-1035)
Use a single physical interface in order to accomplish NAT44/NAT64.
Change-Id: I0c8138953a7a4075df306172e125abad771315e4
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 | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/nat/nat_api.c b/src/plugins/nat/nat_api.c index 3bacdfed051..96f69eba186 100644 --- a/src/plugins/nat/nat_api.c +++ b/src/plugins/nat/nat_api.c @@ -224,7 +224,7 @@ static void memset (rmp, 0, sizeof (*rmp)); rmp->_vl_msg_id = ntohs (VL_API_SNAT_INTERFACE_DETAILS + sm->msg_id_base); rmp->sw_if_index = ntohl (i->sw_if_index); - rmp->is_inside = i->is_inside; + rmp->is_inside = nat_interface_is_inside (i); rmp->context = context; vl_msg_api_send_shmem (q, (u8 *) & rmp); @@ -306,7 +306,7 @@ send_snat_interface_output_feature_details (snat_interface_t * i, ntohs (VL_API_SNAT_INTERFACE_OUTPUT_FEATURE_DETAILS + sm->msg_id_base); rmp->sw_if_index = ntohl (i->sw_if_index); rmp->context = context; - rmp->is_inside = i->is_inside; + rmp->is_inside = nat_interface_is_inside (i); vl_msg_api_send_shmem (q, (u8 *) & rmp); } @@ -1658,7 +1658,9 @@ send_nat44_interface_details (snat_interface_t * i, memset (rmp, 0, sizeof (*rmp)); rmp->_vl_msg_id = ntohs (VL_API_NAT44_INTERFACE_DETAILS + sm->msg_id_base); rmp->sw_if_index = ntohl (i->sw_if_index); - rmp->is_inside = i->is_inside; + rmp->is_inside = (nat_interface_is_inside (i) + && nat_interface_is_outside (i)) ? 2 : + nat_interface_is_inside (i); rmp->context = context; vl_msg_api_send_shmem (q, (u8 *) & rmp); @@ -1741,7 +1743,7 @@ send_nat44_interface_output_feature_details (snat_interface_t * i, ntohs (VL_API_NAT44_INTERFACE_OUTPUT_FEATURE_DETAILS + sm->msg_id_base); rmp->sw_if_index = ntohl (i->sw_if_index); rmp->context = context; - rmp->is_inside = i->is_inside; + rmp->is_inside = nat_interface_is_inside (i); vl_msg_api_send_shmem (q, (u8 *) & rmp); } @@ -2867,7 +2869,9 @@ nat64_api_interface_walk (snat_interface_t * i, void *arg) memset (rmp, 0, sizeof (*rmp)); rmp->_vl_msg_id = ntohs (VL_API_NAT64_INTERFACE_DETAILS + sm->msg_id_base); rmp->sw_if_index = ntohl (i->sw_if_index); - rmp->is_inside = i->is_inside; + rmp->is_inside = (nat_interface_is_inside (i) + && nat_interface_is_outside (i)) ? 2 : + nat_interface_is_inside (i); rmp->context = ctx->context; vl_msg_api_send_shmem (ctx->q, (u8 *) & rmp); |