From: Ben Pfaff Date: Tue, 27 Sep 2011 20:10:58 +0000 (-0700) Subject: learn: Allow read-only fields to be matched. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db0a4375c455bbea40aa127c954d8727013e1dc2;p=openvswitch learn: Allow read-only fields to be matched. 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 --- diff --git a/lib/learn.c b/lib/learn.c index 8927ff89..8d7e0b08 100644 --- a/lib/learn.c +++ b/lib/learn.c @@ -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; }