summaryrefslogtreecommitdiffstats
path: root/src/plugins/lb/api.c
diff options
context:
space:
mode:
authorHongjun Ni <hongjun.ni@intel.com>2019-09-10 00:49:24 +0800
committerOle Trøan <otroan@employees.org>2019-09-26 11:40:18 +0000
commit33538a15087eea7c994b6f3d8a952c4b6ea98ee4 (patch)
treedf163312f706753c154546fdbaf3d5623318a04e /src/plugins/lb/api.c
parent8304933922620cef005b788a36a4d3f2eab45bb5 (diff)
lb: add APIs for set interface nat4 and nat6
Type: feature Change-Id: I5656cd798b108dd780381b87f574554442ed7b23 Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
Diffstat (limited to 'src/plugins/lb/api.c')
-rw-r--r--src/plugins/lb/api.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/plugins/lb/api.c b/src/plugins/lb/api.c
index 0543720e4e5..e2ab2ac25df 100644
--- a/src/plugins/lb/api.c
+++ b/src/plugins/lb/api.c
@@ -60,6 +60,8 @@ _(LB_ADD_DEL_AS, lb_add_del_as) \
_(LB_VIP_DUMP, lb_vip_dump) \
_(LB_AS_DUMP, lb_as_dump) \
_(LB_FLUSH_VIP, lb_flush_vip) \
+_(LB_ADD_DEL_INTF_NAT4, lb_add_del_intf_nat4) \
+_(LB_ADD_DEL_INTF_NAT6, lb_add_del_intf_nat6) \
/* Macro to finish up custom dump fns */
@@ -389,6 +391,46 @@ vl_api_lb_flush_vip_t_handler
REPLY_MACRO (VL_API_LB_FLUSH_VIP_REPLY);
}
+static void vl_api_lb_add_del_intf_nat4_t_handler
+ (vl_api_lb_add_del_intf_nat4_t * mp)
+{
+ lb_main_t *lbm = &lb_main;
+ vl_api_lb_add_del_intf_nat4_reply_t *rmp;
+ u32 sw_if_index = ntohl (mp->sw_if_index);
+ u8 is_del;
+ int rv = 0;
+
+ is_del = !mp->is_add;
+
+ VALIDATE_SW_IF_INDEX (mp);
+
+ rv = lb_nat4_interface_add_del(sw_if_index, is_del);
+
+ BAD_SW_IF_INDEX_LABEL;
+
+ REPLY_MACRO (VL_API_LB_ADD_DEL_INTF_NAT4_REPLY);
+}
+
+static void vl_api_lb_add_del_intf_nat6_t_handler
+ (vl_api_lb_add_del_intf_nat6_t * mp)
+{
+ lb_main_t *lbm = &lb_main;
+ vl_api_lb_add_del_intf_nat6_reply_t *rmp;
+ u32 sw_if_index = ntohl (mp->sw_if_index);
+ u8 is_del;
+ int rv = 0;
+
+ is_del = !mp->is_add;
+
+ VALIDATE_SW_IF_INDEX (mp);
+
+ rv = lb_nat6_interface_add_del(sw_if_index, is_del);
+
+ BAD_SW_IF_INDEX_LABEL;
+
+ REPLY_MACRO (VL_API_LB_ADD_DEL_INTF_NAT6_REPLY);
+}
+
static void *vl_api_lb_flush_vip_t_print
(vl_api_lb_flush_vip_t *mp, void * handle)
{