public inbox for developer@lists.illumos.org (since 2011-08)
 help / color / mirror / Atom feed
* [REVIEW] 16510 mdb incorrectly prints the IPv6 Traffic Class
@ 2024-05-01 20:40 Bill Sommerfeld
  0 siblings, 0 replies; only message in thread
From: Bill Sommerfeld @ 2024-05-01 20:40 UTC (permalink / raw)
  To: developer

Issue: https://www.illumos.org/issues/16510
CR: https://code.illumos.org/c/illumos-gate/+/3450
Diff: 
https://code.illumos.org/~diff/20990cf4643ec3bb8a8e09fc384ec3459b095b5e

This is a simple fix to how mdb prints the traffic-class field of the
IPv6 header.  This is more or less the same bug as 16508 in a
different part of the code.

For background, the traffic class field is 8 bits wide but is not
byte-aligned - it's split between the low order 4 bits of the first
byte, and the high order 4 bytes of the second byte.

Our ip6_t starts with a uint32_t ip6_vcf (for "version, class, and
flow id") and there are endian-dependant mask constants to extract the
bits of interest.

The original code was doing operations in the wrong order - masking,
then shifting, then byte-swapping; on a little-endian host this always
results in zero.

With a network-order mask, the correct sequence is mask, byteswap, then 
shift.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-01 20:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-01 20:40 [REVIEW] 16510 mdb incorrectly prints the IPv6 Traffic Class Bill Sommerfeld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).