From: Ben Pfaff Date: Mon, 9 Jul 2012 21:21:00 +0000 (-0700) Subject: ofp-actions: Add hex dump of bad actions to log message on error. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c449c5683a;p=openvswitch ofp-actions: Add hex dump of bad actions to log message on error. This should make debugging easier in such cases. Bug #12460. Reported-by: Natasha Gude Reported-by: James Schmidt Signed-off-by: Ben Pfaff --- diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 2254f532..93f6bf77 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -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; }