From 3a8cfc5087a5b917055a472da1d1efa4e32768dd Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 26 Jan 2012 16:21:50 -0800 Subject: [PATCH] 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 --- lib/odp-util.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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, ""); -- 2.30.2