Skip to content

Commit 192b27f

Browse files
Gerrit Renkerdavem330
authored andcommitted
dccp: Integration of dynamic feature activation - part 2 (server side)
This patch integrates the activation of features at the end of negotiation into the server-side code. Note regarding the removal of 'const': -------------------------------------- The 'const' attribute has been removed from 'dreq' since dccp_activate_values() needs to operate on dreq's feature list. Part of the activation is to remove those options from the list that have already been confirmed, hence it is not purely read-only. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6eb55d1 commit 192b27f

1 file changed

Lines changed: 12 additions & 30 deletions

File tree

‎net/dccp/minisocks.c‎

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ struct sock *dccp_create_openreq_child(struct sock *sk,
111111
struct sock *newsk = inet_csk_clone(sk, req, GFP_ATOMIC);
112112

113113
if (newsk != NULL) {
114-
const struct dccp_request_sock *dreq = dccp_rsk(req);
114+
struct dccp_request_sock *dreq = dccp_rsk(req);
115115
struct inet_connection_sock *newicsk = inet_csk(newsk);
116116
struct dccp_sock *newdp = dccp_sk(newsk);
117117
struct dccp_minisock *newdmsk = dccp_msk(newsk);
@@ -125,35 +125,6 @@ struct sock *dccp_create_openreq_child(struct sock *sk,
125125
newicsk->icsk_rto = DCCP_TIMEOUT_INIT;
126126

127127
INIT_LIST_HEAD(&newdp->dccps_featneg);
128-
if (dccp_feat_clone(sk, newsk))
129-
goto out_free;
130-
131-
if (newdmsk->dccpms_send_ack_vector) {
132-
newdp->dccps_hc_rx_ackvec =
133-
dccp_ackvec_alloc(GFP_ATOMIC);
134-
if (unlikely(newdp->dccps_hc_rx_ackvec == NULL))
135-
goto out_free;
136-
}
137-
138-
newdp->dccps_hc_rx_ccid =
139-
ccid_hc_rx_new(newdmsk->dccpms_rx_ccid,
140-
newsk, GFP_ATOMIC);
141-
newdp->dccps_hc_tx_ccid =
142-
ccid_hc_tx_new(newdmsk->dccpms_tx_ccid,
143-
newsk, GFP_ATOMIC);
144-
if (unlikely(newdp->dccps_hc_rx_ccid == NULL ||
145-
newdp->dccps_hc_tx_ccid == NULL)) {
146-
dccp_ackvec_free(newdp->dccps_hc_rx_ackvec);
147-
ccid_hc_rx_delete(newdp->dccps_hc_rx_ccid, newsk);
148-
ccid_hc_tx_delete(newdp->dccps_hc_tx_ccid, newsk);
149-
out_free:
150-
/* It is still raw copy of parent, so invalidate
151-
* destructor and make plain sk_free() */
152-
newsk->sk_destruct = NULL;
153-
sk_free(newsk);
154-
return NULL;
155-
}
156-
157128
/*
158129
* Step 3: Process LISTEN state
159130
*
@@ -184,6 +155,17 @@ struct sock *dccp_create_openreq_child(struct sock *sk,
184155
dccp_set_seqno(&newdp->dccps_awl,
185156
max48(newdp->dccps_awl, newdp->dccps_iss));
186157

158+
/*
159+
* Activate features after initialising the sequence numbers,
160+
* since CCID initialisation may depend on GSS, ISR, ISS etc.
161+
*/
162+
if (dccp_feat_activate_values(newsk, &dreq->dreq_featneg)) {
163+
/* It is still raw copy of parent, so invalidate
164+
* destructor and make plain sk_free() */
165+
newsk->sk_destruct = NULL;
166+
sk_free(newsk);
167+
return NULL;
168+
}
187169
dccp_init_xmit_timers(newsk);
188170

189171
DCCP_INC_STATS_BH(DCCP_MIB_PASSIVEOPENS);

0 commit comments

Comments
 (0)