From 41afb33efe81a93ddf5879138802bf23602ccc81 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Tue, 16 Jul 2019 06:19:35 -0700 Subject: ipsec: handle UDP keepalives Type: feature Change-Id: I87cc1168466f267e8c4bbec318401982f4bdf03a Signed-off-by: Neale Ranns --- src/vnet/ipsec/ipsec_format.c | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'src/vnet/ipsec/ipsec_format.c') diff --git a/src/vnet/ipsec/ipsec_format.c b/src/vnet/ipsec/ipsec_format.c index 0d596c0c973..7a5e2584719 100644 --- a/src/vnet/ipsec/ipsec_format.c +++ b/src/vnet/ipsec/ipsec_format.c @@ -259,9 +259,7 @@ format_ipsec_sa_flags (u8 * s, va_list * args) { ipsec_sa_flags_t flags = va_arg (*args, int); - if (0) - ; -#define _(v, f, str) else if (flags & IPSEC_SA_FLAG_##f) s = format(s, "%s ", str); +#define _(v, f, str) if (flags & IPSEC_SA_FLAG_##f) s = format(s, "%s ", str); foreach_ipsec_sa_flags #undef _ return (s); @@ -285,10 +283,8 @@ format_ipsec_sa (u8 * s, va_list * args) sa = pool_elt_at_index (im->sad, sai); - s = format (s, "[%d] sa %d (0x%x) spi %u (0x%08x) mode %s%s protocol %s %U", + s = format (s, "[%d] sa %u (0x%x) spi %u (0x%08x) protocol:%s flags:[%U]", sai, sa->id, sa->id, sa->spi, sa->spi, - ipsec_sa_is_set_IS_TUNNEL (sa) ? "tunnel" : "transport", - ipsec_sa_is_set_IS_TUNNEL_V6 (sa) ? "-ip6" : "", sa->protocol ? "esp" : "ah", format_ipsec_sa_flags, sa->flags); if (!(flags & IPSEC_FORMAT_DETAIL)) @@ -402,6 +398,32 @@ done: return (s); } +u8 * +format_ipsec4_tunnel_key (u8 * s, va_list * args) +{ + ipsec4_tunnel_key_t *key = va_arg (*args, ipsec4_tunnel_key_t *); + + s = format (s, "remote:%U spi:%u (0x%08x)", + format_ip4_address, &key->remote_ip, + clib_net_to_host_u32 (key->spi), + clib_net_to_host_u32 (key->spi)); + + return (s); +} + +u8 * +format_ipsec6_tunnel_key (u8 * s, va_list * args) +{ + ipsec6_tunnel_key_t *key = va_arg (*args, ipsec6_tunnel_key_t *); + + s = format (s, "remote:%U spi:%u (0x%08x)", + format_ip6_address, &key->remote_ip, + clib_net_to_host_u32 (key->spi), + clib_net_to_host_u32 (key->spi)); + + return (s); +} + /* * fd.io coding-style-patch-verification: ON * -- cgit 1.2.3-korg