Page MenuHomeFreeBSD

ping: if -S srcaddr uses a numeric address, use that protocol
ClosedPublic

Authored by karels on May 20 2022, 2:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 14 2024, 7:41 PM
Unknown Object (File)
Feb 13 2024, 9:05 PM
Unknown Object (File)
Feb 12 2024, 5:59 PM
Unknown Object (File)
Feb 9 2024, 10:14 AM
Unknown Object (File)
Jan 14 2024, 8:59 AM
Unknown Object (File)
Jan 10 2024, 1:56 PM
Unknown Object (File)
Jan 4 2024, 8:22 AM
Unknown Object (File)
Jan 4 2024, 8:22 AM
Subscribers

Details

Summary

The command "ping -S dotted.quad hostname" fails on dual-stack hosts
with the confusing message "ping: invalid source address: Name does
not resolve" because IPv6 is selected in preference. If the argument
to -S is numeric (likely), select the corresponding address family,
as if -4 or -6 was specified.

Test Plan

tested manually

Diff Detail

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

Event Timeline

Good catch. Do you think you could add a testcase to sbin/ping/tests/ping_test.sh ?

I haven't used atf. I can guess at much of the layout, but don't know how to run it. Is there documentation somewhere?

I haven't used atf. I can guess at much of the layout, but don't know how to run it. Is there documentation somewhere?

The atf-sh-api(3) man page is the best place to look.

sbin/ping/tests/ping_test.sh
80

Should this not also require ipv4?

Change v6 test to require v4 as well for symmetry

Thanks for fixing this.

This revision is now accepted and ready to land.May 20 2022, 10:55 PM
This revision was automatically updated to reflect the committed changes.
karels marked an inline comment as done.