From 63e15818bbf05e5bb5ecde5af0e9eec7b1084fec Mon Sep 17 00:00:00 2001 From: Filip Varga Date: Tue, 29 Jun 2021 14:28:21 +0200 Subject: nat: refactoring NAT44ED cfg functions Refactored & fixed NAT44ED configuration functions used for handling interfaces and nodes. Type: refactor Signed-off-by: Filip Varga Change-Id: I6fbbb7f0fe35d572675997745d53290152987424 --- src/plugins/nat/nat44-ed/nat44_ed_cli.c | 45 +++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 8 deletions(-) (limited to 'src/plugins/nat/nat44-ed/nat44_ed_cli.c') 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", -- cgit 1.2.3-korg