diff options
author | Filip Varga <fivarga@cisco.com> | 2021-06-29 14:28:21 +0200 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2021-07-14 12:46:42 +0000 |
commit | 63e15818bbf05e5bb5ecde5af0e9eec7b1084fec (patch) | |
tree | 05d0533db426b2dc780a9a41fef6602e73725ed8 /src/plugins/nat/nat44-ed/nat44_ed_cli.c | |
parent | a32416ded5aef52015155ce405708d98838be6b1 (diff) |
nat: refactoring NAT44ED cfg functions
Refactored & fixed NAT44ED configuration
functions used for handling interfaces and
nodes.
Type: refactor
Signed-off-by: Filip Varga <fivarga@cisco.com>
Change-Id: I6fbbb7f0fe35d572675997745d53290152987424
Diffstat (limited to 'src/plugins/nat/nat44-ed/nat44_ed_cli.c')
-rw-r--r-- | src/plugins/nat/nat44-ed/nat44_ed_cli.c | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/src/plugins/nat/nat44-ed/nat44_ed_cli.c b/src/plugins/nat/nat44-ed/nat44_ed_cli.c index 1d54f99d113..cb0fe9ec12c 100644 --- a/src/plugins/nat/nat44-ed/nat44_ed_cli.c +++ b/src/plugins/nat/nat44-ed/nat44_ed_cli.c @@ -665,8 +665,7 @@ snat_feature_command_fn (vlib_main_t * vm, 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; @@ -701,8 +700,15 @@ snat_feature_command_fn (vlib_main_t * vm, sw_if_index = inside_sw_if_indices[i]; if (is_output_feature) { - if (snat_interface_add_del_output_feature - (sw_if_index, 1, is_del)) + if (is_del) + { + rv = nat44_ed_del_output_interface (sw_if_index); + } + else + { + rv = nat44_ed_add_output_interface (sw_if_index); + } + if (rv) { error = clib_error_return (0, "%s %U failed", is_del ? "del" : "add", @@ -713,7 +719,15 @@ snat_feature_command_fn (vlib_main_t * vm, } else { - if (snat_interface_add_del (sw_if_index, 1, is_del)) + if (is_del) + { + rv = nat44_ed_del_interface (sw_if_index, 1); + } + else + { + rv = nat44_ed_add_interface (sw_if_index, 1); + } + if (rv) { error = clib_error_return (0, "%s %U failed", is_del ? "del" : "add", @@ -732,8 +746,15 @@ snat_feature_command_fn (vlib_main_t * vm, sw_if_index = outside_sw_if_indices[i]; if (is_output_feature) { - if (snat_interface_add_del_output_feature - (sw_if_index, 0, is_del)) + if (is_del) + { + rv = nat44_ed_del_output_interface (sw_if_index); + } + else + { + rv = nat44_ed_add_output_interface (sw_if_index); + } + if (rv) { error = clib_error_return (0, "%s %U failed", is_del ? "del" : "add", @@ -744,7 +765,15 @@ snat_feature_command_fn (vlib_main_t * vm, } else { - if (snat_interface_add_del (sw_if_index, 0, is_del)) + if (is_del) + { + rv = nat44_ed_del_interface (sw_if_index, 0); + } + else + { + rv = nat44_ed_add_interface (sw_if_index, 0); + } + if (rv) { error = clib_error_return (0, "%s %U failed", is_del ? "del" : "add", |