From e9cebdf4c12adf7962ab2a2053789c93d70c33d3 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Wed, 21 Nov 2018 00:47:42 +0100 Subject: ethernet-input: fix assert in l2 mode Change-Id: I3befc762694e7c6d6847c361a144f72547038ba1 Signed-off-by: Damjan Marion --- src/vnet/ethernet/node.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'src/vnet/ethernet') diff --git a/src/vnet/ethernet/node.c b/src/vnet/ethernet/node.c index c39c6d7e0c7..6e1e1e3f3c8 100755 --- a/src/vnet/ethernet/node.c +++ b/src/vnet/ethernet/node.c @@ -405,15 +405,30 @@ eth_input_adv_and_flags_x4 (vlib_buffer_t ** b, i16 adv, u32 flags, int is_l3) u32x8_scatter_one ((u32x8) r, 4, &vnet_buffer (b[2])->l2_hdr_offset); u32x8_scatter_one ((u32x8) r, 6, &vnet_buffer (b[3])->l2_hdr_offset); - ASSERT (b[0]->current_data == vnet_buffer (b[0])->l3_hdr_offset); - ASSERT (b[1]->current_data == vnet_buffer (b[1])->l3_hdr_offset); - ASSERT (b[2]->current_data == vnet_buffer (b[2])->l3_hdr_offset); - ASSERT (b[3]->current_data == vnet_buffer (b[3])->l3_hdr_offset); - - ASSERT (b[0]->current_data - vnet_buffer (b[0])->l2_hdr_offset == adv); - ASSERT (b[1]->current_data - vnet_buffer (b[1])->l2_hdr_offset == adv); - ASSERT (b[2]->current_data - vnet_buffer (b[2])->l2_hdr_offset == adv); - ASSERT (b[3]->current_data - vnet_buffer (b[3])->l2_hdr_offset == adv); + if (is_l3) + { + ASSERT (b[0]->current_data == vnet_buffer (b[0])->l3_hdr_offset); + ASSERT (b[1]->current_data == vnet_buffer (b[1])->l3_hdr_offset); + ASSERT (b[2]->current_data == vnet_buffer (b[2])->l3_hdr_offset); + ASSERT (b[3]->current_data == vnet_buffer (b[3])->l3_hdr_offset); + + ASSERT (b[0]->current_data - vnet_buffer (b[0])->l2_hdr_offset == adv); + ASSERT (b[1]->current_data - vnet_buffer (b[1])->l2_hdr_offset == adv); + ASSERT (b[2]->current_data - vnet_buffer (b[2])->l2_hdr_offset == adv); + ASSERT (b[3]->current_data - vnet_buffer (b[3])->l2_hdr_offset == adv); + } + else + { + ASSERT (b[0]->current_data == vnet_buffer (b[0])->l2_hdr_offset); + ASSERT (b[1]->current_data == vnet_buffer (b[1])->l2_hdr_offset); + ASSERT (b[2]->current_data == vnet_buffer (b[2])->l2_hdr_offset); + ASSERT (b[3]->current_data == vnet_buffer (b[3])->l2_hdr_offset); + + ASSERT (b[0]->current_data - vnet_buffer (b[0])->l3_hdr_offset == -adv); + ASSERT (b[1]->current_data - vnet_buffer (b[1])->l3_hdr_offset == -adv); + ASSERT (b[2]->current_data - vnet_buffer (b[2])->l3_hdr_offset == -adv); + ASSERT (b[3]->current_data - vnet_buffer (b[3])->l3_hdr_offset == -adv); + } #else vnet_buffer (b[0])->l2_hdr_offset = b[0]->current_data; -- cgit 1.2.3-korg