aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-08-27 12:47:17 +0000
committerDave Barach <openvpp@barachs.net>2019-08-27 19:40:40 +0000
commit670027a50682b88c3082aad70072139ce87a0d52 (patch)
tree6820d98b0cc4988a8758d6a8597584cca0ffc8b7
parent5ad541eeaa428c6a88c40e2088cdaabc0748c9df (diff)
ipsec: Add 'detail' option to 'sh ipsec sa'
Type: feature with detail option prints all details for all SAs Change-Id: Ic3c423c085dfc849cf9c3e18a6f624b82150d961 Signed-off-by: Neale Ranns <nranns@cisco.com>
-rw-r--r--src/vnet/ipsec/ipsec_cli.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/vnet/ipsec/ipsec_cli.c b/src/vnet/ipsec/ipsec_cli.c
index a7a6c0c0d5b..0bc7aeae996 100644
--- a/src/vnet/ipsec/ipsec_cli.c
+++ b/src/vnet/ipsec/ipsec_cli.c
@@ -344,13 +344,14 @@ VLIB_CLI_COMMAND (ipsec_policy_add_del_command, static) = {
/* *INDENT-ON* */
static void
-ipsec_sa_show_all (vlib_main_t * vm, ipsec_main_t * im)
+ipsec_sa_show_all (vlib_main_t * vm, ipsec_main_t * im, u8 detail)
{
u32 sai;
/* *INDENT-OFF* */
pool_foreach_index (sai, im->sad, ({
- vlib_cli_output(vm, "%U", format_ipsec_sa, sai, IPSEC_FORMAT_BRIEF);
+ vlib_cli_output(vm, "%U", format_ipsec_sa, sai,
+ (detail ? IPSEC_FORMAT_DETAIL : IPSEC_FORMAT_BRIEF));
}));
/* *INDENT-ON* */
}
@@ -404,7 +405,7 @@ show_ipsec_command_fn (vlib_main_t * vm,
{
ipsec_main_t *im = &ipsec_main;
- ipsec_sa_show_all (vm, im);
+ ipsec_sa_show_all (vm, im, 0);
ipsec_spd_show_all (vm, im);
ipsec_spd_bindings_show_all (vm, im);
ipsec_tunnel_show_all (vm, im);
@@ -426,17 +427,20 @@ show_ipsec_sa_command_fn (vlib_main_t * vm,
{
ipsec_main_t *im = &ipsec_main;
u32 sai = ~0;
+ u8 detail = 0;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "%u", &sai))
;
+ if (unformat (input, "detail"))
+ detail = 1;
else
break;
}
if (~0 == sai)
- ipsec_sa_show_all (vm, im);
+ ipsec_sa_show_all (vm, im, detail);
else
vlib_cli_output (vm, "%U", format_ipsec_sa, sai, IPSEC_FORMAT_DETAIL);