aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2019-10-07 12:20:39 +0000
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-10-07 16:58:02 +0000
commit0eb75d0e9c7624a4e8ac69fea7dbe12d39b75096 (patch)
treee0b92a1a231109914e5767423d32909b1b5658f5 /src
parentcc702410c18b5c54ec8686b02a0d208c9bc80421 (diff)
ip: add tracing for ipv6 frag headers
Type: feature Change-Id: I0e049b28d8c21b67ea4545e865eda4e88f10e485 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/ip/ip6_input.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/vnet/ip/ip6_input.c b/src/vnet/ip/ip6_input.c
index 0450064eafe..6fab5822da2 100644
--- a/src/vnet/ip/ip6_input.c
+++ b/src/vnet/ip/ip6_input.c
@@ -247,6 +247,25 @@ VLIB_REGISTER_NODE (ip6_input_node) = {
};
/* *INDENT-ON* */
+static u8 *
+format_ipv6_fragmentation (u8 * s, va_list * args)
+{
+ ip6_frag_hdr_t *h = va_arg (*args, ip6_frag_hdr_t *);
+ u32 max_header_bytes = va_arg (*args, u32);
+ u32 header_bytes;
+
+ header_bytes = sizeof (h[0]);
+ if (max_header_bytes != 0 && header_bytes > max_header_bytes)
+ return format (s, "ipv6 frag header truncated");
+
+ s =
+ format (s,
+ "fragmentation header: next_hdr: %u, rsv: %u, frag_offset_and_more: %u, id: %u",
+ h->next_hdr, h->rsv, h->fragment_offset_and_more,
+ clib_net_to_host_u32 (h->identification));
+ return s;
+}
+
static clib_error_t *
ip6_init (vlib_main_t * vm)
{
@@ -266,6 +285,11 @@ ip6_init (vlib_main_t * vm)
/* Default hop limit for packets we generate. */
ip6_main.host_config.ttl = 64;
+
+ uword *u = hash_get (ip_main.protocol_info_by_name, "IPV6_FRAGMENTATION");
+ ip_protocol_info_t *info = vec_elt_at_index (ip_main.protocol_infos, *u);
+ ASSERT (NULL == info->format_header);
+ info->format_header = format_ipv6_fragmentation;
return /* no error */ 0;
}