aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat44-ed/nat44_ed_api.c
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2021-06-29 14:28:21 +0200
committerOle Tr�an <otroan@employees.org>2021-07-14 12:46:42 +0000
commit63e15818bbf05e5bb5ecde5af0e9eec7b1084fec (patch)
tree05d0533db426b2dc780a9a41fef6602e73725ed8 /src/plugins/nat/nat44-ed/nat44_ed_api.c
parenta32416ded5aef52015155ce405708d98838be6b1 (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_api.c')
-rw-r--r--src/plugins/nat/nat44-ed/nat44_ed_api.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/plugins/nat/nat44-ed/nat44_ed_api.c b/src/plugins/nat/nat44-ed/nat44_ed_api.c
index 22737ad7e56..f92de51ea44 100644
--- a/src/plugins/nat/nat44-ed/nat44_ed_api.c
+++ b/src/plugins/nat/nat44-ed/nat44_ed_api.c
@@ -364,22 +364,27 @@ static void
vl_api_nat44_interface_add_del_feature_t_handler
(vl_api_nat44_interface_add_del_feature_t * mp)
{
- snat_main_t *sm = &snat_main;
vl_api_nat44_interface_add_del_feature_reply_t *rmp;
- u32 sw_if_index = ntohl (mp->sw_if_index);
- u8 is_del;
+ snat_main_t *sm = &snat_main;
+ u32 sw_if_index;
+ u8 is_inside;
int rv = 0;
- is_del = !mp->is_add;
-
VALIDATE_SW_IF_INDEX (mp);
- rv =
- snat_interface_add_del (sw_if_index, mp->flags & NAT_API_IS_INSIDE,
- is_del);
+ is_inside = mp->flags & NAT_API_IS_INSIDE;
+ sw_if_index = ntohl (mp->sw_if_index);
- BAD_SW_IF_INDEX_LABEL;
+ if (mp->is_add)
+ {
+ rv = nat44_ed_add_interface (sw_if_index, is_inside);
+ }
+ else
+ {
+ rv = nat44_ed_del_interface (sw_if_index, is_inside);
+ }
+ BAD_SW_IF_INDEX_LABEL;
REPLY_MACRO (VL_API_NAT44_INTERFACE_ADD_DEL_FEATURE_REPLY);
}
@@ -426,16 +431,23 @@ static void
vl_api_nat44_interface_add_del_output_feature_t_handler
(vl_api_nat44_interface_add_del_output_feature_t * mp)
{
- snat_main_t *sm = &snat_main;
vl_api_nat44_interface_add_del_output_feature_reply_t *rmp;
- u32 sw_if_index = ntohl (mp->sw_if_index);
+ snat_main_t *sm = &snat_main;
+ u32 sw_if_index;
int rv = 0;
VALIDATE_SW_IF_INDEX (mp);
- rv = snat_interface_add_del_output_feature (sw_if_index,
- mp->flags & NAT_API_IS_INSIDE,
- !mp->is_add);
+ sw_if_index = ntohl (mp->sw_if_index);
+
+ if (mp->is_add)
+ {
+ rv = nat44_ed_add_output_interface (sw_if_index);
+ }
+ else
+ {
+ rv = nat44_ed_del_output_interface (sw_if_index);
+ }
BAD_SW_IF_INDEX_LABEL;
REPLY_MACRO (VL_API_NAT44_INTERFACE_ADD_DEL_OUTPUT_FEATURE_REPLY);