Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ping: pr_iph() improvements #26

Closed
wants to merge 2 commits into from
Closed

ping: pr_iph() improvements #26

wants to merge 2 commits into from

Conversation

jlduran
Copy link
Owner

@jlduran jlduran commented Apr 13, 2023

Very early on, the Src/Dst IP addresses were printed in hex notation (%08x), which will always be 8-characters wide. It was later changed to use a dot-decimal notation. Depending on the IP address length, the Src and Dst headers may require a different padding. Use the source and destination IP lengths as padding for the headers.

Also, print an Opts (options) header, if there are options present. It has been abbreviated to Opts to match the length of the previous Data header, removed in ef9e6dc.

Print the header info such that no trailing spaces are produced. As some git workflows may automatically trim them, and make the tests fail (see 25b86f8).

Before

Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
 4  f  00 007c 0001   0 0000  40  01 d868 192.0.2.1  192.0.2.2␣

After

Vr HL TOS  Len   ID Flg  off TTL Pro  cks       Src       Dst
 4  f  00 007c 0001   0 0000  40  01 d868 192.0.2.1 192.0.2.2

And with options:

Before

Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
 4  f  00 007c 0001   0 0000  40  01 d868 192.0.2.1  192.0.2.2 01...

After

Vr HL TOS  Len   ID Flg  off TTL Pro  cks       Src       Dst Opts
 4  f  00 007c 0001   0 0000  40  01 d868 192.0.2.1 192.0.2.2 01...

Differential Revision: https://reviews.freebsd.org/D39561

@jlduran jlduran self-assigned this Apr 13, 2023
Very early on, the Src/Dst IP addresses were printed in hex notation
(%08x), which will always be 8-characters wide.  It was later changed to
use a dot-decimal notation.  Depending on the IP address length, the Src
and Dst headers may require a different padding.  Use the source and
destination IP lengths as padding for the headers.

Also, print an Opts (options) header, if there are options present.  It
has been abbreviated to Opts to match the length of the previous Data
header, removed in ef9e6dc.

Print the header info such that no trailing spaces are produced.  As
some git workflows may automatically trim them, and make the tests fail
(see 25b86f8).

Before

    Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
     4  f  00 007c 0001   0 0000  40  01 d868 192.0.2.1  192.0.2.2␣

After

    Vr HL TOS  Len   ID Flg  off TTL Pro  cks       Src       Dst
     4  f  00 007c 0001   0 0000  40  01 d868 192.0.2.1 192.0.2.2

And with options:

Before

    Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
     4  f  00 007c 0001   0 0000  40  01 d868 192.0.2.1  192.0.2.2 01...

After

    Vr HL TOS  Len   ID Flg  off TTL Pro  cks       Src       Dst Opts
     4  f  00 007c 0001   0 0000  40  01 d868 192.0.2.1 192.0.2.2 01...

Differential Revision:	https://reviews.freebsd.org/D39561
jlduran added a commit that referenced this pull request Apr 13, 2023
NB: Wait until #26 lands and rebase.
jlduran added a commit that referenced this pull request Apr 13, 2023
NB: Wait until #26 lands and rebase.
@jlduran jlduran closed this Feb 13, 2024
@jlduran jlduran deleted the ping-pad-src-dst branch February 13, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant