From aa80f07209d85e3fa32d7c404f2d55cf97cf343f Mon Sep 17 00:00:00 2001 From: Benoît Ganne Date: Thu, 18 Feb 2021 10:34:33 +0100 Subject: vlib: fix offload flags value reset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a buffer is freed and re-allocated for a new packet, opaque2 is not reset, so the offload flags can be set to a stale value. Make sure the offload flags are reset to the current value on 1st set. Type: fix Fixes: 6809538e646bf86c000dc1faba60b0a4157ad898 Change-Id: I4048febedf25b9995dbd080a11495ee7dbe59153 Signed-off-by: Benoît Ganne --- src/vnet/buffer.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/vnet/buffer.h') diff --git a/src/vnet/buffer.h b/src/vnet/buffer.h index fb734d5acde..bd70ea2722f 100644 --- a/src/vnet/buffer.h +++ b/src/vnet/buffer.h @@ -524,8 +524,17 @@ format_function_t format_vnet_buffer_offload; static_always_inline void vnet_buffer_offload_flags_set (vlib_buffer_t *b, u32 oflags) { - vnet_buffer2 (b)->oflags |= oflags; - b->flags |= VNET_BUFFER_F_OFFLOAD; + if (b->flags & VNET_BUFFER_F_OFFLOAD) + { + /* add a flag to existing offload */ + vnet_buffer2 (b)->oflags |= oflags; + } + else + { + /* no offload yet: reset offload flags to new value */ + vnet_buffer2 (b)->oflags = oflags; + b->flags |= VNET_BUFFER_F_OFFLOAD; + } } static_always_inline void -- cgit 1.2.3-korg