diff options
Diffstat (limited to 'src/vnet/session/session_api.c')
-rwxr-xr-x | src/vnet/session/session_api.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c index 181312cc952..32ef34b0952 100755 --- a/src/vnet/session/session_api.c +++ b/src/vnet/session/session_api.c @@ -16,9 +16,10 @@ #include <vnet/vnet.h> #include <vlibmemory/api.h> #include <vnet/session/application.h> +#include <vnet/session/application_interface.h> +#include <vnet/session/session_rules_table.h> #include <vnet/vnet_msg_enum.h> -#include "application_interface.h" #define vl_typedefs /* define message structures */ #include <vnet/vnet_all_api_h.h> @@ -52,6 +53,7 @@ _(UNBIND_SOCK, unbind_sock) \ _(CONNECT_SOCK, connect_sock) \ _(SESSION_ENABLE_DISABLE, session_enable_disable) \ _(APP_NAMESPACE_ADD_DEL, app_namespace_add_del) \ +_(SESSION_RULE_ADD_DEL, session_rule_add_del) \ static int send_add_segment_callback (u32 api_client_index, const u8 * segment_name, @@ -778,6 +780,42 @@ done: REPLY_MACRO (VL_API_APP_NAMESPACE_ADD_DEL_REPLY); } +static void +vl_api_session_rule_add_del_t_handler (vl_api_session_rule_add_del_t * mp) +{ + vl_api_session_rule_add_del_reply_t *rmp; + session_rule_add_del_args_t args; + session_rule_table_add_del_args_t *table_args = &args.table_args; + clib_error_t *error; + u8 fib_proto; + int rv = 0; + + fib_proto = mp->is_ip4 ? FIB_PROTOCOL_IP4 : FIB_PROTOCOL_IP6; + + table_args->lcl.fp_len = mp->lcl_plen; + table_args->lcl.fp_proto = fib_proto; + table_args->rmt.fp_len = mp->rmt_plen; + table_args->rmt.fp_proto = fib_proto; + table_args->lcl_port = clib_net_to_host_u16 (mp->lcl_port); + table_args->rmt_port = clib_net_to_host_u16 (mp->rmt_port); + table_args->action_index = clib_net_to_host_u32 (mp->action_index); + table_args->is_add = mp->is_add; + args.appns_index = clib_net_to_host_u32 (mp->appns_index); + args.scope = mp->scope; + + memset (&table_args->lcl.fp_addr, 0, sizeof (table_args->lcl.fp_addr)); + memset (&table_args->rmt.fp_addr, 0, sizeof (table_args->rmt.fp_addr)); + ip_set (&table_args->lcl.fp_addr, mp->lcl_ip, mp->is_ip4); + ip_set (&table_args->rmt.fp_addr, mp->rmt_ip, mp->is_ip4); + error = vnet_session_rule_add_del (&args); + if (error) + { + rv = clib_error_get_code (error); + clib_error_report (error); + } + REPLY_MACRO (VL_API_SESSION_RULE_ADD_DEL_REPLY); +} + static clib_error_t * application_reaper_cb (u32 client_index) { |