summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat44-ed
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2021-10-21 13:00:27 +0200
committerOle Tr�an <otroan@employees.org>2021-11-10 10:48:19 +0000
commit9c25eb1f4876a399919782c97e116732ea2ee628 (patch)
tree82ec5f326d2ebb326983abe6b4d2595729af46d1 /src/plugins/nat/nat44-ed
parent603231f447f197e7bc45bdb75bf5d77420e682b9 (diff)
nat: api autoendian fix
Fixed bad use of macros for autoendian API calls and updated tests for the new API. Removed sw_if_index check macro because of ntol conversion. Changed REPLY_MACRO to REPLY_MACRO_END to fix ntohl conversions. Type: fix Change-Id: I878a07b3f80fe03179feab60f0abc662f408a2c8 Signed-off-by: Filip Varga <fivarga@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat44-ed')
-rw-r--r--src/plugins/nat/nat44-ed/nat44_ed_api.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/plugins/nat/nat44-ed/nat44_ed_api.c b/src/plugins/nat/nat44-ed/nat44_ed_api.c
index 15059752ee7..6123544087b 100644
--- a/src/plugins/nat/nat44-ed/nat44_ed_api.c
+++ b/src/plugins/nat/nat44-ed/nat44_ed_api.c
@@ -552,24 +552,25 @@ vl_api_nat44_ed_add_del_output_interface_t_handler (
{
vl_api_nat44_ed_add_del_output_interface_reply_t *rmp;
snat_main_t *sm = &snat_main;
- u32 sw_if_index;
int rv = 0;
- VALIDATE_SW_IF_INDEX (mp);
-
- sw_if_index = ntohl (mp->sw_if_index);
+ if (!vnet_sw_if_index_is_api_valid (mp->sw_if_index))
+ {
+ rv = VNET_API_ERROR_INVALID_SW_IF_INDEX;
+ goto bad_sw_if_index;
+ }
if (mp->is_add)
{
- rv = nat44_ed_add_output_interface (sw_if_index);
+ rv = nat44_ed_add_output_interface (mp->sw_if_index);
}
else
{
- rv = nat44_ed_del_output_interface (sw_if_index);
+ rv = nat44_ed_del_output_interface (mp->sw_if_index);
}
- BAD_SW_IF_INDEX_LABEL;
- REPLY_MACRO (VL_API_NAT44_ED_ADD_DEL_OUTPUT_INTERFACE_REPLY);
+bad_sw_if_index:
+ REPLY_MACRO_END (VL_API_NAT44_ED_ADD_DEL_OUTPUT_INTERFACE_REPLY);
}
#define vl_endianfun