From: Jesse Gross Date: Sun, 30 Jan 2011 07:41:27 +0000 (-0800) Subject: odp-util: Print EtherTypes consistently. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=074d69f58bd9d9805e0146c8eddf3cb2e0827e8d;p=openvswitch 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. --- 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;