From 62f13eb2a1ef5dfa6a2069568356bd4657916d61 Mon Sep 17 00:00:00 2001 From: Andy Zhou Date: Mon, 29 Jul 2013 14:05:23 -0700 Subject: [PATCH] datapath: Fix missing VLAN netlink attribute handling Missing VLAN netlink attribute should be interpreted as exact match of no VLAN tag, instead of wildcarded match for all VLAN tags. Bug #18736. Signed-off-by: Andy Zhou Signed-off-by: Jesse Gross --- datapath/flow.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/datapath/flow.c b/datapath/flow.c index 7f69538e2..3acc74321 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -1365,15 +1365,19 @@ static int ovs_key_from_nlattrs(struct sw_flow_match *match, u64 attrs, __be16 tci; tci = nla_get_be16(a[OVS_KEY_ATTR_VLAN]); - if (!is_mask) - if (!(tci & htons(VLAN_TAG_PRESENT))) { + if (!(tci & htons(VLAN_TAG_PRESENT))) { + if (is_mask) + OVS_NLERR("VLAN TCI mask does not have exact match for VLAN_TAG_PRESENT bit.\n"); + else OVS_NLERR("VLAN TCI does not have VLAN_TAG_PRESENT bit set.\n"); - return -EINVAL; - } + + return -EINVAL; + } SW_FLOW_KEY_PUT(match, eth.tci, tci, is_mask); attrs &= ~(1ULL << OVS_KEY_ATTR_VLAN); - } + } else if (!is_mask) + SW_FLOW_KEY_PUT(match, eth.tci, htons(0xffff), true); if (attrs & (1ULL << OVS_KEY_ATTR_ETHERTYPE)) { __be16 eth_type; -- 2.43.0