aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-11-21 00:47:42 +0100
committerFlorin Coras <florin.coras@gmail.com>2018-11-21 02:17:16 +0000
commite9cebdf4c12adf7962ab2a2053789c93d70c33d3 (patch)
tree295fab2ad3104cec5edacc3274add438861da0b4 /src
parent1dda386e67a7174ed569404af87ebbe6dd78d552 (diff)
ethernet-input: fix assert in l2 mode
Change-Id: I3befc762694e7c6d6847c361a144f72547038ba1 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/vnet/ethernet/node.c33
1 files changed, 24 insertions, 9 deletions
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;