Page MenuHomeFreeBSD

ping: Remove vestigial code
ClosedPublic

Authored by jlduran_gmail.com on Feb 9 2023, 11:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 8 2024, 10:13 PM
Unknown Object (File)
Mar 8 2024, 10:13 PM
Unknown Object (File)
Mar 8 2024, 10:13 PM
Unknown Object (File)
Mar 8 2024, 10:13 PM
Unknown Object (File)
Mar 8 2024, 2:48 PM
Unknown Object (File)
Jan 5 2024, 8:45 PM
Unknown Object (File)
Dec 20 2023, 8:10 AM
Unknown Object (File)
Dec 11 2023, 1:42 AM

Details

Summary

Ping used to provide some sort of packet sniffing capabilities, this was in an era where hubs were used and tcpdump wasn't invented.
pr_iph() is a function that prints the IP header of the packet.
pr_retip() is essentially a wrapper function to pr_iph(), that also displays the source and destination ports of a TCP or UDP packet.
After ef9e6dc7eebe9830511602904d3ef5218d964080 some of this functionality was almost removed, to only display packets sent by us (26+ years ago).
At this point, reaching this code path was only possible by doctoring the original packet.
After 46d7b45a267b3d78c5054b210ff7b6c55bfca42b this code path can never be reached.
Remove the code.
Note that this essentially turns pr_retip() into pr_iph().

Test Plan

DISCLAIMER: My preferred route would be to implement D38431, however for reasons detailed in that review, we'll resort to fixing what we currently have.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sbin/ping/ping.c
1713–1714

Why do we need this function at all?

sbin/ping/ping.c
1713–1714

Precisely! From the summary:

Note that this essentially turns pr_retip() into pr_iph().

Let me know if the unification should go on a separate commit or squash it with this one?

sbin/ping/ping.c
1713–1714

I think you should just squash it into this one.

jlduran_gmail.com added inline comments.
sbin/ping/ping.c
1713–1714

Will do!

jlduran_gmail.com marked 2 inline comments as done.
  • Remove pr_retip()
This revision is now accepted and ready to land.Feb 13 2023, 2:41 PM
This revision was automatically updated to reflect the committed changes.