aboutsummaryrefslogtreecommitdiff
path: root/lib/ofp-util.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2013-06-28 10:06:58 -0700
committerBen Pfaff <blp@nicira.com>2013-06-28 10:06:58 -0700
commit340c7bb2b9565b07de7c105d7fae298be908d138 (patch)
tree1f67e05e909ddb5d3a4f23f3fec0eac36c40a416 /lib/ofp-util.c
parent9cae45dc699f64e85ad68db5f3b2f50758ad6e34 (diff)
ofp-util: OpenFlow 1.0 can match IPv6 Ethertype even though not L3 or L4.
OpenFlow 1.0 can match on flows that have the IPv6 Ethertype, but ofputil_usable_protocols() incorrectly reported that such a match required NXM or OXM. This commit fixes the problem. Also, add some related tests. Reported-by: Nagi Reddy Jonnala <njonnala@Brocade.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/ofp-util.c')
-rw-r--r--lib/ofp-util.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 028eaeba..48b89287 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -1086,8 +1086,19 @@ ofputil_usable_protocols(const struct match *match)
| OFPUTIL_P_OF13_OXM;
}
- /* NXM and OXM support matching IPv6 traffic. */
- if (match->flow.dl_type == htons(ETH_TYPE_IPV6)) {
+ /* NXM and OXM support matching L3 and L4 fields within IPv6.
+ *
+ * (arp_sha, arp_tha, nw_frag, and nw_ttl are covered elsewhere so they
+ * don't need to be included in this test too.) */
+ if (match->flow.dl_type == htons(ETH_TYPE_IPV6)
+ && (!ipv6_mask_is_any(&wc->masks.ipv6_src)
+ || !ipv6_mask_is_any(&wc->masks.ipv6_dst)
+ || !ipv6_mask_is_any(&wc->masks.nd_target)
+ || wc->masks.ipv6_label
+ || wc->masks.tp_src
+ || wc->masks.tp_dst
+ || wc->masks.nw_proto
+ || wc->masks.nw_tos)) {
return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM
| OFPUTIL_P_OF13_OXM;
}
@@ -1112,12 +1123,6 @@ ofputil_usable_protocols(const struct match *match)
| OFPUTIL_P_OF13_OXM;
}
- /* NXM and OXM support matching IPv6 flow label. */
- if (wc->masks.ipv6_label) {
- return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM
- | OFPUTIL_P_OF13_OXM;
- }
-
/* NXM and OXM support matching IP ECN bits. */
if (wc->masks.nw_tos & IP_ECN_MASK) {
return OFPUTIL_P_OF10_NXM_ANY | OFPUTIL_P_OF12_OXM