diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-08-13 19:36:01 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-08-29 18:59:50 -0400 |
commit | 8649b0d4166e6e80ffa298e75abd8f2afdd491a6 (patch) | |
tree | e6024532d165f5dc9987fe38fb84cb2076c86100 /net/dccp/input.c | |
parent | 725ba8eee3881e619c8e5a0116f1bdb6480ac2d9 (diff) |
[DCCP]: Fix RESET handling in dccp_rcv_state_process
To avoid holding TIMEWAIT state for sockets in the LISTEN state.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/input.c')
-rw-r--r-- | net/dccp/input.c | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/net/dccp/input.c b/net/dccp/input.c index 4b8638f153a5..9dadfc362511 100644 --- a/net/dccp/input.c +++ b/net/dccp/input.c | |||
@@ -402,7 +402,48 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
402 | const int old_state = sk->sk_state; | 402 | const int old_state = sk->sk_state; |
403 | int queued = 0; | 403 | int queued = 0; |
404 | 404 | ||
405 | if (sk->sk_state != DCCP_LISTEN && sk->sk_state != DCCP_REQUESTING) { | 405 | /* |
406 | * Step 3: Process LISTEN state | ||
407 | * (Continuing from dccp_v4_do_rcv and dccp_v6_do_rcv) | ||
408 | * | ||
409 | * If S.state == LISTEN, | ||
410 | * If P.type == Request or P contains a valid Init Cookie | ||
411 | * option, | ||
412 | * * Must scan the packet's options to check for an Init | ||
413 | * Cookie. Only the Init Cookie is processed here, | ||
414 | * however; other options are processed in Step 8. This | ||
415 | * scan need only be performed if the endpoint uses Init | ||
416 | * Cookies * | ||
417 | * * Generate a new socket and switch to that socket * | ||
418 | * Set S := new socket for this port pair | ||
419 | * S.state = RESPOND | ||
420 | * Choose S.ISS (initial seqno) or set from Init Cookie | ||
421 | * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie | ||
422 | * Continue with S.state == RESPOND | ||
423 | * * A Response packet will be generated in Step 11 * | ||
424 | * Otherwise, | ||
425 | * Generate Reset(No Connection) unless P.type == Reset | ||
426 | * Drop packet and return | ||
427 | * | ||
428 | * NOTE: the check for the packet types is done in | ||
429 | * dccp_rcv_state_process | ||
430 | */ | ||
431 | if (sk->sk_state == DCCP_LISTEN) { | ||
432 | if (dh->dccph_type == DCCP_PKT_REQUEST) { | ||
433 | if (dccp_v4_conn_request(sk, skb) < 0) | ||
434 | return 1; | ||
435 | |||
436 | /* FIXME: do congestion control initialization */ | ||
437 | goto discard; | ||
438 | } | ||
439 | if (dh->dccph_type == DCCP_PKT_RESET) | ||
440 | goto discard; | ||
441 | |||
442 | /* Caller (dccp_v4_do_rcv) will send Reset(No Connection)*/ | ||
443 | return 1; | ||
444 | } | ||
445 | |||
446 | if (sk->sk_state != DCCP_REQUESTING) { | ||
406 | if (dccp_check_seqno(sk, skb)) | 447 | if (dccp_check_seqno(sk, skb)) |
407 | goto discard; | 448 | goto discard; |
408 | 449 | ||
@@ -484,23 +525,6 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
484 | case DCCP_CLOSED: | 525 | case DCCP_CLOSED: |
485 | return 1; | 526 | return 1; |
486 | 527 | ||
487 | case DCCP_LISTEN: | ||
488 | if (dh->dccph_type == DCCP_PKT_ACK || | ||
489 | dh->dccph_type == DCCP_PKT_DATAACK) | ||
490 | return 1; | ||
491 | |||
492 | if (dh->dccph_type == DCCP_PKT_RESET) | ||
493 | goto discard; | ||
494 | |||
495 | if (dh->dccph_type == DCCP_PKT_REQUEST) { | ||
496 | if (dccp_v4_conn_request(sk, skb) < 0) | ||
497 | return 1; | ||
498 | |||
499 | /* FIXME: do congestion control initialization */ | ||
500 | goto discard; | ||
501 | } | ||
502 | goto discard; | ||
503 | |||
504 | case DCCP_REQUESTING: | 528 | case DCCP_REQUESTING: |
505 | /* FIXME: do congestion control initialization */ | 529 | /* FIXME: do congestion control initialization */ |
506 | 530 | ||