diff options
author | Filip Varga <fivarga@cisco.com> | 2021-10-21 13:00:27 +0200 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2021-11-10 10:48:19 +0000 |
commit | 9c25eb1f4876a399919782c97e116732ea2ee628 (patch) | |
tree | 82ec5f326d2ebb326983abe6b4d2595729af46d1 /src/plugins/nat/nat44-ei/nat44_ei_cli.c | |
parent | 603231f447f197e7bc45bdb75bf5d77420e682b9 (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-ei/nat44_ei_cli.c')
-rw-r--r-- | src/plugins/nat/nat44-ei/nat44_ei_cli.c | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/src/plugins/nat/nat44-ei/nat44_ei_cli.c b/src/plugins/nat/nat44-ei/nat44_ei_cli.c index 36d98a46cb0..a18c71b5037 100644 --- a/src/plugins/nat/nat44-ei/nat44_ei_cli.c +++ b/src/plugins/nat/nat44-ei/nat44_ei_cli.c @@ -859,8 +859,7 @@ nat44_ei_feature_command_fn (vlib_main_t *vm, unformat_input_t *input, u32 *inside_sw_if_indices = 0; u32 *outside_sw_if_indices = 0; u8 is_output_feature = 0; - int is_del = 0; - int i; + int i, rv, is_del = 0; sw_if_index = ~0; @@ -894,7 +893,15 @@ nat44_ei_feature_command_fn (vlib_main_t *vm, unformat_input_t *input, sw_if_index = inside_sw_if_indices[i]; if (is_output_feature) { - if (nat44_ei_add_del_output_interface (sw_if_index, is_del)) + if (is_del) + { + rv = nat44_ei_del_output_interface (sw_if_index); + } + else + { + rv = nat44_ei_add_output_interface (sw_if_index); + } + if (rv) { error = clib_error_return ( 0, "%s %U failed", is_del ? "del" : "add", @@ -904,7 +911,15 @@ nat44_ei_feature_command_fn (vlib_main_t *vm, unformat_input_t *input, } else { - if (nat44_ei_add_del_interface (sw_if_index, 1, is_del)) + if (is_del) + { + rv = nat44_ei_del_interface (sw_if_index, 1); + } + else + { + rv = nat44_ei_add_interface (sw_if_index, 1); + } + if (rv) { error = clib_error_return ( 0, "%s %U failed", is_del ? "del" : "add", @@ -922,7 +937,15 @@ nat44_ei_feature_command_fn (vlib_main_t *vm, unformat_input_t *input, sw_if_index = outside_sw_if_indices[i]; if (is_output_feature) { - if (nat44_ei_add_del_output_interface (sw_if_index, is_del)) + if (is_del) + { + rv = nat44_ei_del_output_interface (sw_if_index); + } + else + { + rv = nat44_ei_add_output_interface (sw_if_index); + } + if (rv) { error = clib_error_return ( 0, "%s %U failed", is_del ? "del" : "add", @@ -932,7 +955,15 @@ nat44_ei_feature_command_fn (vlib_main_t *vm, unformat_input_t *input, } else { - if (nat44_ei_add_del_interface (sw_if_index, 0, is_del)) + if (is_del) + { + rv = nat44_ei_del_interface (sw_if_index, 0); + } + else + { + rv = nat44_ei_add_interface (sw_if_index, 0); + } + if (rv) { error = clib_error_return ( 0, "%s %U failed", is_del ? "del" : "add", |