Some of ofputil_encode_xxx functions does not fill in
the correct value for the length field in the ofp header.
Fix it up before writing out the message to a file.

NOTE: For Open vSwitch, ofconn_send() fixes it up before
sending out the message to the peer.

Signed-off-by: YAMAMOTO Takashi <yamam...@valinux.co.jp>
---
 ryu/tests/packet_data_generator2/gen.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/ryu/tests/packet_data_generator2/gen.c 
b/ryu/tests/packet_data_generator2/gen.c
index 70f28d2..e2043be 100644
--- a/ryu/tests/packet_data_generator2/gen.c
+++ b/ryu/tests/packet_data_generator2/gen.c
@@ -18,6 +18,7 @@
 
 #include <lib/ofpbuf.h>
 #include <lib/ofp-actions.h>
+#include <lib/ofp-msgs.h>
 #include <lib/ofp-util.h>
 #include <lib/packets.h>
 
@@ -59,6 +60,14 @@ dump_ofpbuf(const char *name, const struct ofpbuf *buf)
 }
 
 void
+dump_message(const char *name, struct ofpbuf *buf)
+{
+
+    ofpmsg_update_length(buf);
+    dump_ofpbuf(name, buf);
+}
+
+void
 fill_match(struct match *match)
 {
     match_init_catchall(match);
@@ -208,7 +217,7 @@ main(int argc, char *argv[])
                 "../packet_data/%s/libofproto-%s-%s.packet",
                 p->dir_name, p->name, m->name);
             clear_xid(buf);
-            dump_ofpbuf(name, buf);
+            dump_message(name, buf);
             ofpbuf_delete(buf);
         }
     }
-- 
2.1.0


------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to