Fix timeout option for Ping::External#ping6 on macOS
#36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This Pull Request fixes an issue on macOS where
Net::Ping::External#ping6returnsfalseeven for reachable targets.Steps to reproduce
The
ping6command to the same target(2001:4860:4860::8888) succeeds.$ ping6 -c 1 2001:4860:4860::8888 PING6(56=40+8+8 bytes) 2001:268:c281:1ade:c461:6f59:7200:5235 --> 2001:4860:4860::8888 16 bytes from 2001:4860:4860::8888, icmp_seq=0 hlim=113 time=38.147 ms --- 2001:4860:4860::8888 ping6 statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 38.147/38.147/38.147/0.000 msExpected behavior
Ensure that
Net::Ping::External#ping6succeeds and returnstrueon macOS.Actual behavior
Net::Ping::External#ping6return false even for reachable targets.On macOS,
Net::Ping::External#ping6executes the following command (with-toption), and the same error is returned.Details
It fixes the timeout option for
Net::Ping::External#ping6on macOS.macOS's
ping6does not have the-toption to specify a timeout, so the-ioption is used instead.$ man ping6 ... -i wait Wait wait seconds between sending each packet. The default is to wait for one second between each packet. The wait time may be fractional, but only the super-user may specify values less than 0.002 second. This option is incompatible with the -f option.For reference, I have included the contents of the
ping6man page from macOS 15.3 here:https://gist.github.com/taketo1113/4cdae90f7344b121ce051562def4ba21