flinux icon indicating copy to clipboard operation
flinux copied to clipboard

Ping (iputils) hangs

Open j-selby opened this issue 9 years ago • 1 comments

EDIT: This is related to raw sockets, and likely depends on that. Feel free to close.

Ping unfortunately doesn't work.

Package: iputils

Flog (see latest revision, got wrong record): https://gist.github.com/j-selby/e2e657de36eb56fe5020

flinux /bin/ping google.com

WARNING: setsockopt(ICMP_FILTER): Invalid argument WARNING: your kernel is veeery old. No problems. PING google.com (216.58.220.142) 56(84) bytes of data. Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMP

(Swap out google.com for 8.8.8.8, same result)

j-selby avatar Mar 15 '15 08:03 j-selby

Added two missing setsockopt (SO_SNDBUF and SO_RCVBUF) in commit 9ddfea8dd1d75756585234eee8f93f8aad9a51bc. It is still not working. The two complaints ICMP_FILTER and SO_TIMESTAMP are neither supported by Windows. For ICMP_FILTER, let's hope ping works without it. For SO_TIMESTAMP or SIOCGSTAMP, we may manually add the timestamp in recv*(). That will be very inaccurate, but better than not working.

The reason for hanging seems to be related to missing of the two timeout options SO_SNDTIMEO and SO_RCVTIMEO. Since we're using non-blocking sockets to emulate blocking socket, we cannot directly pass this to WinSock2. But implementing these timeouts manually should be easy.

wishstudio avatar Mar 15 '15 10:03 wishstudio