[ovs-dev] [PATCH 8/9] ofp-util: Fix table features decoding of match and mask.

Ben Pfaff blp at nicira.com
Mon Aug 4 16:21:09 UTC 2014


The call to parse_oxms() inside ofputil_decode_table_features() sets only
one bit in either 'match' or 'mask' for a given field that is matchable:
in 'mask' if the field is arbitrarily maskable or in 'match' otherwise.
The code at the end of ofputil_decode_table_features() mishandled this,
assuming that an arbitrarily matchable field would have that bit set in
both.  This meant that arbitrarily matchable fields were being
misinterpreted as not matchable at all.  This commit fixes the problem.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 lib/ofp-util.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 1ba3970..9b6ece9 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -4760,15 +4760,17 @@ ofputil_decode_table_features(struct ofpbuf *msg,
 
     /* Fix inconsistencies:
      *
-     *     - Turn off 'mask' and 'wildcard' bits that are not in 'match',
-     *       because a field must be matchable to be masked or wildcarded.
+     *     - Turn on 'match' bits that are set in 'mask', because maskable
+     *       fields are matchable.
      *
      *     - Turn on 'wildcard' bits that are set in 'mask', because a field
-     *       that is arbitrarily maskable can be wildcarded entirely. */
-    bitmap_and(tf->mask.bm, tf->match.bm, MFF_N_IDS);
-    bitmap_and(tf->wildcard.bm, tf->match.bm, MFF_N_IDS);
-
+     *       that is arbitrarily maskable can be wildcarded entirely.
+     *
+     *     - Turn off 'wildcard' bits that are not in 'match', because a field
+     *       must be matchable for it to be meaningfully wildcarded. */
+    bitmap_or(tf->match.bm, tf->mask.bm, MFF_N_IDS);
     bitmap_or(tf->wildcard.bm, tf->mask.bm, MFF_N_IDS);
+    bitmap_and(tf->wildcard.bm, tf->match.bm, MFF_N_IDS);
 
     return 0;
 }
-- 
1.9.1




More information about the dev mailing list