From 1dfee98d87605bc52ed58738edf01e201b189615 Mon Sep 17 00:00:00 2001
From: Ben Pfaff <blp@nicira.com>
Date: Fri, 21 Jan 2011 14:49:01 -0800
Subject: [PATCH] ofproto: Correctly compute length of flow stats in multipart
 flow stats.

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index e081e32e9..7df8600e5 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -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);
-- 
2.47.0