From: Ben Pfaff Date: Fri, 27 Jan 2012 00:21:50 +0000 (-0800) Subject: odp-util: Describe invalid keys and actions in more detail. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a8cfc5087a5b917055a472da1d1efa4e32768dd;p=openvswitch odp-util: Describe invalid keys and actions in more detail. I have an outstanding bug report that has tons of "***56 leftover bytes***" messages with no way to guess what the problem is. I hope this makes debugging possible. Bug #9346. Signed-off-by: Ben Pfaff --- diff --git a/lib/odp-util.c b/lib/odp-util.c index 12e8dafe..8fa33594 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -278,10 +278,16 @@ format_odp_actions(struct ds *ds, const struct nlattr *actions, format_odp_action(ds, a); } if (left) { + int i; + if (left == actions_len) { ds_put_cstr(ds, ""); } - ds_put_format(ds, ",***%u leftover bytes***", left); + ds_put_format(ds, ",***%u leftover bytes*** (", left); + for (i = 0; i < left; i++) { + ds_put_format(ds, "%02x", ((const uint8_t *) a)[i]); + } + ds_put_char(ds, ')'); } } else { ds_put_cstr(ds, "drop"); @@ -727,10 +733,16 @@ odp_flow_key_format(const struct nlattr *key, size_t key_len, struct ds *ds) format_odp_key_attr(a, ds); } if (left) { + int i; + if (left == key_len) { ds_put_cstr(ds, ""); } - ds_put_format(ds, ",***%u leftover bytes***", left); + ds_put_format(ds, ",***%u leftover bytes*** (", left); + for (i = 0; i < left; i++) { + ds_put_format(ds, "%02x", ((const uint8_t *) a)[i]); + } + ds_put_char(ds, ')'); } } else { ds_put_cstr(ds, "");