TCPv4 State Transition questions

From: Bhavesh P. Davda (bhavesh@avaya.com)
Date: Mon Sep 17 2001 - 18:20:14 EST


Here's what's going on...

client & server on two separate hosts, running 2.2.17 kernel.

1. client <-> server connection in ESTABLISHED state
2. kill -TERM server; respawn server
3. client does select(), gets read event, reads 0 bytes
4. client closes socket
5. client creates new socket, tries non-blocking connect()
6. client gets EINPROGRESS, puts socket on write set, does select
7. select says write event
8. client does getsockopt(SOL_SOCKET, SO_ERROR), gets 0
9. client puts socket on read set, does select
10.client gets read event, reads 0 bytes
11.client repeats sequence of steps from step 4.

Running tcpdump on the server end, this is what I see:
a. server -> client: FIN,ACK
b. client -> server: ACK (of FIN)
c. client -> server: FIN, ACK (of FIN again)
d. server -> client: ACK (of client FIN)
e. client -> server: SYN (new src port)
f. server -> client: RST, ACK
e. & f. repeat forever...

Questions:
1. Why did I get a writable event on select, and the getsockopt telling
me that connect() succeeded, when the SYN, SYN-ACK, ACK handshake has
not completed?

2. Why right after that did I get a readable event on the "connected"
socket, telling me that there was EOF to read?

3. Why is the server sending RSTs back to the client, when the client is
trying to connect to the server from different TCP ports every time? The
new server's socket is in LISTEN state, yet I see this happening.

- Bhavesh

-- 
Bhavesh P. Davda
Avaya Inc
Room B3-B16                     E-mail : bhavesh@avaya.com
1300 West 120th Avenue          Phone  : (303) 538-4438
Westminster, CO 80234           Fax    : (303) 538-3155
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Sep 23 2001 - 21:00:22 EST