summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorGuillaume Solignac <gsoligna@cisco.com>2019-05-15 12:02:33 +0200
committerNeale Ranns <nranns@cisco.com>2019-06-25 09:46:21 +0000
commit8f818cc35972f447acd3cf68229d5f9e634926f3 (patch)
tree2de9ccfbe188240737a1b09556dcd2f78f682b86 /src/vnet
parentc036c93bdf240541ec436877f8614c82c5b49b8b (diff)
ipsec: print spi in hexadecimal
Print the SPI in hexadecimal and decimal. Type: feature Change-Id: I012e94f9147058064e06c6bb4622ab6b6507957d Signed-off-by: Guillaume Solignac <gsoligna@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/ipsec/ah_encrypt.c4
-rw-r--r--src/vnet/ipsec/esp_encrypt.c11
-rw-r--r--src/vnet/ipsec/esp_format.c6
-rw-r--r--src/vnet/ipsec/ipsec_format.c4
-rw-r--r--src/vnet/ipsec/ipsec_if_in.c2
-rw-r--r--src/vnet/ipsec/ipsec_input.c4
6 files changed, 16 insertions, 15 deletions
diff --git a/src/vnet/ipsec/ah_encrypt.c b/src/vnet/ipsec/ah_encrypt.c
index 1be4b3af7b7..75294a23102 100644
--- a/src/vnet/ipsec/ah_encrypt.c
+++ b/src/vnet/ipsec/ah_encrypt.c
@@ -75,8 +75,8 @@ format_ah_encrypt_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
ah_encrypt_trace_t *t = va_arg (*args, ah_encrypt_trace_t *);
- s = format (s, "ah: sa-index %d spi %u seq %u:%u integrity %U",
- t->sa_index, t->spi, t->seq_hi, t->seq_lo,
+ s = format (s, "ah: sa-index %d spi %u (0x%08x) seq %u:%u integrity %U",
+ t->sa_index, t->spi, t->spi, t->seq_hi, t->seq_lo,
format_ipsec_integ_alg, t->integ_alg);
return s;
}
diff --git a/src/vnet/ipsec/esp_encrypt.c b/src/vnet/ipsec/esp_encrypt.c
index cf485482c0e..c879a404b54 100644
--- a/src/vnet/ipsec/esp_encrypt.c
+++ b/src/vnet/ipsec/esp_encrypt.c
@@ -78,11 +78,12 @@ format_esp_encrypt_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
esp_encrypt_trace_t *t = va_arg (*args, esp_encrypt_trace_t *);
- s = format (s, "esp: sa-index %d spi %u seq %u crypto %U integrity %U%s",
- t->sa_index, t->spi, t->seq,
- format_ipsec_crypto_alg, t->crypto_alg,
- format_ipsec_integ_alg, t->integ_alg,
- t->udp_encap ? " udp-encap-enabled" : "");
+ s =
+ format (s,
+ "esp: sa-index %d spi %u (0x%08x) seq %u crypto %U integrity %U%s",
+ t->sa_index, t->spi, t->spi, t->seq, format_ipsec_crypto_alg,
+ t->crypto_alg, format_ipsec_integ_alg, t->integ_alg,
+ t->udp_encap ? " udp-encap-enabled" : "");
return s;
}
diff --git a/src/vnet/ipsec/esp_format.c b/src/vnet/ipsec/esp_format.c
index 615d576043b..48b728dd196 100644
--- a/src/vnet/ipsec/esp_format.c
+++ b/src/vnet/ipsec/esp_format.c
@@ -23,10 +23,10 @@ u8 *
format_esp_header (u8 * s, va_list * args)
{
esp_header_t *esp = va_arg (*args, esp_header_t *);
+ u32 spi = clib_net_to_host_u32 (esp->spi);
- s = format (s, "ESP: spi %u, seq %u",
- clib_net_to_host_u32 (esp->spi),
- clib_net_to_host_u32 (esp->seq));
+ s = format (s, "ESP: spi %u (0x%08x), seq %u",
+ spi, spi, clib_net_to_host_u32 (esp->seq));
return s;
}
diff --git a/src/vnet/ipsec/ipsec_format.c b/src/vnet/ipsec/ipsec_format.c
index 1e6e2d5cb01..1c3c5f95262 100644
--- a/src/vnet/ipsec/ipsec_format.c
+++ b/src/vnet/ipsec/ipsec_format.c
@@ -287,8 +287,8 @@ format_ipsec_sa (u8 * s, va_list * args)
sa = pool_elt_at_index (im->sad, sai);
- s = format (s, "[%d] sa 0x%x spi %u mode %s%s protocol %s %U",
- sai, sa->id, sa->spi,
+ s = format (s, "[%d] sa 0x%x spi %u (0x%08x) mode %s%s protocol %s %U",
+ sai, 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);
diff --git a/src/vnet/ipsec/ipsec_if_in.c b/src/vnet/ipsec/ipsec_if_in.c
index 9565078b3b9..d1f9d5c3ad3 100644
--- a/src/vnet/ipsec/ipsec_if_in.c
+++ b/src/vnet/ipsec/ipsec_if_in.c
@@ -59,7 +59,7 @@ format_ipsec_if_input_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
ipsec_if_input_trace_t *t = va_arg (*args, ipsec_if_input_trace_t *);
- s = format (s, "IPSec: spi %u seq %u", t->spi, t->seq);
+ s = format (s, "IPSec: spi %u (0x%08x) seq %u", t->spi, t->spi, t->seq);
return s;
}
diff --git a/src/vnet/ipsec/ipsec_input.c b/src/vnet/ipsec/ipsec_input.c
index 778570a41d4..cfbda318851 100644
--- a/src/vnet/ipsec/ipsec_input.c
+++ b/src/vnet/ipsec/ipsec_input.c
@@ -61,9 +61,9 @@ format_ipsec_input_trace (u8 * s, va_list * args)
CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *);
ipsec_input_trace_t *t = va_arg (*args, ipsec_input_trace_t *);
- s = format (s, "%U: sa_id %u spd %u policy %d spi %u seq %u",
+ s = format (s, "%U: sa_id %u spd %u policy %d spi %u (0x%08x) seq %u",
format_ip_protocol, t->proto, t->sa_id,
- t->spd, t->policy_index, t->spi, t->seq);
+ t->spd, t->policy_index, t->spi, t->spi, t->seq);
return s;
}