From 2da273ace86764c5999ffd30e6e1ca5fcfd09f4b Mon Sep 17 00:00:00 2001 From: Steven Luong Date: Fri, 28 Jun 2024 13:15:33 -0700 Subject: session: crash in session_rule_add_del if session is not enable Invoking the API session_rule_add_del to add a rule causes VPP to crash if session is not enable. Type: fix Change-Id: If8de83f1064bc60d20461e87889b7c3393ad2af1 Signed-off-by: Steven Luong --- src/vnet/session/session_api.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/vnet') diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c index 48eb932a2c9..7110029b5dc 100644 --- a/src/vnet/session/session_api.c +++ b/src/vnet/session/session_api.c @@ -962,6 +962,12 @@ vl_api_session_rule_add_del_t_handler (vl_api_session_rule_add_del_t * mp) session_rule_table_add_del_args_t *table_args = &args.table_args; int rv = 0; + if (session_main_is_enabled () == 0) + { + rv = VNET_API_ERROR_FEATURE_DISABLED; + goto done; + } + clib_memset (&args, 0, sizeof (args)); ip_prefix_decode (&mp->lcl, &table_args->lcl); @@ -986,6 +992,7 @@ vl_api_session_rule_add_del_t_handler (vl_api_session_rule_add_del_t * mp) rv = VNET_API_ERROR_UNSPECIFIED; } vec_free (table_args->tag); +done: REPLY_MACRO (VL_API_SESSION_RULE_ADD_DEL_REPLY); } -- cgit 1.2.3-korg