Skip to contentSkip to conversation

: Initialize dccp_sock before calling the ccid constructors

PATCH In review Arnaldo Carvalho de Melo 2 participants 2 messages Nov 25, 2007 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 6/18 : Initialize dccp_sock before calling the ccid constructors

This is because in the next patch CCID2 will assume that dccps_mss_cache is non-zero.

---
 net/dccp/proto.c |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)
net/dccp/proto.c +13 -12
index 0aec735..d48005f 100644
@@ -174,6 +174,19 @@ int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized)
 
 	dccp_minisock_init(&dp->dccps_minisock);
 
+	icsk->icsk_rto		= DCCP_TIMEOUT_INIT;
+	icsk->icsk_syn_retries	= sysctl_dccp_request_retries;
+	sk->sk_state		= DCCP_CLOSED;
+	sk->sk_write_space	= dccp_write_space;
+	icsk->icsk_sync_mss	= dccp_sync_mss;
+	dp->dccps_mss_cache	= 536;
+	dp->dccps_rate_last	= jiffies;
+	dp->dccps_role		= DCCP_ROLE_UNDEFINED;
+	dp->dccps_service	= DCCP_SERVICE_CODE_IS_ABSENT;
+	dp->dccps_l_ack_ratio	= dp->dccps_r_ack_ratio = 1;
+
+	dccp_init_xmit_timers(sk);
+
 	/*
 	 * FIXME: We're hardcoding the CCID, and doing this at this point makes
 	 * the listening (master) sock get CCID control blocks, which is not
@@ -213,18 +226,6 @@ int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized)
 		INIT_LIST_HEAD(&dmsk->dccpms_conf);
 	}
 
-	dccp_init_xmit_timers(sk);
-	icsk->icsk_rto		= DCCP_TIMEOUT_INIT;
-	icsk->icsk_syn_retries	= sysctl_dccp_request_retries;
-	sk->sk_state		= DCCP_CLOSED;
-	sk->sk_write_space	= dccp_write_space;
-	icsk->icsk_sync_mss	= dccp_sync_mss;
-	dp->dccps_mss_cache	= 536;
-	dp->dccps_rate_last	= jiffies;
-	dp->dccps_role		= DCCP_ROLE_UNDEFINED;
-	dp->dccps_service	= DCCP_SERVICE_CODE_IS_ABSENT;
-	dp->dccps_l_ack_ratio	= dp->dccps_r_ack_ratio = 1;
-
 	return 0;
 }
 
Signature · 1 line
1.5.3.4
#1 lore raw
| This is because in the next patch CCID2 will assume that dccps_mss_cache is
| non-zero.
| 

Good catch - in the test tree this problem didn't occur since the CCIDs are initialised after everything else has been done (i.e. only after the handshake has completed, which is much later than init_sock()).