The code that handled processing OpenFlow flow modification requests set the cookie mask to exact-match. This seems reasonable for adding flows, but is not correct for matching, since OpenFlow 1.0 doesn't support matching based on the cookie. This commit changes to cookie mask to fully wildcarded, which is the correct behavior for modifications and deletions. It doesn't cause any problems for flow additions, since the mask is ignored for that operation.
Bug #9742 Reported-by: Luca Giraudo <lgira...@nicira.com> Reported-by: Paul Ingram <p...@nicira.com> Signed-off-by: Justin Pettit <jpet...@nicira.com> --- lib/ofp-util.c | 6 +++++- tests/ofproto.at | 23 +++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 18367ff..f42e2b7 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -1395,7 +1395,11 @@ ofputil_decode_flow_mod(struct ofputil_flow_mod *fm, /* Translate the message. */ fm->cookie = ofm->cookie; - fm->cookie_mask = htonll(UINT64_MAX); + + /* Set the cookie mask to zero, since OpenFlow 1.0 doesn't allow + * any cookie masking for match purposes. The "add" processing + * ignores the mask, so there's no harm using zero. */ + fm->cookie_mask = htonll(0); command = ntohs(ofm->command); fm->idle_timeout = ntohs(ofm->idle_timeout); fm->hard_timeout = ntohs(ofm->hard_timeout); diff --git a/tests/ofproto.at b/tests/ofproto.at index 02b6068..696b43f 100644 --- a/tests/ofproto.at +++ b/tests/ofproto.at @@ -204,7 +204,26 @@ OFPST_FLOW reply: OVS_VSWITCHD_STOP AT_CLEANUP -AT_SETUP([ofproto - del flows with cookie]) +AT_SETUP([ofproto - del flows with cookies]) +OVS_VSWITCHD_START +AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0]) +AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0]) +AT_CHECK([ovs-ofctl add-flow br0 cookie=0x3,in_port=3,actions=0]) +AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl + cookie=0x1, in_port=1 actions=output:0 + cookie=0x2, in_port=2 actions=output:0 + cookie=0x3, in_port=3 actions=output:0 +NXST_FLOW reply: +]) + +AT_CHECK([ovs-ofctl del-flows br0]) +AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl +NXST_FLOW reply: +]) +OVS_VSWITCHD_STOP +AT_CLEANUP + +AT_SETUP([ofproto - del flows based on cookie]) OVS_VSWITCHD_START AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0]) AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0]) @@ -225,7 +244,7 @@ NXST_FLOW reply: OVS_VSWITCHD_STOP AT_CLEANUP -AT_SETUP([ofproto - del flows with cookie mask]) +AT_SETUP([ofproto - del flows based on cookie mask]) OVS_VSWITCHD_START AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=0]) AT_CHECK([ovs-ofctl add-flow br0 cookie=0x2,in_port=2,actions=0]) -- 1.7.5.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev