From 41bf4c7376fde7847e0fca5aeae6d1e510febdca Mon Sep 17 00:00:00 2001 From: Anton Ivanov Date: Wed, 7 Oct 2020 08:20:05 +0100 Subject: [PATCH] Copy metadata when making a packet copy Copy was copying only data, losing all metadata in the process. This resulted in very erratic behaviour of Replicate in a pipeline which relies on metadata to identify packets. --- core/packet.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/packet.cc b/core/packet.cc index a3656b524..a56f85bb1 100644 --- a/core/packet.cc +++ b/core/packet.cc @@ -58,7 +58,9 @@ Packet *Packet::copy(const Packet *src) { bess::utils::CopyInlined(dst->append(src->total_len()), src->head_data(), src->total_len(), true); - + bess::utils::CopyInlined(&dst->metadata_, &src->metadata_, + SNBUF_METADATA, true); + return dst; }