summaryrefslogtreecommitdiffstats
path: root/src/vnet/ethernet/node.c
diff options
context:
space:
mode:
authorEyal Bari <ebari@cisco.com>2017-06-13 12:09:37 +0300
committerJohn Lo <loj@cisco.com>2017-06-14 07:08:18 +0000
commit6f7ebf900e6c65b73f8bb8f60ab5190cc2c893bc (patch)
treeed5ea4c76a6404768489d4a220552da771e256fd /src/vnet/ethernet/node.c
parent89111d0403c462e6a98e2452d4caa540da1c8587 (diff)
ETH:fix l2_len/vlan count mismatch for > 2 tags
l2_len was not updated for the third tag as the ethernet node retracts by the vlan count after parse_header (using ethernet_buffer_header_size) it ends up pointing before the ethernet header + some minor cleanups Change-Id: I4ccaedd33928912e5d837376f146503b27071741 Signed-off-by: Eyal Bari <ebari@cisco.com>
Diffstat (limited to 'src/vnet/ethernet/node.c')
-rwxr-xr-xsrc/vnet/ethernet/node.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/vnet/ethernet/node.c b/src/vnet/ethernet/node.c
index 8967cebefee..4529ca6a572 100755
--- a/src/vnet/ethernet/node.c
+++ b/src/vnet/ethernet/node.c
@@ -165,11 +165,12 @@ parse_header (ethernet_input_variant_t variant,
vlib_buffer_advance (b0, sizeof (h0[0]));
vlan_count = 2;
-
if (*type == ETHERNET_TYPE_VLAN)
{
// More than double tagged packet
*match_flags = SUBINT_CONFIG_VALID | SUBINT_CONFIG_MATCH_3_TAG;
+
+ vlib_buffer_advance (b0, sizeof (h0[0]));
vlan_count = 3; // "unknown" number, aka, 3-or-more
}
}
@@ -239,6 +240,8 @@ determine_next_node (ethernet_main_t * em,
// record the L2 len and reset the buffer so the L2 header is preserved
u32 eth_start = vnet_buffer (b0)->ethernet.start_of_ethernet_header;
vnet_buffer (b0)->l2.l2_len = b0->current_data - eth_start;
+ ASSERT (vnet_buffer (b0)->l2.l2_len ==
+ ethernet_buffer_header_size (b0));
vlib_buffer_advance (b0, -ethernet_buffer_header_size (b0));
// check for common IP/MPLS ethertypes