packet_data_generator2: clear XID field

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-07 15:44:38 +09:00 committed by FUJITA Tomonori
parent afb153f175
commit c8fe765eda

View File

@ -24,6 +24,21 @@
#include <err.h>
#include <stdio.h>
void
clear_xid(struct ofpbuf *buf)
{
/*
* some of libofproto message encoding routines automatically
* allocate XID for the message. e.g. ofputil_encode_flow_mod
* zero-out the XID so that test_parser can perform a simple
* bit-wise comparison.
*/
struct ofp_header *oh = ofpbuf_at_assert(buf, 0, sizeof(*oh));
oh->xid = htonl(0);
}
void
dump_ofpbuf(const char *name, const struct ofpbuf *buf)
{
@ -172,6 +187,7 @@ main(int argc, char *argv[])
snprintf(name, sizeof(name),
"../packet_data/%s/libofproto-%s-%s.packet",
p->dir_name, p->name, m->name);
clear_xid(buf);
dump_ofpbuf(name, buf);
ofpbuf_delete(buf);
}