HomeFreeBSD

ping: Fix the display of Flags/Fragment Offset

Description

ping: Fix the display of Flags/Fragment Offset

In the IP header, Flags + Fragment Offset is a 16-bit field.

Use ntohs() instead of ntohl(), otherwise the Flags/Fragment Offset
values may not display correctly.

Before (DF set)

Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
 4  5  00 0054 0001   0 0000  40  01 b6a4 192.0.2.1  192.0.2.2

After (DF set)

Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
 4  5  00 0054 0001   2 0000  40  01 b6a4 192.0.2.1  192.0.2.2

Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38479

Details

Provenance
jlduran_gmail.comAuthored on Mar 14 2023, 3:09 PM
markjCommitted on Mar 14 2023, 3:58 PM
Reviewer
markj
Differential Revision
D38479: ping: Fix the display of Flags/Fragment Offset
Parents
rGf32d6f745d0e: ping6: Use errx to avoid appending a specious error message
Branches
Unknown
Tags
Unknown