ip: Trace the packet from the punt node 78/20578/3
authorNeale Ranns <nranns@cisco.com>
Wed, 10 Jul 2019 08:48:55 +0000 (08:48 +0000)
committerDave Barach <openvpp@barachs.net>
Fri, 12 Jul 2019 12:28:24 +0000 (12:28 +0000)
Type: feature

Change-Id: I01f1cc53efc93b0a7bb588ea6db89a53c971a3f5
Signed-off-by: Neale Ranns <nranns@cisco.com>
src/vnet/ip/punt_node.c

index 65237aa..8a39d11 100644 (file)
@@ -223,6 +223,7 @@ typedef struct
 {
   punt_client_t client;
   u8 is_midchain;
+  u8 packet_data[64];
 } udp_punt_trace_t;
 
 static u8 *
@@ -238,6 +239,9 @@ format_udp_punt_trace (u8 * s, va_list * args)
       s = format (s, "\n%U(buffer is part of chain)", format_white_space,
                  indent);
     }
+  s = format (s, "\n%U%U", format_white_space, indent,
+             format_hex_bytes, t->packet_data, sizeof (t->packet_data));
+
   return s;
 }
 
@@ -327,13 +331,6 @@ punt_socket_inline (vlib_main_t * vm,
 
       struct sockaddr_un *caddr = &c->caddr;
 
-      if (PREDICT_FALSE (b->flags & VLIB_BUFFER_IS_TRACED))
-       {
-         udp_punt_trace_t *t;
-         t = vlib_add_trace (vm, node, b, sizeof (t[0]));
-         clib_memcpy_fast (&t->client, c, sizeof (t->client));
-       }
-
       /* Re-set iovecs */
       vec_reset_length (ptd->iovecs);
 
@@ -350,6 +347,16 @@ punt_socket_inline (vlib_main_t * vm,
       iov->iov_base = b->data + b->current_data;
       iov->iov_len = l = b->current_length;
 
+      if (PREDICT_FALSE (b->flags & VLIB_BUFFER_IS_TRACED))
+       {
+         udp_punt_trace_t *t;
+         t = vlib_add_trace (vm, node, b, sizeof (t[0]));
+         clib_memcpy_fast (&t->client, c, sizeof (t->client));
+         clib_memcpy_fast (t->packet_data,
+                           vlib_buffer_get_current (b),
+                           sizeof (t->packet_data));
+       }
+
       if (PREDICT_FALSE (b->flags & VLIB_BUFFER_NEXT_PRESENT))
        {
          do