Commit 6eb55d17 authored by Gerrit Renker's avatar Gerrit Renker Committed by David S. Miller
Browse files

dccp: Integration of dynamic feature activation - part 1 (socket setup)

This first patch out of three replaces the hardcoded default settings with
initialisation code for the dynamic feature negotiation.

The patch also ensures that the client feature-negotiation queue is flushed
only when entering the OPEN state.

Since confirmed Change options are removed as soon as they are confirmed
(in the DCCP-Response), this ensures that Confirm options are retransmitted.

Note on retransmitting Confirm options:
Implementation experience showed that it is necessary to retransmit Confirm
options. Thanks to Leandro Melo de Sales who reported a bug in an earlier
revision of the patch set, resulting from not retransmitting these options.

As long as the client is in PARTOPEN, it needs to retransmit the Confirm
options for the Change options received on the DCCP-Response from the server.

Otherwise, if the packet containing the Confirm options gets dropped in the
network, the connection aborts due to undefined feature negotiation state.

Signed-off-by: default avatarGerrit Renker <>
Acked-by: default avatarIan McDonald <>
Signed-off-by: default avatarDavid S. Miller <>
parent b74ca3a8
......@@ -61,6 +61,9 @@ void dccp_set_state(struct sock *sk, const int state)
if (oldstate != DCCP_OPEN)
/* Client retransmits all Confirm options until entering OPEN */
if (oldstate == DCCP_PARTOPEN)
......@@ -169,7 +172,6 @@ EXPORT_SYMBOL_GPL(dccp_state_name);
int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized)
struct dccp_sock *dp = dccp_sk(sk);
struct dccp_minisock *dmsk = dccp_msk(sk);
struct inet_connection_sock *icsk = inet_csk(sk);
......@@ -188,45 +190,9 @@ int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized)
* FIXME: We're hardcoding the CCID, and doing this at this point makes
* the listening (master) sock get CCID control blocks, which is not
* necessary, but for now, to not mess with the test userspace apps,
* lets leave it here, later the real solution is to do this in a
* setsockopt(CCIDs-I-want/accept). -acme
if (likely(ctl_sock_initialized)) {
int rc = dccp_feat_init(sk);
if (rc)
return rc;
if (dmsk->dccpms_send_ack_vector) {
dp->dccps_hc_rx_ackvec = dccp_ackvec_alloc(GFP_KERNEL);
if (dp->dccps_hc_rx_ackvec == NULL)
return -ENOMEM;
dp->dccps_hc_rx_ccid = ccid_hc_rx_new(dmsk->dccpms_rx_ccid,
dp->dccps_hc_tx_ccid = ccid_hc_tx_new(dmsk->dccpms_tx_ccid,
if (unlikely(dp->dccps_hc_rx_ccid == NULL ||
dp->dccps_hc_tx_ccid == NULL)) {
ccid_hc_rx_delete(dp->dccps_hc_rx_ccid, sk);
ccid_hc_tx_delete(dp->dccps_hc_tx_ccid, sk);
if (dmsk->dccpms_send_ack_vector) {
dp->dccps_hc_rx_ackvec = NULL;
dp->dccps_hc_rx_ccid = dp->dccps_hc_tx_ccid = NULL;
return -ENOMEM;
} else {
/* control socket doesn't need feat nego */
/* control socket doesn't need feat nego */
if (likely(ctl_sock_initialized))
return dccp_feat_init(sk);
return 0;
Supports Markdown
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