[ovs-dev] [PATCH] odp-util: Describe invalid keys and actions in more detail.

Ben Pfaff blp at nicira.com
Fri Jan 27 00:22:06 UTC 2012


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 <blp at nicira.com>
---
 lib/odp-util.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lib/odp-util.c b/lib/odp-util.c
index 12e8daf..8fa3359 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, "<empty>");
             }
-            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, "<empty>");
             }
-            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, "<empty>");
-- 
1.7.2.5




More information about the dev mailing list