summaryrefslogtreecommitdiff
path: root/lib/odp-util.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-12-23 14:21:01 -0800
committerBen Pfaff <blp@nicira.com>2010-12-28 09:17:23 -0800
commit8ba43fbd1f14d60a2d097bafc7d0606d860d0f72 (patch)
treed807d22def4d112a2c9e53905654a96bf31b004c /lib/odp-util.c
parent406e37ecf554529e9380ef06863d85ccc94009d1 (diff)
downloadopenvswitch-8ba43fbd1f14d60a2d097bafc7d0606d860d0f72.tar.gz
odp-util: Improve formatting of bad ODP actions.
nla_len is the size of a Netlink attribute including its header, but we only want to print the attribute payload, so use nl_attr_get_size() instead. Also, make it clear that what follows the "bad action" information is a dump of the action itself. Acked-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'lib/odp-util.c')
-rw-r--r--lib/odp-util.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/odp-util.c b/lib/odp-util.c
index 547e87ed9..09f8b8384 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -83,13 +83,15 @@ odp_action_len(uint16_t type)
static void
format_generic_odp_action(struct ds *ds, const struct nlattr *a)
{
+ size_t len = nl_attr_get_size(a);
+
ds_put_format(ds, "action%"PRId16, nl_attr_type(a));
- if (a->nla_len) {
+ if (len) {
const uint8_t *unspec;
unsigned int i;
unspec = nl_attr_get(a);
- for (i = 0; i < a->nla_len; i++) {
+ for (i = 0; i < len; i++) {
ds_put_char(ds, i ? ' ': '(');
ds_put_format(ds, "%02x", unspec[i]);
}
@@ -104,7 +106,7 @@ format_odp_action(struct ds *ds, const struct nlattr *a)
ovs_be32 ip;
if (nl_attr_get_size(a) != odp_action_len(nl_attr_type(a))) {
- ds_put_format(ds, "***bad action: length is %zu, expected %d*** ",
+ ds_put_format(ds, "bad length %zu, expected %d for: ",
nl_attr_get_size(a), odp_action_len(nl_attr_type(a)));
format_generic_odp_action(ds, a);
return;