Tadaaki Nagao nagao@stratosphere.co.jp
Terry Wilson twilson@redhat.com
Tetsuo NAKAGAWA nakagawa@mxc.nes.nec.co.jp
+Thomas F. Herbert thomasfherbert@gmail.com
Thomas Goirand zigo@debian.org
Thomas Graf tgraf@noironetworks.com
Thomas Lacroix thomas.lacroix@citrix.com
const struct ovs_action_push_vlan *vlan = nl_attr_get(a);
for (i = 0; i < cnt; i++) {
- eth_push_vlan(packets[i], htons(ETH_TYPE_VLAN), vlan->vlan_tci);
+ eth_push_vlan(packets[i], vlan->vlan_tpid, vlan->vlan_tci);
}
break;
}
/* Removes outermost VLAN header (if any is present) from 'packet'.
*
- * 'packet->l2_5' should initially point to 'packet''s outer-most MPLS header
- * or may be NULL if there are no MPLS headers. */
+ * 'packet->l2_5' should initially point to 'packet''s outer-most VLAN header
+ * or may be NULL if there are no VLAN headers. */
void
eth_pop_vlan(struct dp_packet *packet)
{
struct vlan_eth_header *veh = dp_packet_l2(packet);
if (veh && dp_packet_size(packet) >= sizeof *veh
- && veh->veth_type == htons(ETH_TYPE_VLAN)) {
+ && eth_type_vlan(veh->veth_type)) {
memmove((char *)veh + VLAN_HEADER_LEN, veh, 2 * ETH_ADDR_LEN);
dp_packet_resize_l2(packet, -VLAN_HEADER_LEN);
return;
}
- if (eh->eth_type == htons(ETH_TYPE_VLAN)) {
+ if (eth_type_vlan(eh->eth_type)) {
ovs_be16 *p;
char *l2_5 = dp_packet_l2_5(packet);
eth_type == htons(ETH_TYPE_MPLS_MCAST);
}
+static inline bool eth_type_vlan(ovs_be16 eth_type)
+{
+ return eth_type == htons(ETH_TYPE_VLAN_8021Q) ||
+ eth_type == htons(ETH_TYPE_VLAN_8021AD);
+}
+
+
/* Minimum value for an Ethernet type. Values below this are IEEE 802.2 frame
* lengths. */
#define ETH_TYPE_MIN 0x600