Vincent Lin
2014-Jan-15 07:47 UTC
remote port forward failed because of failure resolving localhost to IP with error No such file or directory
Hi all, I'm using openssh 5.9p1 with the remote port forwarding "ssh -R 20000:localhost:22 xxx at x.x.x.x". The tunnel is set up. But when I write data to the tunnel, the ssh client failed to forward the data to the localhost. The debug is below: debug1: client_input_channel_open: ctype forwarded-tcpip rchan 2 win 131072 max 32768 debug1: client_request_forwarded_tcpip: listen localhost port 20000, originator 127.0.0.1 port 36478 connect_to localhost: unknown host (No such file or directory) debug1: failure forwarded-tcpip The code relevant is here: 3133 /* Return CONNECTING channel to remote host, port */ 3134 static Channel * 3135 connect_to(const char *host, u_short port, char *ctype, char *rname) 3136 { 3137 struct addrinfo hints; 3138 int gaierr; 3139 int sock = -1; 3140 char strport[NI_MAXSERV]; 3141 struct channel_connect cctx; 3142 Channel *c; 3143 3144 memset(&cctx, 0, sizeof(cctx)); 3145 memset(&hints, 0, sizeof(hints)); 3146 hints.ai_family = IPv4or6; 3147 hints.ai_socktype = SOCK_STREAM; 3148 snprintf(strport, sizeof strport, "%d", port); 3149 if ((gaierr = getaddrinfo(host, strport, &hints, &cctx.aitop)) != 0) { 3150 error("connect_to %.100s: unknown host (%s)", host, 3151 ssh_gai_strerror(gaierr)); 3152 return NULL; 3153 } The error is returned by the function getaddrinfo. And it's "No such file or directory". That is saying it can't find some file to resolve localhost to IP. I found the error is only occurred on the x86_64 with glibc 2.9. Does anybody has the similar problem before? Thanks in advance. Thanks, Vincent