summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>2015-04-09 14:12:59 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-04-14 05:17:58 +0900
commitc330ba18f74cf3fd605ff5d74138338925451da5 (patch)
treeb1a68e11d58f2caab4a31acc40f90d73004c7619
parent856c3a9a70bc2a33323088a6fd5c60c0993c027b (diff)
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 <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/tests/packet_data_generator2/gen.c11
1 files changed, 10 insertions, 1 deletions
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 <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);
}
}