Skip to content

usr: say what actually went wrong in ping - #324

Open
daniel-rossier wants to merge 1 commit into
mainfrom
usr/ping-error-messages
Open

usr: say what actually went wrong in ping#324
daniel-rossier wants to merge 1 commit into
mainfrom
usr/ping-error-messages

Conversation

@daniel-rossier

Copy link
Copy Markdown
Contributor

Packet receive failed!! was printed for the ordinary case — a host that simply
does 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 plain
No route to host when ping ran before DHCP had brought the interface up
(which is exactly what a ping typed at the prompt right after boot does), and
the socket error hid Function not implemented on a build with CONFIG_NET
off.

A receive timeout — SO_RCVTIMEO, which lwIP maps to EWOULDBLOCK — now prints
the usual Request timeout for icmp_seq=N. Anything else prints
strerror(errno), as do the send and socket paths.

Before:

/ % ping 192.168.1.1
Packet sending failed!!
Packet sending failed!!
IP Network up and running with address 10.0.2.15

After, on virt64 (build.sh bsp-so3 + deploy.sh bsp-so3, booted with st.sh):

/ % ping -c 3 10.0.2.1
Request timeout for icmp_seq=1
Request timeout for icmp_seq=2
Request timeout for icmp_seq=3

--- 10.0.2.1 ping statistics ---
3 packets transmitted, 0 received, 100.000000% packet loss

A reachable host is unaffected (ping -c 2 10.0.2.2, 0% loss).
scripts/check-format.sh is clean.

"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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant