NXM/OXM are only supposed to put 1-bits in a value if the corresponding bit in the mask is a 1-bit, but in the case of cookie matching, e.g. ovs-ofctl del-flows br0 cookie=0x3/0x1 ovs-ofctl would encode a bad OXM. This fixes the problem.
(The test "ofproto - del flows based on cookie mask" in the OVS testsuite tickles this bug.) Signed-off-by: Ben Pfaff <b...@nicira.com> Acked-by: YAMAMOTO Takashi <yamam...@valinux.co.jp> --- lib/nx-match.c | 2 +- lib/ofp-util.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/nx-match.c b/lib/nx-match.c index 6537601..4b9a9c4 100644 --- a/lib/nx-match.c +++ b/lib/nx-match.c @@ -743,7 +743,7 @@ nx_put_raw(struct ofpbuf *b, enum ofp_version oxm, const struct match *match, flow->metadata, match->wc.masks.metadata); /* Cookie. */ - nxm_put_64m(b, NXM_NX_COOKIE, cookie, cookie_mask); + nxm_put_64m(b, NXM_NX_COOKIE, cookie & cookie_mask, cookie_mask); match_len = ofpbuf_size(b) - start_len; return match_len; diff --git a/lib/ofp-util.c b/lib/ofp-util.c index c8d38e8..ff84abb 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -2229,7 +2229,7 @@ ofputil_encode_flow_mod(const struct ofputil_flow_mod *fm, || fm->command == OFPFC_ADD) { ofm->cookie = fm->new_cookie; } else { - ofm->cookie = fm->cookie; + ofm->cookie = fm->cookie & fm->cookie_mask; } ofm->cookie_mask = fm->cookie_mask; if (fm->table_id != OFPTT_ALL -- 1.7.10.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev