diff options
Diffstat (limited to 'vnet/vnet/ethernet/node.c')
-rw-r--r-- | vnet/vnet/ethernet/node.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/vnet/vnet/ethernet/node.c b/vnet/vnet/ethernet/node.c index 1ec49c4b805..7b9924f5cde 100644 --- a/vnet/vnet/ethernet/node.c +++ b/vnet/vnet/ethernet/node.c @@ -98,6 +98,7 @@ parse_header (ethernet_input_variant_t variant, u16 * outer_id, u16 * inner_id, u32 * match_flags) { + u8 vlan_count; if (variant == ETHERNET_INPUT_VARIANT_ETHERNET || variant == ETHERNET_INPUT_VARIANT_NOT_L2) { @@ -129,6 +130,7 @@ parse_header (ethernet_input_variant_t variant, *inner_id = 0; *match_flags = SUBINT_CONFIG_VALID | SUBINT_CONFIG_MATCH_0_TAG; + vlan_count = 0; // check for vlan encaps if ((*type == ETHERNET_TYPE_VLAN) || @@ -150,6 +152,7 @@ parse_header (ethernet_input_variant_t variant, *type = clib_net_to_host_u16(h0->type); vlib_buffer_advance (b0, sizeof (h0[0])); + vlan_count = 1; if (*type == ETHERNET_TYPE_VLAN) { // Double tagged packet @@ -164,13 +167,16 @@ parse_header (ethernet_input_variant_t variant, *type = clib_net_to_host_u16(h0->type); 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; + vlan_count = 3; // "unknown" number, aka, 3-or-more } } } + ethernet_buffer_set_vlan_count(b0, vlan_count); } // Determine the subinterface for this packet, given the result of the @@ -230,7 +236,7 @@ determine_next_node (ethernet_main_t * em, *next0 = em->l2_next; // record the L2 len and reset the buffer so the L2 header is preserved vnet_buffer(b0)->l2.l2_len = b0->current_data; - vlib_buffer_advance (b0, -(b0->current_data)); + vlib_buffer_advance(b0, - ethernet_buffer_header_size(b0)); // check for common IP/MPLS ethertypes } else if (type0 == ETHERNET_TYPE_IP4) { |