2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

packets: Mask out CFI bit in eth_push_vlan().

We should never push a VLAN tag with the CFI bit set.  This patch
defensively enforces this invariant.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
This commit is contained in:
Ethan Jackson
2012-01-03 10:42:56 -08:00
parent ec14ac2685
commit 2f4ca41b9c
3 changed files with 4 additions and 4 deletions

View File

@@ -77,7 +77,7 @@ compose_benign_packet(struct ofpbuf *b, const char *tag, uint16_t snap_type,
}
/* Insert VLAN header according to given TCI. Packet passed must be Ethernet
* packet.
* packet. Ignores the CFI bit of 'tci' using 0 instead.
*
* Also sets 'packet->l2' to point to the new Ethernet header. */
void
@@ -91,7 +91,7 @@ eth_push_vlan(struct ofpbuf *packet, ovs_be16 tci)
memcpy(tmp.veth_dst, eh->eth_dst, ETH_ADDR_LEN);
memcpy(tmp.veth_src, eh->eth_src, ETH_ADDR_LEN);
tmp.veth_type = htons(ETH_TYPE_VLAN);
tmp.veth_tci = tci;
tmp.veth_tci = tci & htons(~VLAN_CFI);
tmp.veth_next_type = eh->eth_type;
veh = ofpbuf_push_uninit(packet, VLAN_HEADER_LEN);