learn: Allow read-only fields to be matched.
authorBen Pfaff <blp@nicira.com>
Tue, 27 Sep 2011 20:10:58 +0000 (13:10 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 18 Oct 2011 20:43:39 +0000 (13:43 -0700)
nxm_dst_check() requires a writable field.  Since NX_LEARN_DST_MATCH only
matches on a field and doesn't write to a field, use nxm_src_check() for
that case instead.

Bug #7507.
Reported-by: Michael Mao <mmao@nicira.com>
lib/learn.c

index 8927ff8996e7331ff8ca482547f0ca6a35952ac8..8d7e0b08c400fa565869b851a0dce06f0fe8dbc1 100644 (file)
@@ -160,7 +160,9 @@ learn_check(const struct nx_action_learn *learn, const struct flow *flow)
             int dst_ofs = ntohs(get_be16(&p));
             int error;
 
-            error = nxm_dst_check(dst_field, dst_ofs, n_bits, &rule.flow);
+            error = (dst_type == NX_LEARN_DST_LOAD
+                     ? nxm_dst_check(dst_field, dst_ofs, n_bits, &rule.flow)
+                     : nxm_src_check(dst_field, dst_ofs, n_bits, &rule.flow));
             if (error) {
                 return error;
             }