ofproto: Correctly compute length of flow stats in multipart flow stats.
authorBen Pfaff <blp@nicira.com>
Fri, 21 Jan 2011 22:49:01 +0000 (14:49 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 21 Jan 2011 22:49:46 +0000 (14:49 -0800)
In a flow table dump, the length of the first nx_flow_stats in the second
and subsequent OpenFlow messages was being miscalculated, because
append_nxstats_reply() changed the length of the message in such cases.
So we need to load the starting length after calling append_nxstats_reply()
instead of before.

Reported-by: Reid Price <reid@nicira.com>
Bug #4444.

ofproto/ofproto.c

index e081e32..7df8600 100644 (file)
@@ -3549,8 +3549,8 @@ put_nx_flow_stats(struct ofconn *ofconn, struct rule *rule,
 
     act_len = sizeof *rule->actions * rule->n_actions;
 
-    start_len = (*replyp)->size;
     append_nxstats_reply(sizeof *nfs + NXM_MAX_LEN + act_len, ofconn, replyp);
+    start_len = (*replyp)->size;
     reply = *replyp;
 
     nfs = ofpbuf_put_uninit(reply, sizeof *nfs);