diff options
author | Neale Ranns <nranns@cisco.com> | 2019-08-27 12:47:17 +0000 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-09-25 22:06:05 +0000 |
commit | 56417fa9466b66fc2a59c30674935f2fd89790f9 (patch) | |
tree | 07fe0d900fb5db85e88a3344fc08c6ad9a1b5966 | |
parent | 41fd164872a9002eb73eb2c2c2b92a5d2f1d8451 (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>
(cherry picked from commit 670027a50682b88c3082aad70072139ce87a0d52)
-rw-r--r-- | src/vnet/ipsec/ipsec_cli.c | 12 |
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); |