[ovs-dev] [PATCH 08/12] ofp-util: Correct setting of Flow Mod cookie on encode
Simon Horman
horms at verge.net.au
Mon Sep 17 00:26:55 UTC 2012
When the command of a Flow Mod messages is ADD the cookie should be set as
fm->cookie, internally this is the new cookie value to be set. Otherwise it
should be set as fm->cookie, internally this is the cookie value to match.
Also remove 'XXX' marker from the matching code in the decoder.
I am now comfortable with the implementation.
Signed-off-by: Simon Horman <horms at verge.net.au>
---
v13
* No change
v12
* No change
v11
* Initial post
---
lib/ofp-util.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index cc82a10..98dbb51 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -1156,7 +1156,6 @@ ofputil_decode_flow_mod(struct ofputil_flow_mod *fm,
fm->cookie_mask = htonll(0);
fm->new_cookie = ofm->cookie;
} else {
- /* XXX */
fm->cookie = ofm->cookie;
fm->cookie_mask = ofm->cookie_mask;
fm->new_cookie = htonll(UINT64_MAX);
@@ -1283,7 +1282,11 @@ ofputil_encode_flow_mod(const struct ofputil_flow_mod *fm,
msg = ofpraw_alloc(OFPRAW_OFPT11_FLOW_MOD, OFP12_VERSION,
NXM_TYPICAL_LEN + fm->ofpacts_len);
ofm = ofpbuf_put_zeros(msg, sizeof *ofm);
- ofm->cookie = fm->new_cookie;
+ if (fm->command == OFPFC_ADD) {
+ ofm->cookie = fm->new_cookie;
+ } else {
+ ofm->cookie = fm->cookie;
+ }
ofm->cookie_mask = fm->cookie_mask;
ofm->table_id = fm->table_id;
ofm->command = fm->command;
--
1.7.10.4
More information about the dev
mailing list