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>
This commit is contained in:
YAMAMOTO Takashi 2015-04-09 14:12:59 +09:00 committed by FUJITA Tomonori
parent 856c3a9a70
commit c330ba18f7

View File

@ -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>
@ -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);
}
}