aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_lookup.c
diff options
context:
space:
mode:
authorSteven Luong <sluong@cisco.com>2024-10-02 09:35:33 -0700
committerSteven Luong <sluong@cisco.com>2024-10-02 09:41:53 -0700
commit2c52f5e8886fe2d7fa2aeb1fa15a8c9491b0128e (patch)
tree42e0a661a5f5a83feb42877f22a2add6823258f4 /src/vnet/session/session_lookup.c
parent056b7d05875083fcb30637db848607c47cc9d3c9 (diff)
session: incomprehensible error message for adding sdl and rule-table entry
1. When the backend engine is not enable, adding an entry returns a confusing error message. DBGvpp# session sdl add 191.1.1.30/32 action 1 tag blue-v4-rule1 session sdl add 191.1.1.30/32 action 1 tag blue-v4-rule1 unknown input `add 191.1.1.30/32 action 1 ta...' DBGvpp# 2. When the sdl or rule-table entry is already present, adding the duplicate entry returns a confusing error message. DBGvpp# session sdl add 8.8.8.1/32 action 0 session sdl add 8.8.8.1/32 action 0 DBGvpp# session sdl add 8.8.8.1/32 action 0 session sdl add 8.8.8.1/32 action 0 session: session is already enable. Must disable first DBGvpp# The problem is because there are multiple cli commands start with "session". When the command is failed with the best match chain, it passes the command to the other parser chains which start with the keyword "session". The other cli chain also fails to parse the command. The error message that the previous parser chain returned may be overwritten by the newest error message. The fix is to not return an error in sdl and rule-table parser command chain. Type: fix Change-Id: If0165324a763f47ec98ab79a41c3ee9b10057454 Signed-off-by: Steven Luong <sluong@cisco.com>
Diffstat (limited to 'src/vnet/session/session_lookup.c')
-rw-r--r--src/vnet/session/session_lookup.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/vnet/session/session_lookup.c b/src/vnet/session/session_lookup.c
index 0d580ba35c6..720b94d99e6 100644
--- a/src/vnet/session/session_lookup.c
+++ b/src/vnet/session/session_lookup.c
@@ -1540,7 +1540,6 @@ session_rule_command_fn (vlib_main_t * vm, unformat_input_t * input,
vlib_cli_command_t * cmd)
{
u32 proto = ~0, lcl_port, rmt_port, action = 0, lcl_plen = 0, rmt_plen = 0;
- clib_error_t *error = 0;
u32 appns_index, scope = 0;
ip46_address_t lcl_ip, rmt_ip;
u8 is_ip4 = 1, conn_set = 0;
@@ -1549,10 +1548,12 @@ session_rule_command_fn (vlib_main_t * vm, unformat_input_t * input,
app_namespace_t *app_ns;
int rv;
- session_cli_return_if_not_enabled ();
-
if (session_rule_table_is_enabled () == 0)
- return clib_error_return (0, "session rule table engine is not enabled");
+ {
+ vlib_cli_output (vm, "session rule table engine is not enabled");
+ unformat_skip_line (input);
+ goto done;
+ }
clib_memset (&lcl_ip, 0, sizeof (lcl_ip));
clib_memset (&rmt_ip, 0, sizeof (rmt_ip));
@@ -1594,8 +1595,8 @@ session_rule_command_fn (vlib_main_t * vm, unformat_input_t * input,
;
else
{
- error = clib_error_return (0, "unknown input `%U'",
- format_unformat_error, input);
+ vlib_cli_output (vm, "unknown input `%U'", format_unformat_error,
+ input);
goto done;
}
}
@@ -1654,12 +1655,12 @@ session_rule_command_fn (vlib_main_t * vm, unformat_input_t * input,
.scope = scope,
};
if ((rv = vnet_session_rule_add_del (&args)))
- error = clib_error_return (0, "rule add del returned %u", rv);
+ vlib_cli_output (vm, "rule add del returned %d", rv);
done:
vec_free (ns_id);
vec_free (tag);
- return error;
+ return 0;
}
VLIB_CLI_COMMAND (session_rule_command, static) =