ofp-actions: Add hex dump of bad actions to log message on error.
authorBen Pfaff <blp@nicira.com>
Mon, 9 Jul 2012 21:21:00 +0000 (14:21 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 11 Jul 2012 08:05:09 +0000 (01:05 -0700)
This should make debugging easier in such cases.

Bug #12460.
Reported-by: Natasha Gude <natasha@nicira.com>
Reported-by: James Schmidt <jschmidt@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/ofp-actions.c

index 2254f5326c9fc7114ae2874ff68917a45a0dc43f..93f6bf77b43d59c0d93fcb998c5f04e55ade6ec7 100644 (file)
@@ -450,8 +450,15 @@ ofpacts_from_openflow10(const union ofp_action *in, size_t n_in,
         }
     }
     if (left) {
-        VLOG_WARN_RL(&rl, "bad action format at offset %zu",
-                     (n_in - left) * sizeof *a);
+        if (!VLOG_DROP_WARN(&rl)) {
+            struct ds s;
+
+            ds_init(&s);
+            ds_put_hex_dump(&s, in, n_in * sizeof *a, 0, false);
+            VLOG_WARN("bad action format at offset %#x:\n%s",
+                      (n_in - left) * sizeof *a, ds_cstr(&s));
+            ds_destroy(&s);
+        }
         return OFPERR_OFPBAC_BAD_LEN;
     }