#ifconfig eth0 10.1.30.10
#ifconfig
eth0 Link encap:Ethernet HWaddr 01:02:03:04:05:06
inet addr:10.1.30.10 Bcast:10.255.255.255 Mask:255.0.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:651 errors:2 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:53083 (51.8 kb) TX bytes:804 (804.0 b)
Interrupt:30 Base address:0x2e0
#telnet 10.1.30.20
telnet: Unable to connect to remote host: Connection timed out
I traced into inet_stream_connect() of af_inet.c, and find that "sk->state"
matchs the "TCP_CLOSE" condition and then goto "sock_error".
...
...
timeo = sock_sndtimeo(sk, flags&O_NONBLOCK);
if ((1<<sk->state)&(TCPF_SYN_SENT|TCPF_SYN_RECV)) {
/* Error code is set above */
if (!timeo || !inet_wait_for_connect(sk, timeo))
goto out;
err = sock_intr_errno(timeo);
if (signal_pending(current))
goto out;
}
/* Connection was closed by RST, timeout, ICMP error
* or another process disconnected us.
*/
if (sk->state == TCP_CLOSE)
goto sock_error; <===== here
...
...