diff options
-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 | ||