aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/session_lookup.c17
-rw-r--r--src/vnet/session/session_sdl.c41
2 files changed, 19 insertions, 39 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) =
diff --git a/src/vnet/session/session_sdl.c b/src/vnet/session/session_sdl.c
index 9505ba1689f..2fd63d1ed8e 100644
--- a/src/vnet/session/session_sdl.c
+++ b/src/vnet/session/session_sdl.c
@@ -460,18 +460,19 @@ session_sdl_command_fn (vlib_main_t *vm, unformat_input_t *input,
u32 appns_index;
app_namespace_t *app_ns;
u32 rmt_plen = 0, action = 0;
- clib_error_t *error = 0;
ip46_address_t rmt_ip;
u8 conn_set = 0;
u8 fib_proto = -1, is_add = 1, *ns_id = 0;
- u8 *tag = 0, tag_only = 0;
+ u8 *tag = 0;
int rv;
session_rule_add_del_args_t args;
- session_cli_return_if_not_enabled ();
-
if (session_sdl_is_enabled () == 0)
- return clib_error_return (0, "session sdl engine is not enabled");
+ {
+ vlib_cli_output (vm, "session sdl engine is not enabled");
+ unformat_skip_line (input);
+ goto done;
+ }
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
@@ -499,8 +500,8 @@ session_sdl_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;
}
}
@@ -536,13 +537,6 @@ session_sdl_command_fn (vlib_main_t *vm, unformat_input_t *input,
goto done;
}
- /* Delete with only tag entered. Try v4 first and then v6 if failed */
- if ((is_add == 0) && (fib_proto == (u8) ~0))
- {
- fib_proto = FIB_PROTOCOL_IP4;
- tag_only = 1;
- }
-
memset (&args, 0, sizeof (args));
args.transport_proto = TRANSPORT_PROTO_TCP;
args.table_args.rmt.fp_addr = rmt_ip;
@@ -555,27 +549,12 @@ session_sdl_command_fn (vlib_main_t *vm, unformat_input_t *input,
args.scope = SESSION_RULE_SCOPE_GLOBAL;
if ((rv = vnet_session_rule_add_del (&args)))
- {
- /* Try tag only delete on v6 */
- if (rv && tag_only)
- {
- args.table_args.rmt.fp_proto = FIB_PROTOCOL_IP6;
- args.table_args.lcl.fp_proto = FIB_PROTOCOL_IP6;
- if ((rv = vnet_session_rule_add_del (&args)))
- {
- error = clib_error_return (0, "sdl add del returned %u", rv);
- }
- }
- else
- {
- error = clib_error_return (0, "sdl add del returned %u", rv);
- }
- }
+ vlib_cli_output (vm, "sdl add del returned %d", rv);
done:
vec_free (ns_id);
vec_free (tag);
- return error;
+ return 0;
}
VLIB_CLI_COMMAND (session_sdl_command, static) = {