diff options
author | Steve Shin <jonshin@cisco.com> | 2017-11-13 15:46:35 -0800 |
---|---|---|
committer | John Lo <loj@cisco.com> | 2017-11-14 03:08:50 +0000 |
commit | 49806fe252030a4cd993f598ff65a89590d57388 (patch) | |
tree | 5e50408039f2258331e9c1bb772a79b323f8b565 /src/vnet/replication.c | |
parent | 9324284af8d8436ce434e3da58e8eabbe609cb56 (diff) |
l2-flood: fix restore vnet buffer's flags in the replication routine
When BUM packets are flooded in the l2 domain, some data should be
kept and restored for recycling in the replication routine.
If l2 bridge domain has multiple interfaces mixed with normal and
vlan tagged, the vlan tag value of the vnet buffer can be changed
while flooding the replicated packets. The change is made to store
and restore the original vlan tag in the replication logic.
Change-Id: I399cf54cd2e74cb44a2be42241bdc4fba85032c5
Signed-off-by: Steve Shin <jonshin@cisco.com>
Diffstat (limited to 'src/vnet/replication.c')
-rw-r--r-- | src/vnet/replication.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/vnet/replication.c b/src/vnet/replication.c index 0fdca0bf13c..5a8a0fe63b1 100644 --- a/src/vnet/replication.c +++ b/src/vnet/replication.c @@ -45,6 +45,7 @@ replication_prep (vlib_main_t * vm, /* Save state from vlib buffer */ ctx->saved_free_list_index = vlib_buffer_get_free_list_index (b0); ctx->current_data = b0->current_data; + ctx->flags = b0->flags & VNET_BUFFER_FLAGS_VLAN_BITS; /* Set up vlib buffer hooks */ b0->recycle_count = ctx_id; @@ -104,6 +105,10 @@ replication_recycle (vlib_main_t * vm, vlib_buffer_t * b0, u32 is_last) clib_memcpy (vnet_buffer (b0), ctx->vnet_buffer, sizeof (vnet_buffer_opaque_t)); + /* Restore the vlan flags */ + b0->flags &= ~VNET_BUFFER_FLAGS_VLAN_BITS; + b0->flags |= ctx->flags; + /* Restore the packet start (current_data) and length */ vlib_buffer_advance (b0, ctx->current_data - b0->current_data); |