From c330ba18f74cf3fd605ff5d74138338925451da5 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Thu, 9 Apr 2015 14:12:59 +0900 Subject: [PATCH] packet_data_generator2: Fix message length field 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 Signed-off-by: FUJITA Tomonori --- 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 70f28d25..e2043bef 100644 --- a/ryu/tests/packet_data_generator2/gen.c +++ b/ryu/tests/packet_data_generator2/gen.c @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -58,6 +59,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) { @@ -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); } }