2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

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.
This commit is contained in:
Jesse Gross
2011-01-29 23:41:27 -08:00
parent f9ef1c31cf
commit 074d69f58b

View File

@@ -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;