X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fofp-print.c;h=c1b50e2c142ae7cf67883148a5b783ad9263ac05;hb=de6c85b0a2e61105d288c23b718f6599761c2a2e;hp=cafc665d7b10a8104e348e23bbb50e4060d932ee;hpb=7a25bd99246a548891427d62ccefb65f765bbc48;p=openvswitch diff --git a/lib/ofp-print.c b/lib/ofp-print.c index cafc665d..c1b50e2c 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -903,6 +903,23 @@ ofp_print_error(struct ds *string, enum ofperr error) ds_put_format(string, "***decode error: %s***\n", ofperr_get_name(error)); } +static void +ofp_print_hello(struct ds *string, const struct ofp_header *oh) +{ + uint32_t allowed_versions; + bool ok; + + ok = ofputil_decode_hello(oh, &allowed_versions); + + ds_put_cstr(string, "\n version bitmap: "); + ofputil_format_version_bitmap(string, allowed_versions); + + if (!ok) { + ds_put_cstr(string, "\n unknown data in hello:\n"); + ds_put_hex_dump(string, oh, ntohs(oh->length), 0, true); + } +} + static void ofp_print_error_msg(struct ds *string, const struct ofp_header *oh) { @@ -1729,9 +1746,7 @@ ofp_to_string__(const struct ofp_header *oh, enum ofpraw raw, ofp_header_to_string__(oh, raw, string); switch (ofptype_from_ofpraw(raw)) { case OFPTYPE_HELLO: - ds_put_char(string, '\n'); - ds_put_hex_dump(string, oh + 1, ntohs(oh->length) - sizeof *oh, - 0, true); + ofp_print_hello(string, oh); break; case OFPTYPE_ERROR: