[PATCH 28/37] dccp: Integration of dynamic feature activation - part 3 (client side)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <dccp@...>
Cc: <netdev@...>, Gerrit Renker <gerrit@...>
Date: Thursday, August 28, 2008 - 1:45 pm

This integrates feature-activation in the client, with these details:

1. When dccp_parse_options() fails, the reset code is already set, request_sent
_state_process() currently overrides this with `Packet Error', which is not
intended - so changed to use the reset code set in dccp_parse_options();

2. There was a FIXME to change the error code when dccp_ackvec_add() fails.
I have looked this up and found that:
* the check whether ackno < ISN is already made earlier,
* this Response is likely the 1st packet with an Ackno that the client gets,
* so when dccp_ackvec_add() fails, the reason is likely not a packet error.

3. When feature negotiation fails, the socket should be marked as not usable,
so that the application is notified that an error occurs. This is achieved
by a new label, which uses an error code of `Aborted' and which sets the
socket state to CLOSED, as well as sk_err.

4. Avoids parsing the Ack twice in Respond state by not doing option processing
again in dccp_rcv_respond_partopen_state_process (as option processing has
already been done on the request_sock in dccp_check_req).

Since this addresses congestion-control initialisation, a corresponding
FIXME has been removed.

Signed-off-by: Gerrit Renker
Acked-by: Ian McDonald
---
net/dccp/input.c | 30 ++++++++++++++++++++++++++----
1 files changed, 26 insertions(+), 4 deletions(-)

--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -421,8 +421,13 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
goto out_invalid_packet;
}

+ /*
+ * If option processing (Step 8) failed, return 1 here so that
+ * dccp_v4_do_rcv() sends a Reset. The Reset code depends on
+ * the option type and is set in dccp_parse_options().
+ */
if (dccp_parse_options(sk, NULL, skb))
- goto out_invalid_packet;
+ return 1;

/* Obtain usec RTT sample from SYN exchange (used by CCID 3) */
if (likely(dp->dccps_options_received.dccpor_timestamp_echo))
@@ -475,6 +480,15 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
*/
dccp_set_state(sk, DCCP_PARTOPEN);

+ /*
+ * If feature negotiation was successful, activate features now;
+ * an activation failure means that this host could not activate
+ * one ore more features (e.g. insufficient memory), which would
+ * leave at least one feature in an undefined state.
+ */
+ if (dccp_feat_activate_values(sk, &dp->dccps_featneg))
+ goto unable_to_proceed;
+
/* Make sure socket is routed, for correct metrics. */
icsk->icsk_af_ops->rebuild_header(sk);

@@ -509,6 +523,16 @@ out_invalid_packet:
/* dccp_v4_do_rcv will send a reset */
DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_PACKET_ERROR;
return 1;
+
+unable_to_proceed:
+ DCCP_SKB_CB(skb)->dccpd_reset_code = DCCP_RESET_CODE_ABORTED;
+ /*
+ * We mark this socket as no longer usable, so that the loop in
+ * dccp_sendmsg() terminates and the application gets notified.
+ */
+ dccp_set_state(sk, DCCP_CLOSED);
+ sk->sk_err = ECOMM;
+ return 1;
}

static int dccp_rcv_respond_partopen_state_process(struct sock *sk,
@@ -600,7 +624,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
return 1;
}

- if (sk->sk_state != DCCP_REQUESTING) {
+ if (sk->sk_state != DCCP_REQUESTING && sk->sk_state != DCCP_RESPOND) {
if (dccp_check_seqno(sk, skb))
goto discard;

@@ -665,8 +689,6 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
return 1;

case DCCP_REQUESTING:
- /* FIXME: do congestion control initialization */
-
queued = dccp_rcv_request_sent_state_process(sk, skb, dh, len);
if (queued >= 0)
return queued;
--
1.6.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 03/37] dccp: List management for new feature nego..., Arnaldo Carvalho de Melo, (Thu Aug 28, 3:43 pm)
Re: [PATCH 0/37] --- Summary of revision changes so far, Gerrit Renker, (Sat Aug 30, 1:25 pm)
Re: net-next-2.6 [pull-request] [PATCH 0/37] dccp: Revised s..., Arnaldo Carvalho de Melo, (Tue Sep 2, 9:50 am)
Re: [PATCH 1/5] dccp: Basic data structure for feature negot..., Arnaldo Carvalho de Melo, (Mon Sep 22, 10:10 am)
Re: [PATCH 2/5] dccp: Implement lookup table for feature-neg..., Arnaldo Carvalho de Melo, (Mon Sep 22, 10:21 am)
Re: v2 [PATCH 2/5] dccp: Implement lookup table for feature-..., Arnaldo Carvalho de Melo, (Wed Sep 24, 10:01 am)
Re: v2 [PATCH 1/5] dccp: Basic data structure for feature ne..., Arnaldo Carvalho de Melo, (Wed Sep 24, 9:59 am)
Re: [PATCH 2/5] dccp: Auto-load (when supported) CCID plugin..., Arnaldo Carvalho de Melo, (Mon Dec 15, 9:48 am)
Re: [PATCH 2/5] dccp: Auto-load (when supported) CCID plugin..., Michał Mirosław, (Sat Dec 13, 9:55 am)
Re: [PATCH 2/5] dccp: Auto-load (when supported) CCID plugin..., Michał Mirosław, (Sun Dec 14, 10:50 am)
Re: [PATCH 2/5] dccp: Auto-load (when supported) CCID plugin..., Michał Mirosław, (Tue Dec 16, 7:31 am)
Re: [PATCH 2/5] dccp: Auto-load (when supported) CCID plugin..., Arnaldo Carvalho de Melo, (Tue Dec 16, 7:19 am)
Re: [PATCH 2/5] dccp: Auto-load (when supported) CCID plugin..., Arnaldo Carvalho de Melo, (Tue Dec 16, 6:25 pm)
Re: [PATCH 2/5] dccp: Auto-load (when supported) CCID plugin..., Arnaldo Carvalho de Melo, (Wed Dec 17, 9:13 am)
Re: [PATCH 2/5] dccp: Auto-load (when supported) CCID plugin..., Arnaldo Carvalho de Melo, (Thu Dec 18, 10:01 am)
Re: [PATCH 4/5] dccp: Initialisation and type-checking of fe..., Arnaldo Carvalho de Melo, (Mon Dec 15, 10:15 am)
[PATCH 3/6] dccp: Preference list reconciliation, Gerrit Renker, (Sun Nov 30, 9:22 am)
[PATCH 5/6] dccp: Processing Confirm options, Gerrit Renker, (Sun Nov 30, 9:22 am)
[PATCH 6/6] dccp: Feature activation handlers, Gerrit Renker, (Sun Nov 30, 9:22 am)
[PATCH 2/5] dccp: API to query the current TX/RX CCID, Gerrit Renker, (Sat Nov 22, 6:30 am)
[PATCH 4/5] dccp: Support for Mandatory options, Gerrit Renker, (Sat Nov 22, 6:30 am)
Re: [PATCH 4/5] dccp: Support for Mandatory options, David Miller, (Sun Nov 23, 8:09 pm)
[PATCH 1/5] dccp: Mechanism to resolve CCID dependencies, Gerrit Renker, (Sat Nov 15, 8:11 am)
[PATCH 2/5] dccp: Deprecate old setsockopt framework, Gerrit Renker, (Sat Nov 15, 8:11 am)
Re: [PATCH 2/5] dccp: Deprecate old setsockopt framework, Gerrit Renker, (Mon Nov 17, 11:31 am)
[PATCH 4/5] dccp: Deprecate Ack Ratio sysctl, Gerrit Renker, (Sat Nov 15, 8:11 am)
Re: [PATCH 4/5] dccp: Deprecate Ack Ratio sysctl, David Miller, (Mon Nov 17, 2:56 am)
[PATCH 5/5] dccp: Tidy up setsockopt calls, Gerrit Renker, (Sat Nov 15, 8:11 am)
Re: [PATCH 5/5] dccp: Tidy up setsockopt calls, David Miller, (Mon Nov 17, 2:57 am)
[PATCH 3/4] dccp: Query supported CCIDs, Gerrit Renker, (Thu Nov 6, 1:40 am)
v2 [PATCH 3/4] dccp: Query supported CCIDs, Gerrit Renker, (Wed Nov 12, 2:37 am)
Re: v2 [PATCH 3/4] dccp: Query supported CCIDs, David Miller, (Wed Nov 12, 4:49 am)
Re: [PATCH 3/4] dccp: Query supported CCIDs, David Miller, (Mon Nov 10, 5:16 pm)
Re: [PATCH 2/5] dccp: Implement lookup table for feature-neg..., Arnaldo Carvalho de Melo, (Mon Sep 22, 1:00 pm)
Re: [PATCH 2/5] dccp: Implement lookup table for feature-neg..., Arnaldo Carvalho de Melo, (Wed Sep 24, 9:58 am)
Re: [PATCH 2/5] dccp: Implement lookup table for feature-neg..., Arnaldo Carvalho de Melo, (Mon Sep 22, 12:49 pm)
Re: What to do with DCCP, David Miller, (Thu Sep 11, 1:53 am)
Re: What to do with DCCP, Gerrit Renker, (Fri Sep 12, 1:16 am)
Re: net-next-2.6 [pull-request] [PATCH 0/37] dccp: Revised s..., Arnaldo Carvalho de Melo, (Thu Sep 11, 10:02 am)
Re: [PATCH 04/37] dccp: Per-socket initialisation of feature..., Arnaldo Carvalho de Melo, (Thu Aug 28, 3:53 pm)
Re: [PATCH 06/37] dccp: Limit feature negotiation to connect..., Arnaldo Carvalho de Melo, (Thu Aug 28, 4:50 pm)
Re: [PATCH 07/37] dccp: Registration routines for changing f..., Arnaldo Carvalho de Melo, (Thu Aug 28, 4:54 pm)
[PATCH 08/37] dccp: Query supported CCIDs, Gerrit Renker, (Thu Aug 28, 1:44 pm)
Re: [PATCH 08/37] dccp: Query supported CCIDs, Arnaldo Carvalho de Melo, (Thu Aug 28, 5:00 pm)
Re: [PATCH 08/37] dccp: Query supported CCIDs, Gerrit Renker, (Sat Aug 30, 9:52 am)
Re: [PATCH 08/37] dccp: Query supported CCIDs, Gerrit Renker, (Fri Aug 29, 2:17 am)
Re: [PATCH 09/37] dccp: Resolve dependencies of features on ..., Arnaldo Carvalho de Melo, (Thu Aug 28, 5:07 pm)
Re: [PATCH 09/37] dccp: Resolve dependencies of features on ..., Arnaldo Carvalho de Melo, (Wed Sep 3, 8:59 pm)
[PATCH 11/37] dccp: Deprecate old setsockopt framework, Gerrit Renker, (Thu Aug 28, 1:44 pm)
Re: [PATCH 12/37] dccp: Feature negotiation for minimum-chec..., Arnaldo Carvalho de Melo, (Thu Aug 28, 5:25 pm)
[PATCH 13/37] dccp: Deprecate Ack Ratio sysctl, Gerrit Renker, (Thu Aug 28, 1:44 pm)
Re: [PATCH 13/37] dccp: Deprecate Ack Ratio sysctl, Arnaldo Carvalho de Melo, (Thu Aug 28, 5:26 pm)
[PATCH 14/37] dccp: Tidy up setsockopt calls, Gerrit Renker, (Thu Aug 28, 1:44 pm)
Re: [PATCH 14/37] dccp: Tidy up setsockopt calls, Eugene Teo, (Fri Aug 29, 5:25 am)
Re: [PATCH 14/37] dccp: Tidy up setsockopt calls, Gerrit Renker, (Sat Aug 30, 9:52 am)
Re: [PATCH 14/37] dccp: Tidy up setsockopt calls, Arnaldo Carvalho de Melo, (Thu Aug 28, 5:35 pm)
Re: [PATCH 14/37] dccp: Tidy up setsockopt calls, Gerrit Renker, (Fri Aug 29, 2:57 am)
Re: [PATCH 15/37] dccp: Set per-connection CCIDs via socket ..., Arnaldo Carvalho de Melo, (Thu Aug 28, 5:45 pm)
[PATCH 16/37] dccp: API to query the current TX/RX CCID, Gerrit Renker, (Thu Aug 28, 1:44 pm)
Re: [PATCH 16/37] dccp: API to query the current TX/RX CCID, Arnaldo Carvalho de Melo, (Thu Aug 28, 5:47 pm)
Re: [PATCH 17/37] dccp: Increase the scope of variable-lengt..., Arnaldo Carvalho de Melo, (Thu Aug 28, 5:48 pm)
[PATCH 18/37] dccp: Support for Mandatory options, Gerrit Renker, (Thu Aug 28, 1:44 pm)
Re: [PATCH 18/37] dccp: Support for Mandatory options, Arnaldo Carvalho de Melo, (Thu Aug 28, 5:50 pm)
[PATCH 22/37] dccp: Preference list reconciliation, Gerrit Renker, (Thu Aug 28, 1:44 pm)
[PATCH 24/37] dccp: Processing Confirm options, Gerrit Renker, (Thu Aug 28, 1:44 pm)
[PATCH 25/37] dccp: Feature activation handlers, Gerrit Renker, (Thu Aug 28, 1:45 pm)
Re: [PATCH 25/37] dccp: Feature activation handlers, Wei Yongjun, (Tue Sep 2, 2:34 am)
Re: [PATCH 25/37] dccp: Feature activation handlers, Gerrit Renker, (Wed Sep 3, 12:38 am)
Re: [PATCH 25/37] dccp: Feature activation handlers, Wei Yongjun, (Wed Sep 3, 1:42 am)
Re: [PATCH 25/37] dccp: Feature activation handlers, Gerrit Renker, (Thu Sep 4, 1:12 am)
[PATCH 28/37] dccp: Integration of dynamic feature activatio..., Gerrit Renker, (Thu Aug 28, 1:45 pm)