summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-04-16 16:21:57 -0700
committerNeale Ranns <nranns@cisco.com>2019-04-16 16:21:57 -0700
commitb64cd2c40093c7d541c10019da70c708050b59ba (patch)
tree7b5048c128246658be9d00993f0c1d06c17ae072
parentc899dac8989e509e49b444ad8e8a3e5df867eb65 (diff)
IPSEC: SA format; don't print keys when there's no algo
Change-Id: I4d1d22cb24564896264e77c1810804ea3f54cb37 Signed-off-by: Neale Ranns <nranns@cisco.com>
-rw-r--r--src/vnet/ipsec/ipsec_format.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/vnet/ipsec/ipsec_format.c b/src/vnet/ipsec/ipsec_format.c
index 80691f2836c..93b1efd6902 100644
--- a/src/vnet/ipsec/ipsec_format.c
+++ b/src/vnet/ipsec/ipsec_format.c
@@ -295,13 +295,14 @@ format_ipsec_sa (u8 * s, va_list * args)
s = format (s, "\n last-seq %u last-seq-hi %u window %U",
sa->last_seq, sa->last_seq_hi,
format_ipsec_replay_window, sa->replay_window);
- s = format (s, "\n crypto alg %U%s%U",
- format_ipsec_crypto_alg, sa->crypto_alg,
- sa->crypto_alg ? " key " : "",
- format_ipsec_key, &sa->crypto_key);
- s = format (s, "\n integrity alg %U%s%U",
- format_ipsec_integ_alg, sa->integ_alg,
- sa->integ_alg ? " key " : "", format_ipsec_key, &sa->integ_key);
+ s = format (s, "\n crypto alg %U",
+ format_ipsec_crypto_alg, sa->crypto_alg);
+ if (sa->crypto_alg)
+ s = format (s, " key %U", format_ipsec_key, &sa->crypto_key);
+ s = format (s, "\n integrity alg %U",
+ format_ipsec_integ_alg, sa->integ_alg);
+ if (sa->integ_alg)
+ s = format (s, " key %U", format_ipsec_key, &sa->integ_key);
vlib_get_combined_counter (&ipsec_sa_counters, sai, &counts);
s = format (s, "\n packets %u bytes %u", counts.packets, counts.bytes);