diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2007-11-28 08:34:53 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:55:12 -0500 |
commit | f11135a3442996d78dad99933bfdb90d1f6588d3 (patch) | |
tree | 6b10cea26f0551b769097296b7e41f25d6b44f08 /net/dccp/proto.c | |
parent | f53dc67c5e7babafe239b93a11678b0e05bead51 (diff) |
[DCCP]: Dedicated auxiliary states to support passive-close
This adds two auxiliary states to deal with passive closes:
* PASSIVE_CLOSE (reached from OPEN via reception of Close) and
* PASSIVE_CLOSEREQ (reached from OPEN via reception of CloseReq)
as internal intermediate states.
These states are used to allow a receiver to process unread data before
acknowledging the received connection-termination-request (the Close/CloseReq).
Without such support, it will happen that passively-closed sockets enter CLOSED
state while there is still unprocessed data in the queue; leading to unexpected
and erratic API behaviour.
PASSIVE_CLOSE has been mapped into TCPF_CLOSE_WAIT, so that the code will
seamlessly work with inet_accept() (which tests for this state).
The state names are thanks to Arnaldo, who suggested this naming scheme
following an earlier revision of this patch.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/proto.c')
-rw-r--r-- | net/dccp/proto.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 73006b747678..3489d3f21f50 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -60,8 +60,7 @@ void dccp_set_state(struct sock *sk, const int state) | |||
60 | { | 60 | { |
61 | const int oldstate = sk->sk_state; | 61 | const int oldstate = sk->sk_state; |
62 | 62 | ||
63 | dccp_pr_debug("%s(%p) %-10.10s -> %s\n", | 63 | dccp_pr_debug("%s(%p) %s --> %s\n", dccp_role(sk), sk, |
64 | dccp_role(sk), sk, | ||
65 | dccp_state_name(oldstate), dccp_state_name(state)); | 64 | dccp_state_name(oldstate), dccp_state_name(state)); |
66 | WARN_ON(state == oldstate); | 65 | WARN_ON(state == oldstate); |
67 | 66 | ||
@@ -134,14 +133,17 @@ EXPORT_SYMBOL_GPL(dccp_packet_name); | |||
134 | const char *dccp_state_name(const int state) | 133 | const char *dccp_state_name(const int state) |
135 | { | 134 | { |
136 | static char *dccp_state_names[] = { | 135 | static char *dccp_state_names[] = { |
137 | [DCCP_OPEN] = "OPEN", | 136 | [DCCP_OPEN] = "OPEN", |
138 | [DCCP_REQUESTING] = "REQUESTING", | 137 | [DCCP_REQUESTING] = "REQUESTING", |
139 | [DCCP_PARTOPEN] = "PARTOPEN", | 138 | [DCCP_PARTOPEN] = "PARTOPEN", |
140 | [DCCP_LISTEN] = "LISTEN", | 139 | [DCCP_LISTEN] = "LISTEN", |
141 | [DCCP_RESPOND] = "RESPOND", | 140 | [DCCP_RESPOND] = "RESPOND", |
142 | [DCCP_CLOSING] = "CLOSING", | 141 | [DCCP_CLOSING] = "CLOSING", |
143 | [DCCP_TIME_WAIT] = "TIME_WAIT", | 142 | [DCCP_ACTIVE_CLOSEREQ] = "CLOSEREQ", |
144 | [DCCP_CLOSED] = "CLOSED", | 143 | [DCCP_PASSIVE_CLOSE] = "PASSIVE_CLOSE", |
144 | [DCCP_PASSIVE_CLOSEREQ] = "PASSIVE_CLOSEREQ", | ||
145 | [DCCP_TIME_WAIT] = "TIME_WAIT", | ||
146 | [DCCP_CLOSED] = "CLOSED", | ||
145 | }; | 147 | }; |
146 | 148 | ||
147 | if (state >= DCCP_MAX_STATES) | 149 | if (state >= DCCP_MAX_STATES) |