From feb77422a3435f4fd25c3a6e12df1bb9526b342a Mon Sep 17 00:00:00 2001 From: Andrew Yourtchenko Date: Fri, 17 Mar 2023 01:47:58 +0000 Subject: ip: punt socket - take the tags in Ethernet header into consideration The punt socket code rewinds the current_data pointer by sizeof (ethernet_header_t), which is incorrect if the header is tagged - resulting in truncated destination MAC address. Use ethernet_buffer_header_size() instead, which takes tags into account. Also add the unittest that verifies the issue and the fix. Type: fix Change-Id: I6352a174df144ca1e4230390c126f4b698724ebc Signed-off-by: Andrew Yourtchenko --- src/vnet/ip/punt_node.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/vnet/ip/punt_node.c') diff --git a/src/vnet/ip/punt_node.c b/src/vnet/ip/punt_node.c index 7f9beef0ffe..5d822c73759 100644 --- a/src/vnet/ip/punt_node.c +++ b/src/vnet/ip/punt_node.c @@ -23,6 +23,7 @@ */ #include +#include #include #include #include @@ -339,7 +340,7 @@ punt_socket_inline (vlib_main_t * vm, iov->iov_len = sizeof (packetdesc); /** VLIB buffer chain -> Unix iovec(s). */ - vlib_buffer_advance (b, -(sizeof (ethernet_header_t))); + vlib_buffer_advance (b, -ethernet_buffer_header_size (b)); vec_add2 (ptd->iovecs, iov, 1); iov->iov_base = b->data + b->current_data; iov->iov_len = l = b->current_length; -- cgit 1.2.3-korg