diff options
author | Steven Luong <sluong@cisco.com> | 2024-06-28 13:15:33 -0700 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2024-07-15 21:11:00 +0000 |
commit | 2da273ace86764c5999ffd30e6e1ca5fcfd09f4b (patch) | |
tree | 1977923971d461eeb06af053216c6793c517ed92 | |
parent | 67bae20b05cb46e5f6d19afeaf1f7a52a5309d59 (diff) |
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 <sluong@cisco.com>
-rw-r--r-- | src/vnet/session/session_api.c | 7 |
1 files changed, 7 insertions, 0 deletions
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); } |