: DCCP's passive close needs to match TCP's half-close
PATCH 4/5 : DCCP's passive close needs to match TCP's half-close
[DCCP]: DCCP's passive close needs to match TCP's half-close
This fixes a problem of integrating the new auxiliary states PASSIVE_1/2 with the inet_xxx infrastructure.
The problem appears on the listening side and is that
* a Close may have been received on the socket while it is still in the accept queue of the master/listening socket;
* hence when it is taken out of the queue by inet_accept(), the state of the socket is PASSIVE_1 (whose value is greater than all registered TCP states);
* this triggers the following warning in inet_accept():
Sep 10 16:52:27 kernel: KERNEL: \ assertion ((1 << sk2->sk_state) & (TCPF_ESTABLISHED | TCPF_CLOSE_WAIT | TCPF_CLOSE))\ failed at /usr/src/main_davem-2.6/net/ipv4/af_inet.c (646)
The fix consists mapping PASSIVE_1 into TCPF_CLOSE_WAIT, which is possible since there is no other mapping from a DCCP state into it. Incidentally, the `semantics' of that state are also similar: in TCP's CLOSE_WAIT, a user confirmation to close up the socket is needed - and the same (calling close/exit) situation arises here.
For a server deciding to hold TIMEWAIT state there is no such problem, since DCCP_SOCKOPT_SERVER_TIMEWAIT can not be set on a listening socket, it is by default off and not inherited to child sockets.
Lastly, for PASSIVE_2 the situation is simpler, since this is a client-only state.
--- include/linux/dccp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/dccp.h +2 -2
@@ -249,14 +249,14 @@ enum dccp_state {* CLOSING, corresponds to (b) above) are used. */ DCCP_CLOSEREQ =TCP_FIN_WAIT1 , +DCCP_PASSIVE_1 =TCP_CLOSE_WAIT ,/* any node receiving a Close */ DCCP_CLOSING =TCP_CLOSING ,DCCP_TIME_WAIT =TCP_TIME_WAIT ,DCCP_CLOSED =TCP_CLOSE ,/* Everything below here is specific to DCCP only */ DCCP_INTRINSICS =TCP_MAX_STATES ,DCCP_PARTOPEN , -DCCP_PASSIVE_1 ,/* any node receiving a Close */ -DCCP_PASSIVE_2 ,/* client receiving a CloseReq */ +DCCP_PASSIVE_2 ,/* client receiving CloseReq */ DCCP_MAX_STATES };
Quoted 3 lines · Gerrit Renker
[DCCP]: DCCP's passive close needs to match TCP's half-close
Signed-off-by Gerrit Renker <[email protected]>
Signature · 3 lines
Web1: http://wand.net.nz/~iam4/ Web2: http://www.jandi.co.nz Blog: http://iansblog.jandi.co.nz