aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/dccp/proto.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 5f47b458ed8f..73006b747678 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -276,6 +276,12 @@ static inline int dccp_listen_start(struct sock *sk, int backlog)
276 return inet_csk_listen_start(sk, backlog); 276 return inet_csk_listen_start(sk, backlog);
277} 277}
278 278
279static inline int dccp_need_reset(int state)
280{
281 return state != DCCP_CLOSED && state != DCCP_LISTEN &&
282 state != DCCP_REQUESTING;
283}
284
279int dccp_disconnect(struct sock *sk, int flags) 285int dccp_disconnect(struct sock *sk, int flags)
280{ 286{
281 struct inet_connection_sock *icsk = inet_csk(sk); 287 struct inet_connection_sock *icsk = inet_csk(sk);
@@ -286,10 +292,15 @@ int dccp_disconnect(struct sock *sk, int flags)
286 if (old_state != DCCP_CLOSED) 292 if (old_state != DCCP_CLOSED)
287 dccp_set_state(sk, DCCP_CLOSED); 293 dccp_set_state(sk, DCCP_CLOSED);
288 294
289 /* ABORT function of RFC793 */ 295 /*
296 * This corresponds to the ABORT function of RFC793, sec. 3.8
297 * TCP uses a RST segment, DCCP a Reset packet with Code 2, "Aborted".
298 */
290 if (old_state == DCCP_LISTEN) { 299 if (old_state == DCCP_LISTEN) {
291 inet_csk_listen_stop(sk); 300 inet_csk_listen_stop(sk);
292 /* FIXME: do the active reset thing */ 301 } else if (dccp_need_reset(old_state)) {
302 dccp_send_reset(sk, DCCP_RESET_CODE_ABORTED);
303 sk->sk_err = ECONNRESET;
293 } else if (old_state == DCCP_REQUESTING) 304 } else if (old_state == DCCP_REQUESTING)
294 sk->sk_err = ECONNRESET; 305 sk->sk_err = ECONNRESET;
295 306