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 <az...@nicira.com> --- datapath/flow.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/datapath/flow.c b/datapath/flow.c index ba775f4..5ec1b69 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -224,6 +224,15 @@ static bool ovs_match_validate(const struct sw_flow_match *match, return false; } + if (match->mask && + !(match->mask->key.eth.tci & htons(VLAN_TAG_PRESENT))) { + OVS_NLERR("VLAN present bit can not be wildcarded.\n"); + /* Simply log error until user the space program is + * fixed. Then we can switch to return false from + * here. + */ + } + return true; } @@ -1317,6 +1326,7 @@ static int metadata_from_nlattrs(struct sw_flow_match *match, u64 *attrs, *attrs &= ~(1ULL << OVS_KEY_ATTR_IN_PORT); } else if (!is_mask) { SW_FLOW_KEY_PUT(match, phy.in_port, DP_MAX_PORTS, is_mask); + SW_FLOW_KEY_PUT(match, phy.in_port, 0xffff, !is_mask); } if (*attrs & (1ULL << OVS_KEY_ATTR_SKB_MARK)) { @@ -1372,7 +1382,8 @@ static int ovs_key_from_nlattrs(struct sw_flow_match *match, u64 attrs, 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; -- 1.7.9.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev