[ovs-dev] [PATCH] ofp-util: Recognise wildcarded VLAN as NXM only.
Ethan Jackson
ethan at nicira.com
Thu Mar 29 22:00:06 UTC 2012
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 <ethan at 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
More information about the dev
mailing list