Without this patch, using ovs-ofctl to add a rule which masks the vlan_tci field would not work as expected unless the protocol was explicitly set to NXM.
Signed-off-by: Ethan Jackson <et...@nicira.com> --- lib/ofp-util.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 90475f7..2146527 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -1165,6 +1165,7 @@ enum ofputil_protocol ofputil_usable_protocols(const struct cls_rule *rule) { const struct flow_wildcards *wc = &rule->wc; + uint16_t vlan_tci_mask = ntohs(wc->vlan_tci_mask); BUILD_ASSERT_DECL(FLOW_WC_SEQ == 9); @@ -1214,6 +1215,15 @@ ofputil_usable_protocols(const struct cls_rule *rule) return OFPUTIL_P_NXM_ANY; } + /* Only NXM supports arbitrary masking of vlan_tci. */ + if (vlan_tci_mask & VLAN_CFI + || (vlan_tci_mask & VLAN_PCP_MASK + && (vlan_tci_mask & VLAN_PCP_MASK) != VLAN_PCP_MASK) + || (vlan_tci_mask & VLAN_VID_MASK + && (vlan_tci_mask & VLAN_VID_MASK) != VLAN_VID_MASK)) { + return OFPUTIL_P_NXM_ANY; + } + /* Only NXM supports bitwise matching on transport port. */ if ((wc->tp_src_mask && wc->tp_src_mask != htons(UINT16_MAX)) || (wc->tp_dst_mask && wc->tp_dst_mask != htons(UINT16_MAX))) { -- 1.7.9.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev