Commit d83ca5ac authored by Gerrit Renker's avatar Gerrit Renker Committed by David S. Miller

[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: default avatarGerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@mandriva.com>
parent cf557926
...@@ -431,29 +431,25 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, ...@@ -431,29 +431,25 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
/* /*
* Step 3: Process LISTEN state * Step 3: Process LISTEN state
* (Continuing from dccp_v4_do_rcv and dccp_v6_do_rcv)
* *
* If S.state == LISTEN, * If S.state == LISTEN,
* If P.type == Request or P contains a valid Init Cookie * If P.type == Request or P contains a valid Init Cookie option,
* option, * (* Must scan the packet's options to check for Init
* * Must scan the packet's options to check for an Init * Cookies. Only Init Cookies are processed here,
* Cookie. Only the Init Cookie is processed here,
* however; other options are processed in Step 8. This * however; other options are processed in Step 8. This
* scan need only be performed if the endpoint uses Init * scan need only be performed if the endpoint uses Init
* Cookies * * Cookies *)
* * Generate a new socket and switch to that socket * * (* Generate a new socket and switch to that socket *)
* Set S := new socket for this port pair * Set S := new socket for this port pair
* S.state = RESPOND * S.state = RESPOND
* Choose S.ISS (initial seqno) or set from Init Cookie * Choose S.ISS (initial seqno) or set from Init Cookies
* Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie * Initialize S.GAR := S.ISS
* Continue with S.state == RESPOND * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init
* * A Response packet will be generated in Step 11 * * Cookies Continue with S.state == RESPOND
* (* A Response packet will be generated in Step 11 *)
* Otherwise, * Otherwise,
* Generate Reset(No Connection) unless P.type == Reset * Generate Reset(No Connection) unless P.type == Reset
* Drop packet and return * Drop packet and return
*
* NOTE: the check for the packet types is done in
* dccp_rcv_state_process
*/ */
if (sk->sk_state == DCCP_LISTEN) { if (sk->sk_state == DCCP_LISTEN) {
if (dh->dccph_type == DCCP_PKT_REQUEST) { if (dh->dccph_type == DCCP_PKT_REQUEST) {
......
...@@ -729,21 +729,20 @@ int dccp_v4_do_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -729,21 +729,20 @@ int dccp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
/* /*
* Step 3: Process LISTEN state * Step 3: Process LISTEN state
* If S.state == LISTEN, * If P.type == Request or P contains a valid Init Cookie option,
* If P.type == Request or P contains a valid Init Cookie * (* Must scan the packet's options to check for Init
* option, * Cookies. Only Init Cookies are processed here,
* * Must scan the packet's options to check for an Init
* Cookie. Only the Init Cookie is processed here,
* however; other options are processed in Step 8. This * however; other options are processed in Step 8. This
* scan need only be performed if the endpoint uses Init * scan need only be performed if the endpoint uses Init
* Cookies * * Cookies *)
* * Generate a new socket and switch to that socket * * (* Generate a new socket and switch to that socket *)
* Set S := new socket for this port pair * Set S := new socket for this port pair
* S.state = RESPOND * S.state = RESPOND
* Choose S.ISS (initial seqno) or set from Init Cookie * Choose S.ISS (initial seqno) or set from Init Cookies
* Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie * Initialize S.GAR := S.ISS
* Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookies
* Continue with S.state == RESPOND * Continue with S.state == RESPOND
* * A Response packet will be generated in Step 11 * * (* A Response packet will be generated in Step 11 *)
* Otherwise, * Otherwise,
* Generate Reset(No Connection) unless P.type == Reset * Generate Reset(No Connection) unless P.type == Reset
* Drop packet and return * Drop packet and return
...@@ -887,8 +886,6 @@ static int dccp_v4_rcv(struct sk_buff *skb) ...@@ -887,8 +886,6 @@ static int dccp_v4_rcv(struct sk_buff *skb)
/* /*
* Step 2: * Step 2:
* If no socket ... * If no socket ...
* Generate Reset(No Connection) unless P.type == Reset
* Drop packet and return
*/ */
if (sk == NULL) { if (sk == NULL) {
dccp_pr_debug("failed to look up flow ID in table and " dccp_pr_debug("failed to look up flow ID in table and "
...@@ -919,6 +916,7 @@ static int dccp_v4_rcv(struct sk_buff *skb) ...@@ -919,6 +916,7 @@ static int dccp_v4_rcv(struct sk_buff *skb)
goto discard_it; goto discard_it;
/* /*
* Step 2: * Step 2:
* If no socket ...
* Generate Reset(No Connection) unless P.type == Reset * Generate Reset(No Connection) unless P.type == Reset
* Drop packet and return * Drop packet and return
*/ */
......
...@@ -760,6 +760,30 @@ static int dccp_v6_do_rcv(struct sock *sk, struct sk_buff *skb) ...@@ -760,6 +760,30 @@ static int dccp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
return 0; return 0;
} }
/*
* Step 3: Process LISTEN state
* If S.state == LISTEN,
* If P.type == Request or P contains a valid Init Cookie option,
* (* Must scan the packet's options to check for Init
* Cookies. Only Init Cookies are processed here,
* however; other options are processed in Step 8. This
* scan need only be performed if the endpoint uses Init
* Cookies *)
* (* Generate a new socket and switch to that socket *)
* Set S := new socket for this port pair
* S.state = RESPOND
* Choose S.ISS (initial seqno) or set from Init Cookies
* Initialize S.GAR := S.ISS
* Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookies
* Continue with S.state == RESPOND
* (* A Response packet will be generated in Step 11 *)
* Otherwise,
* Generate Reset(No Connection) unless P.type == Reset
* Drop packet and return
*
* NOTE: the check for the packet types is done in
* dccp_rcv_state_process
*/
if (sk->sk_state == DCCP_LISTEN) { if (sk->sk_state == DCCP_LISTEN) {
struct sock *nsk = dccp_v6_hnd_req(sk, skb); struct sock *nsk = dccp_v6_hnd_req(sk, skb);
...@@ -826,8 +850,6 @@ static int dccp_v6_rcv(struct sk_buff **pskb) ...@@ -826,8 +850,6 @@ static int dccp_v6_rcv(struct sk_buff **pskb)
/* /*
* Step 2: * Step 2:
* If no socket ... * If no socket ...
* Generate Reset(No Connection) unless P.type == Reset
* Drop packet and return
*/ */
if (sk == NULL) { if (sk == NULL) {
dccp_pr_debug("failed to look up flow ID in table and " dccp_pr_debug("failed to look up flow ID in table and "
...@@ -857,6 +879,7 @@ static int dccp_v6_rcv(struct sk_buff **pskb) ...@@ -857,6 +879,7 @@ static int dccp_v6_rcv(struct sk_buff **pskb)
goto discard_it; goto discard_it;
/* /*
* Step 2: * Step 2:
* If no socket ...
* Generate Reset(No Connection) unless P.type == Reset * Generate Reset(No Connection) unless P.type == Reset
* Drop packet and return * Drop packet and return
*/ */
......
...@@ -98,7 +98,7 @@ struct sock *dccp_create_openreq_child(struct sock *sk, ...@@ -98,7 +98,7 @@ struct sock *dccp_create_openreq_child(struct sock *sk,
/* /*
* Step 3: Process LISTEN state * Step 3: Process LISTEN state
* *
* // Generate a new socket and switch to that socket * (* Generate a new socket and switch to that socket *)
* Set S := new socket for this port pair * Set S := new socket for this port pair
*/ */
struct sock *newsk = inet_csk_clone(sk, req, GFP_ATOMIC); struct sock *newsk = inet_csk_clone(sk, req, GFP_ATOMIC);
...@@ -148,9 +148,9 @@ struct sock *dccp_create_openreq_child(struct sock *sk, ...@@ -148,9 +148,9 @@ struct sock *dccp_create_openreq_child(struct sock *sk,
/* /*
* Step 3: Process LISTEN state * Step 3: Process LISTEN state
* *
* Choose S.ISS (initial seqno) or set from Init Cookie * Choose S.ISS (initial seqno) or set from Init Cookies
* Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init * Initialize S.GAR := S.ISS
* Cookie * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookies
*/ */
/* See dccp_v4_conn_request */ /* See dccp_v4_conn_request */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment