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)
This commit is contained in:
Neale Ranns
committed by
Damjan Marion
parent
41fd164872
commit
56417fa946
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user