From 074d69f58bd9d9805e0146c8eddf3cb2e0827e8d Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Sat, 29 Jan 2011 23:41:27 -0800 Subject: [PATCH] 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. --- lib/odp-util.c | 4 ++-- 1 file 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; -- 2.30.2