Page MenuHomeFreeBSD

ping: Reference implementation
AbandonedPublic

Authored by jlduran_gmail.com on Feb 7 2023, 11:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 9, 4:58 AM
Unknown Object (File)
Tue, Apr 9, 12:27 AM
Unknown Object (File)
Sun, Apr 7, 9:50 PM
Unknown Object (File)
Mar 12 2024, 6:47 PM
Unknown Object (File)
Dec 20 2023, 7:38 AM
Unknown Object (File)
Dec 11 2023, 1:41 AM
Unknown Object (File)
Nov 10 2023, 5:48 PM
Unknown Object (File)
Oct 10 2023, 7:41 PM

Details

Reviewers
asomers
markj
Group Reviewers
network
Summary

This is unlikely to be committed, as it reverts an SA and code already on -RELEASE branches.
It serves, however, the purpose of a reference implementation.
The current code corresponds to the following commits (https://github.com/jlduran/freebsd-src/compare/base...jlduran:freebsd-src:ping-reference-implementation):

  1. Revert 46d7b45a267b3d78c5054b210ff7b6c55bfca42b
  2. Revert d9cacf605e2ac0f704e1ce76357cbfbe6cb63d52
  3. Ignore alignment errors (d9cacf605e2ac0f704e1ce76357cbfbe6cb63d52 was created to fix this precisely)
  4. Unskip some failing tests/fix/add some tests
  5. Remove #ifndef icmp_data guards (these vestigial guards were only needed on <= 4.2BSD)

Do not get too invested, as this revision will never land.

Test Plan

Start submitting other revisions that fix (but not optimize) the current code, while keeping this one for comparison.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

jlduran_gmail.com edited the summary of this revision. (Show Details)

Add tests for TCP/UDP unreachable packets:
Before tcpdump existed, ping provided some sort of packet sniffing capabilities. After ef9e6dc7eebe9830511602904d3ef5218d964080 this functionality was almost removed, to only display packets sent by us.
The TCP/UDP code remained, I do not know how to trigger it naturally, by doctoring the packet, however, we are able to test it.

jlduran_gmail.com retitled this revision from WIP ping: Reference implementation to ping: Reference implementation.
jlduran_gmail.com edited the summary of this revision. (Show Details)
  • Remove WIP commit (it serves no purpose)
  • Add tests to pr_pack() with options

The function pr_pack() prints out a packet. If the IP packet contains options, these are printed as well.
Commit 46d7b45a267b3d78c5054b210ff7b6c55bfca42b introduced an integer overflow bug, by changing hlen from int to uint8_t; while the fix is simple, let's test everything to avoid introducing regressions.

I don't understand why you need this revision. For what will it serve as a reference implementation?

I don't understand why you need this revision. For what will it serve as a reference implementation?

As a reference for myself and the other reviewers that may not be acquainted with the output. Also, in order to compare it with the future revisions that attempt to fix this same issue, the first one being D38469. I'll relate the remaining ones to this revision for tracking.
Once the others have been reviewed/accepted, this revision will be abandoned.

Update the "reference" implementation with the same tests added to the proposed fixes:

  • Add max inner packet IHL without payload test
  • Add IHL too short test
  • Add quoted data too short test
  • Add inner IHL too short test
  • Add inner packet too short test
In D38431#881732, @cy wrote:

See https://reviews.freebsd.org/D38744 for a simpler alternative.

This is my reference implementation (prior to both commits noted in the description), no only it fixes, as you well suggest, D38744, but also others (e.g., D38469), It is not intended to be committed.

In D38431#881732, @cy wrote:

See https://reviews.freebsd.org/D38744 for a simpler alternative.

This is my reference implementation (prior to both commits noted in the description), no only it fixes, as you well suggest, D38744, but also others (e.g., D38469), It is not intended to be committed.

Sorry. I realized that after I had hit submit.

This can now be abandoned. Thank you!