aboutsummaryrefslogtreecommitdiff
path: root/lib/odp-util.c
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2011-01-29 23:41:27 -0800
committerJesse Gross <jesse@nicira.com>2011-01-29 23:41:27 -0800
commit074d69f58bd9d9805e0146c8eddf3cb2e0827e8d (patch)
treee39c1982c97c71dcf71c6865cd6167522da1ffae /lib/odp-util.c
parentf9ef1c31cfcd2d9ded66588a11c59e29e5aaa2ca (diff)
odp-util: Print EtherTypes consistently.
The '#' format specifier doesn't respect the field width modifier, so EtherTypes are printed with variable length. Zero is not a valid EtherType so there isn't a need for the logic to dynamically insert the 0x prefix (if the EtherType isn't specified it won't be printed at all). This fixes the EtherType to have the intended format and also changes the vlan TPID to match.
Diffstat (limited to 'lib/odp-util.c')
-rw-r--r--lib/odp-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/odp-util.c b/lib/odp-util.c
index c70ea358..e50b5785 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -266,7 +266,7 @@ format_odp_key_attr(const struct nlattr *a, struct ds *ds)
q_key = nl_attr_get(a);
ds_put_cstr(ds, "vlan(");
if (q_key->q_tpid != htons(ETH_TYPE_VLAN)) {
- ds_put_format(ds, "tpid=%#"PRIx16",", ntohs(q_key->q_tpid));
+ ds_put_format(ds, "tpid=0x%04"PRIx16",", ntohs(q_key->q_tpid));
}
ds_put_format(ds, "vid%"PRIu16",pcp%d)",
vlan_tci_to_vid(q_key->q_tci),
@@ -274,7 +274,7 @@ format_odp_key_attr(const struct nlattr *a, struct ds *ds)
break;
case ODP_KEY_ATTR_ETHERTYPE:
- ds_put_format(ds, "eth_type(%#04"PRIx16")",
+ ds_put_format(ds, "eth_type(0x%04"PRIx16")",
ntohs(nl_attr_get_be16(a)));
break;