diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2006-11-10 13:29:14 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:22:04 -0500 |
commit | d83ca5accb256de1b44835cd222bfdc3207bd7dc (patch) | |
tree | c7be8b1f61d4403fe15bd279ecf9d52619134592 /net | |
parent | cf557926f6955b4c3fa55e81fdb3675e752e8eed (diff) |
[DCCP]: Update code comments for Step 2/3
Sorts out the comments for processing steps 2,3 in section 8.5 of RFC 4340.
All comments have been updated against this document, and the reference to step
2 has been made consistent throughout the files.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/dccp/input.c | 38 | ||||
-rw-r--r-- | net/dccp/ipv4.c | 38 | ||||
-rw-r--r-- | net/dccp/ipv6.c | 33 | ||||
-rw-r--r-- | net/dccp/minisocks.c | 10 |
4 files changed, 68 insertions, 51 deletions
diff --git a/net/dccp/input.c b/net/dccp/input.c index 1d24881ac0ab..97ccdc30fd89 100644 --- a/net/dccp/input.c +++ b/net/dccp/input.c | |||
@@ -431,29 +431,25 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
431 | 431 | ||
432 | /* | 432 | /* |
433 | * Step 3: Process LISTEN state | 433 | * Step 3: Process LISTEN state |
434 | * (Continuing from dccp_v4_do_rcv and dccp_v6_do_rcv) | ||
435 | * | 434 | * |
436 | * If S.state == LISTEN, | 435 | * If S.state == LISTEN, |
437 | * If P.type == Request or P contains a valid Init Cookie | 436 | * If P.type == Request or P contains a valid Init Cookie option, |
438 | * option, | 437 | * (* Must scan the packet's options to check for Init |
439 | * * Must scan the packet's options to check for an Init | 438 | * Cookies. Only Init Cookies are processed here, |
440 | * Cookie. Only the Init Cookie is processed here, | 439 | * however; other options are processed in Step 8. This |
441 | * however; other options are processed in Step 8. This | 440 | * scan need only be performed if the endpoint uses Init |
442 | * scan need only be performed if the endpoint uses Init | 441 | * Cookies *) |
443 | * Cookies * | 442 | * (* Generate a new socket and switch to that socket *) |
444 | * * Generate a new socket and switch to that socket * | 443 | * Set S := new socket for this port pair |
445 | * Set S := new socket for this port pair | 444 | * S.state = RESPOND |
446 | * S.state = RESPOND | 445 | * Choose S.ISS (initial seqno) or set from Init Cookies |
447 | * Choose S.ISS (initial seqno) or set from Init Cookie | 446 | * Initialize S.GAR := S.ISS |
448 | * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie | 447 | * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init |
449 | * Continue with S.state == RESPOND | 448 | * Cookies Continue with S.state == RESPOND |
450 | * * A Response packet will be generated in Step 11 * | 449 | * (* A Response packet will be generated in Step 11 *) |
451 | * Otherwise, | 450 | * Otherwise, |
452 | * Generate Reset(No Connection) unless P.type == Reset | 451 | * Generate Reset(No Connection) unless P.type == Reset |
453 | * Drop packet and return | 452 | * Drop packet and return |
454 | * | ||
455 | * NOTE: the check for the packet types is done in | ||
456 | * dccp_rcv_state_process | ||
457 | */ | 453 | */ |
458 | if (sk->sk_state == DCCP_LISTEN) { | 454 | if (sk->sk_state == DCCP_LISTEN) { |
459 | if (dh->dccph_type == DCCP_PKT_REQUEST) { | 455 | if (dh->dccph_type == DCCP_PKT_REQUEST) { |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index d75ce8c7e488..91bffaa761a6 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -729,24 +729,23 @@ int dccp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
729 | 729 | ||
730 | /* | 730 | /* |
731 | * Step 3: Process LISTEN state | 731 | * Step 3: Process LISTEN state |
732 | * If S.state == LISTEN, | 732 | * If P.type == Request or P contains a valid Init Cookie option, |
733 | * If P.type == Request or P contains a valid Init Cookie | 733 | * (* Must scan the packet's options to check for Init |
734 | * option, | 734 | * Cookies. Only Init Cookies are processed here, |
735 | * * Must scan the packet's options to check for an Init | 735 | * however; other options are processed in Step 8. This |
736 | * Cookie. Only the Init Cookie is processed here, | 736 | * scan need only be performed if the endpoint uses Init |
737 | * however; other options are processed in Step 8. This | 737 | * Cookies *) |
738 | * scan need only be performed if the endpoint uses Init | 738 | * (* Generate a new socket and switch to that socket *) |
739 | * Cookies * | 739 | * Set S := new socket for this port pair |
740 | * * Generate a new socket and switch to that socket * | 740 | * S.state = RESPOND |
741 | * Set S := new socket for this port pair | 741 | * Choose S.ISS (initial seqno) or set from Init Cookies |
742 | * S.state = RESPOND | 742 | * Initialize S.GAR := S.ISS |
743 | * Choose S.ISS (initial seqno) or set from Init Cookie | 743 | * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookies |
744 | * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie | 744 | * Continue with S.state == RESPOND |
745 | * Continue with S.state == RESPOND | 745 | * (* A Response packet will be generated in Step 11 *) |
746 | * * A Response packet will be generated in Step 11 * | 746 | * Otherwise, |
747 | * Otherwise, | 747 | * Generate Reset(No Connection) unless P.type == Reset |
748 | * Generate Reset(No Connection) unless P.type == Reset | 748 | * Drop packet and return |
749 | * Drop packet and return | ||
750 | * | 749 | * |
751 | * NOTE: the check for the packet types is done in | 750 | * NOTE: the check for the packet types is done in |
752 | * dccp_rcv_state_process | 751 | * dccp_rcv_state_process |
@@ -887,8 +886,6 @@ static int dccp_v4_rcv(struct sk_buff *skb) | |||
887 | /* | 886 | /* |
888 | * Step 2: | 887 | * Step 2: |
889 | * If no socket ... | 888 | * If no socket ... |
890 | * Generate Reset(No Connection) unless P.type == Reset | ||
891 | * Drop packet and return | ||
892 | */ | 889 | */ |
893 | if (sk == NULL) { | 890 | if (sk == NULL) { |
894 | dccp_pr_debug("failed to look up flow ID in table and " | 891 | dccp_pr_debug("failed to look up flow ID in table and " |
@@ -919,6 +916,7 @@ no_dccp_socket: | |||
919 | goto discard_it; | 916 | goto discard_it; |
920 | /* | 917 | /* |
921 | * Step 2: | 918 | * Step 2: |
919 | * If no socket ... | ||
922 | * Generate Reset(No Connection) unless P.type == Reset | 920 | * Generate Reset(No Connection) unless P.type == Reset |
923 | * Drop packet and return | 921 | * Drop packet and return |
924 | */ | 922 | */ |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 19a4f763099d..201801e1532d 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -487,10 +487,10 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
487 | /* | 487 | /* |
488 | * Step 3: Process LISTEN state | 488 | * Step 3: Process LISTEN state |
489 | * | 489 | * |
490 | * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie | 490 | * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie |
491 | * | 491 | * |
492 | * In fact we defer setting S.GSR, S.SWL, S.SWH to | 492 | * In fact we defer setting S.GSR, S.SWL, S.SWH to |
493 | * dccp_create_openreq_child. | 493 | * dccp_create_openreq_child. |
494 | */ | 494 | */ |
495 | dreq = dccp_rsk(req); | 495 | dreq = dccp_rsk(req); |
496 | dreq->dreq_isr = dcb->dccpd_seq; | 496 | dreq->dreq_isr = dcb->dccpd_seq; |
@@ -760,6 +760,30 @@ static int dccp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) | |||
760 | return 0; | 760 | return 0; |
761 | } | 761 | } |
762 | 762 | ||
763 | /* | ||
764 | * Step 3: Process LISTEN state | ||
765 | * If S.state == LISTEN, | ||
766 | * If P.type == Request or P contains a valid Init Cookie option, | ||
767 | * (* Must scan the packet's options to check for Init | ||
768 | * Cookies. Only Init Cookies are processed here, | ||
769 | * however; other options are processed in Step 8. This | ||
770 | * scan need only be performed if the endpoint uses Init | ||
771 | * Cookies *) | ||
772 | * (* Generate a new socket and switch to that socket *) | ||
773 | * Set S := new socket for this port pair | ||
774 | * S.state = RESPOND | ||
775 | * Choose S.ISS (initial seqno) or set from Init Cookies | ||
776 | * Initialize S.GAR := S.ISS | ||
777 | * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookies | ||
778 | * Continue with S.state == RESPOND | ||
779 | * (* A Response packet will be generated in Step 11 *) | ||
780 | * Otherwise, | ||
781 | * Generate Reset(No Connection) unless P.type == Reset | ||
782 | * Drop packet and return | ||
783 | * | ||
784 | * NOTE: the check for the packet types is done in | ||
785 | * dccp_rcv_state_process | ||
786 | */ | ||
763 | if (sk->sk_state == DCCP_LISTEN) { | 787 | if (sk->sk_state == DCCP_LISTEN) { |
764 | struct sock *nsk = dccp_v6_hnd_req(sk, skb); | 788 | struct sock *nsk = dccp_v6_hnd_req(sk, skb); |
765 | 789 | ||
@@ -826,8 +850,6 @@ static int dccp_v6_rcv(struct sk_buff **pskb) | |||
826 | /* | 850 | /* |
827 | * Step 2: | 851 | * Step 2: |
828 | * If no socket ... | 852 | * If no socket ... |
829 | * Generate Reset(No Connection) unless P.type == Reset | ||
830 | * Drop packet and return | ||
831 | */ | 853 | */ |
832 | if (sk == NULL) { | 854 | if (sk == NULL) { |
833 | dccp_pr_debug("failed to look up flow ID in table and " | 855 | dccp_pr_debug("failed to look up flow ID in table and " |
@@ -857,6 +879,7 @@ no_dccp_socket: | |||
857 | goto discard_it; | 879 | goto discard_it; |
858 | /* | 880 | /* |
859 | * Step 2: | 881 | * Step 2: |
882 | * If no socket ... | ||
860 | * Generate Reset(No Connection) unless P.type == Reset | 883 | * Generate Reset(No Connection) unless P.type == Reset |
861 | * Drop packet and return | 884 | * Drop packet and return |
862 | */ | 885 | */ |
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c index 0f228ab5169d..d3de696fe4bf 100644 --- a/net/dccp/minisocks.c +++ b/net/dccp/minisocks.c | |||
@@ -98,8 +98,8 @@ struct sock *dccp_create_openreq_child(struct sock *sk, | |||
98 | /* | 98 | /* |
99 | * Step 3: Process LISTEN state | 99 | * Step 3: Process LISTEN state |
100 | * | 100 | * |
101 | * // Generate a new socket and switch to that socket | 101 | * (* Generate a new socket and switch to that socket *) |
102 | * Set S := new socket for this port pair | 102 | * Set S := new socket for this port pair |
103 | */ | 103 | */ |
104 | struct sock *newsk = inet_csk_clone(sk, req, GFP_ATOMIC); | 104 | struct sock *newsk = inet_csk_clone(sk, req, GFP_ATOMIC); |
105 | 105 | ||
@@ -148,9 +148,9 @@ out_free: | |||
148 | /* | 148 | /* |
149 | * Step 3: Process LISTEN state | 149 | * Step 3: Process LISTEN state |
150 | * | 150 | * |
151 | * Choose S.ISS (initial seqno) or set from Init Cookie | 151 | * Choose S.ISS (initial seqno) or set from Init Cookies |
152 | * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init | 152 | * Initialize S.GAR := S.ISS |
153 | * Cookie | 153 | * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookies |
154 | */ | 154 | */ |
155 | 155 | ||
156 | /* See dccp_v4_conn_request */ | 156 | /* See dccp_v4_conn_request */ |