diff options
Diffstat (limited to 'vnet/vnet/l2')
-rw-r--r-- | vnet/vnet/l2/l2_input.h | 4 | ||||
-rw-r--r-- | vnet/vnet/l2/l2_vtr.h | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/vnet/vnet/l2/l2_input.h b/vnet/vnet/l2/l2_input.h index 1e5c1f0abc8..50649e79061 100644 --- a/vnet/vnet/l2/l2_input.h +++ b/vnet/vnet/l2/l2_input.h @@ -227,6 +227,7 @@ vnet_update_l2_len (vlib_buffer_t * b) { ethernet_header_t * eth; u16 ethertype; + u8 vlan_count = 0; /* point at currrent l2 hdr */ eth = vlib_buffer_get_current (b); @@ -245,12 +246,15 @@ vnet_update_l2_len (vlib_buffer_t * b) (ethertype == ETHERNET_TYPE_VLAN_9200)) { ethernet_vlan_header_t * vlan; vnet_buffer(b)->l2.l2_len += sizeof (*vlan); + vlan_count = 1; vlan = (void *) (eth+1); ethertype = clib_net_to_host_u16 (vlan->type); if (ethertype == ETHERNET_TYPE_VLAN) { vnet_buffer(b)->l2.l2_len += sizeof (*vlan); + vlan_count = 2; } } + ethernet_buffer_set_vlan_count(b, vlan_count); } /* diff --git a/vnet/vnet/l2/l2_vtr.h b/vnet/vnet/l2/l2_vtr.h index aef6c6d255e..ccd0920db52 100644 --- a/vnet/vnet/l2/l2_vtr.h +++ b/vnet/vnet/l2/l2_vtr.h @@ -96,6 +96,10 @@ l2_vtr_process (vlib_buffer_t * b0, // Update l2_len vnet_buffer(b0)->l2.l2_len += (word)config->push_bytes - (word)config->pop_bytes; + // Update vlan tag count + ethernet_buffer_adjust_vlan_count_by_bytes(b0, + (word)config->push_bytes - (word)config->pop_bytes); + // Update packet len vlib_buffer_advance(b0, (word)config->pop_bytes - (word)config->push_bytes); |