usr: say what actually went wrong in ping - #324
Open
daniel-rossier wants to merge 1 commit into
Open
Conversation
"Packet receive failed!!" was printed for the ordinary case — a host that does not answer — and said nothing about the rare case where something really did go wrong. Same for "Packet sending failed!!", which hid a plain "No route to host" when ping ran before DHCP had brought the interface up, and for the socket error, which hid "Function not implemented" when CONFIG_NET is off. A receive timeout (SO_RCVTIMEO, reported by lwIP as EWOULDBLOCK) now prints the usual "Request timeout for icmp_seq=N"; anything else prints strerror(errno), as do the send and socket paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Packet receive failed!!was printed for the ordinary case — a host that simplydoes not answer — and said nothing about the rare case where something really
did go wrong.
Packet sending failed!!had the same problem: it hid a plainNo route to hostwhenpingran before DHCP had brought the interface up(which is exactly what a
pingtyped at the prompt right after boot does), andthe socket error hid
Function not implementedon a build withCONFIG_NEToff.
A receive timeout —
SO_RCVTIMEO, which lwIP maps toEWOULDBLOCK— now printsthe usual
Request timeout for icmp_seq=N. Anything else printsstrerror(errno), as do the send and socket paths.Before:
After, on virt64 (
build.sh bsp-so3+deploy.sh bsp-so3, booted withst.sh):A reachable host is unaffected (
ping -c 2 10.0.2.2, 0% loss).scripts/check-format.shis clean.