Skip to main content

No route to host vs. -EHOSTUNREACH

This has bothered me for quite a while, years even:

# strace ssh bob
[...]
connect(3, {sa_family=AF_INET, sin_port=htons(22), sin_addr=inet_addr("192.168.10.11")}, \
            16) = -1 EHOSTUNREACH (No route to host)
....while there clearly is a route to this host - it's just that bob is currently down. I think EHOSTUNREACH is the Right Thing to return, but the description "No route to host" is not. Unfortunately, it's apparently not that easy to convince the libc people to fix this :(