ds_put_format(string, " (xid=0x%"PRIx32"):", ntohl(oh->xid));
}
+static void
+ofp_header_to_string__(const struct ofp_header *oh,
+ const struct ofputil_msg_type *type, struct ds *string)
+{
+ ds_put_cstr(string, ofputil_msg_type_name(type));
+ ofp_print_version(oh, string);
+}
+
static void
ofp_to_string__(const struct ofp_header *oh,
const struct ofputil_msg_type *type, struct ds *string,
enum ofputil_msg_code code;
const void *msg = oh;
- ds_put_cstr(string, ofputil_msg_type_name(type));
- ofp_print_version(oh, string);
+ ofp_header_to_string__(oh, type, string);
code = ofputil_msg_type_code(type);
switch (code) {
case OFPUTIL_MSG_INVALID:
ds_put_format(&string, "OpenFlow packet too short (only %zu bytes):\n",
len);
} else if (ntohs(oh->length) > len) {
+ const struct ofputil_msg_type *type;
+ enum ofperr error;
+
+ error = ofputil_decode_msg_type_partial(oh, len, &type);
+ if (!error) {
+ ofp_header_to_string__(oh, type, &string);
+ ds_put_char(&string, '\n');
+ }
+
ds_put_format(&string,
"(***truncated to %zu bytes from %"PRIu16"***)\n",
len, ntohs(oh->length));