summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2017-12-20 16:08:03 +0100
committerDave Wallace <dwallacelf@gmail.com>2017-12-20 16:37:16 +0000
commit74579f44a7f8e9df1a3715c82b700551cc06e8aa (patch)
treea208f35ea4be65da6dcda645f9d80b580c39feed /src/plugins
parent55d03788290d51c79686218ef5de2be8ff6ce976 (diff)
acl-plugin: add a debug CLI to print 5-tuple structure in human readable format from hex representation
Even though the trace now prints the hex as well as human readable format for acl plugin, it can be handy to have a separate function which allows to decode the hex. So add this debug CLI. Change-Id: I1db133a043374817ea9e94ae3736b8a98630669d Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/acl/acl.c26
-rw-r--r--src/plugins/acl/fa_node.c6
-rw-r--r--src/plugins/acl/fa_node.h1
3 files changed, 33 insertions, 0 deletions
diff --git a/src/plugins/acl/acl.c b/src/plugins/acl/acl.c
index 286b2e96d1e..a8699961b47 100644
--- a/src/plugins/acl/acl.c
+++ b/src/plugins/acl/acl.c
@@ -2821,6 +2821,26 @@ acl_plugin_show_interface (acl_main_t * am, u32 sw_if_index, int show_acl)
}
+
+static clib_error_t *
+acl_show_aclplugin_decode_5tuple_fn (vlib_main_t * vm,
+ unformat_input_t * input,
+ vlib_cli_command_t * cmd)
+{
+ clib_error_t *error = 0;
+ u64 five_tuple[6] = { 0, 0, 0, 0, 0, 0 };
+
+ if (unformat
+ (input, "%llx %llx %llx %llx %llx %llx", &five_tuple[0], &five_tuple[1],
+ &five_tuple[2], &five_tuple[3], &five_tuple[4], &five_tuple[5]))
+ vlib_cli_output (vm, "5-tuple structure decode: %U\n\n",
+ format_acl_plugin_5tuple, five_tuple);
+ else
+ error = clib_error_return (0, "expecting 6 hex integers");
+ return error;
+}
+
+
static clib_error_t *
acl_show_aclplugin_interface_fn (vlib_main_t * vm,
unformat_input_t * input,
@@ -3241,6 +3261,12 @@ VLIB_CLI_COMMAND (aclplugin_show_acl_command, static) = {
.function = acl_show_aclplugin_acl_fn,
};
+VLIB_CLI_COMMAND (aclplugin_show_decode_5tuple_command, static) = {
+ .path = "show acl-plugin decode 5tuple",
+ .short_help = "show acl-plugin decode 5tuple XXXX XXXX XXXX XXXX XXXX XXXX",
+ .function = acl_show_aclplugin_decode_5tuple_fn,
+};
+
VLIB_CLI_COMMAND (aclplugin_show_interface_command, static) = {
.path = "show acl-plugin interface",
.short_help = "show acl-plugin interface [sw_if_index N] [acl]",
diff --git a/src/plugins/acl/fa_node.c b/src/plugins/acl/fa_node.c
index 9c3db8d81fd..59eb9dfcb52 100644
--- a/src/plugins/acl/fa_node.c
+++ b/src/plugins/acl/fa_node.c
@@ -58,6 +58,12 @@ format_fa_5tuple (u8 * s, va_list * args)
p5t->pkt.flags_reserved);
}
+u8 *
+format_acl_plugin_5tuple (u8 * s, va_list * args)
+{
+ return format_fa_5tuple(s, args);
+}
+
/* packet trace format function */
static u8 *
format_acl_fa_trace (u8 * s, va_list * args)
diff --git a/src/plugins/acl/fa_node.h b/src/plugins/acl/fa_node.h
index fa9a2303f41..4f2d39b40e4 100644
--- a/src/plugins/acl/fa_node.h
+++ b/src/plugins/acl/fa_node.h
@@ -170,5 +170,6 @@ void acl_fa_enable_disable(u32 sw_if_index, int is_input, int enable_disable);
void show_fa_sessions_hash(vlib_main_t * vm, u32 verbose);
+u8 *format_acl_plugin_5tuple (u8 * s, va_list * args);
#endif