aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/lb/api.c42
-rw-r--r--src/plugins/lb/lb.api26
2 files changed, 68 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)
{
diff --git a/src/plugins/lb/lb.api b/src/plugins/lb/lb.api
index b9f5c22126a..b479b1b3034 100644
--- a/src/plugins/lb/lb.api
+++ b/src/plugins/lb/lb.api
@@ -1,5 +1,6 @@
option version = "1.0.0";
import "plugins/lb/lb_types.api";
+import "vnet/interface_types.api";
/** \brief Configure Load-Balancer global parameters (unlike the CLI, both ip4_src_address and ip6_src_address need to be specified.
@param client_index - opaque cookie to identify the sender
@@ -143,3 +144,28 @@ define lb_as_details {
u32 in_use_since;
};
+/** \brief Enable/disable NAT4 feature on the interface
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param is_add - true if add, false if delete
+ @param sw_if_index - software index of the interface
+*/
+autoreply define lb_add_del_intf_nat4 {
+ u32 client_index;
+ u32 context;
+ bool is_add;
+ vl_api_interface_index_t sw_if_index;
+};
+
+/** \brief Enable/disable NAT6 feature on the interface
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param is_add - true if add, false if delete
+ @param sw_if_index - software index of the interface
+*/
+autoreply define lb_add_del_intf_nat6 {
+ u32 client_index;
+ u32 context;
+ bool is_add;
+ vl_api_interface_index_t sw_if_index;
+};