diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-08-21 04:36:45 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-08-29 19:03:42 -0400 |
commit | 03ace394ac9bcad38043a381ae5f4860b9c9fa1c (patch) | |
tree | bbe5f7fc56074224ded47113974dbc3db550b303 | |
parent | a3054d48b9b9d6290eccc9fc09c286ef450d9b1d (diff) |
[DCCP]: Fix the ACK and SEQ window variables settings
This is from a first audit, more eyeballs are more than welcome.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/dccp/dccp.h | 12 | ||||
-rw-r--r-- | net/dccp/input.c | 14 | ||||
-rw-r--r-- | net/dccp/ipv4.c | 10 | ||||
-rw-r--r-- | net/dccp/minisocks.c | 13 | ||||
-rw-r--r-- | net/dccp/timer.c | 2 |
5 files changed, 41 insertions, 10 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index aab72b8d0703..33968a9422f2 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -340,13 +340,11 @@ static inline void dccp_hdr_set_ack(struct dccp_hdr_ack_bits *dhack, | |||
340 | static inline void dccp_update_gsr(struct sock *sk, u64 seq) | 340 | static inline void dccp_update_gsr(struct sock *sk, u64 seq) |
341 | { | 341 | { |
342 | struct dccp_sock *dp = dccp_sk(sk); | 342 | struct dccp_sock *dp = dccp_sk(sk); |
343 | u64 tmp_gsr; | ||
344 | 343 | ||
345 | dccp_set_seqno(&tmp_gsr, | 344 | dp->dccps_gsr = seq; |
345 | dccp_set_seqno(&dp->dccps_swl, | ||
346 | (dp->dccps_gsr + 1 - | 346 | (dp->dccps_gsr + 1 - |
347 | (dp->dccps_options.dccpo_sequence_window / 4))); | 347 | (dp->dccps_options.dccpo_sequence_window / 4))); |
348 | dp->dccps_gsr = seq; | ||
349 | dccp_set_seqno(&dp->dccps_swl, max48(tmp_gsr, dp->dccps_isr)); | ||
350 | dccp_set_seqno(&dp->dccps_swh, | 348 | dccp_set_seqno(&dp->dccps_swh, |
351 | (dp->dccps_gsr + | 349 | (dp->dccps_gsr + |
352 | (3 * dp->dccps_options.dccpo_sequence_window) / 4)); | 350 | (3 * dp->dccps_options.dccpo_sequence_window) / 4)); |
@@ -355,13 +353,11 @@ static inline void dccp_update_gsr(struct sock *sk, u64 seq) | |||
355 | static inline void dccp_update_gss(struct sock *sk, u64 seq) | 353 | static inline void dccp_update_gss(struct sock *sk, u64 seq) |
356 | { | 354 | { |
357 | struct dccp_sock *dp = dccp_sk(sk); | 355 | struct dccp_sock *dp = dccp_sk(sk); |
358 | u64 tmp_gss; | ||
359 | 356 | ||
360 | dccp_set_seqno(&tmp_gss, | 357 | dp->dccps_awh = dp->dccps_gss = seq; |
358 | dccp_set_seqno(&dp->dccps_awl, | ||
361 | (dp->dccps_gss - | 359 | (dp->dccps_gss - |
362 | dp->dccps_options.dccpo_sequence_window + 1)); | 360 | dp->dccps_options.dccpo_sequence_window + 1)); |
363 | dp->dccps_awl = max48(tmp_gss, dp->dccps_iss); | ||
364 | dp->dccps_awh = dp->dccps_gss = seq; | ||
365 | } | 361 | } |
366 | 362 | ||
367 | extern void dccp_insert_options(struct sock *sk, struct sk_buff *skb); | 363 | extern void dccp_insert_options(struct sock *sk, struct sk_buff *skb); |
diff --git a/net/dccp/input.c b/net/dccp/input.c index ce8396b126d2..5847cf454e26 100644 --- a/net/dccp/input.c +++ b/net/dccp/input.c | |||
@@ -314,7 +314,19 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk, | |||
314 | } | 314 | } |
315 | 315 | ||
316 | dp->dccps_isr = DCCP_SKB_CB(skb)->dccpd_seq; | 316 | dp->dccps_isr = DCCP_SKB_CB(skb)->dccpd_seq; |
317 | dccp_update_gsr(sk, DCCP_SKB_CB(skb)->dccpd_seq); | 317 | dccp_update_gsr(sk, dp->dccps_isr); |
318 | /* | ||
319 | * SWL and AWL are initially adjusted so that they are not less than | ||
320 | * the initial Sequence Numbers received and sent, respectively: | ||
321 | * SWL := max(GSR + 1 - floor(W/4), ISR), | ||
322 | * AWL := max(GSS - W' + 1, ISS). | ||
323 | * These adjustments MUST be applied only at the beginning of the | ||
324 | * connection. | ||
325 | * | ||
326 | * AWL was adjusted in dccp_v4_connect -acme | ||
327 | */ | ||
328 | dccp_set_seqno(&dp->dccps_swl, | ||
329 | max48(dp->dccps_swl, dp->dccps_isr)); | ||
318 | 330 | ||
319 | if (ccid_hc_rx_init(dp->dccps_hc_rx_ccid, sk) != 0 || | 331 | if (ccid_hc_rx_init(dp->dccps_hc_rx_ccid, sk) != 0 || |
320 | ccid_hc_tx_init(dp->dccps_hc_tx_ccid, sk) != 0) { | 332 | ccid_hc_tx_init(dp->dccps_hc_tx_ccid, sk) != 0) { |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 02ebf1f39f38..647e669a1266 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -309,6 +309,16 @@ static int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, | |||
309 | usin->sin_port); | 309 | usin->sin_port); |
310 | dccp_update_gss(sk, dp->dccps_iss); | 310 | dccp_update_gss(sk, dp->dccps_iss); |
311 | 311 | ||
312 | /* | ||
313 | * SWL and AWL are initially adjusted so that they are not less than | ||
314 | * the initial Sequence Numbers received and sent, respectively: | ||
315 | * SWL := max(GSR + 1 - floor(W/4), ISR), | ||
316 | * AWL := max(GSS - W' + 1, ISS). | ||
317 | * These adjustments MUST be applied only at the beginning of the | ||
318 | * connection. | ||
319 | */ | ||
320 | dccp_set_seqno(&dp->dccps_awl, max48(dp->dccps_awl, dp->dccps_iss)); | ||
321 | |||
312 | inet->id = dp->dccps_iss ^ jiffies; | 322 | inet->id = dp->dccps_iss ^ jiffies; |
313 | 323 | ||
314 | err = dccp_connect(sk); | 324 | err = dccp_connect(sk); |
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c index b8e67207e97e..ce5dff4ac22e 100644 --- a/net/dccp/minisocks.c +++ b/net/dccp/minisocks.c | |||
@@ -146,6 +146,19 @@ out_free: | |||
146 | newdp->dccps_iss = dreq->dreq_iss; | 146 | newdp->dccps_iss = dreq->dreq_iss; |
147 | dccp_update_gss(newsk, dreq->dreq_iss); | 147 | dccp_update_gss(newsk, dreq->dreq_iss); |
148 | 148 | ||
149 | /* | ||
150 | * SWL and AWL are initially adjusted so that they are not less than | ||
151 | * the initial Sequence Numbers received and sent, respectively: | ||
152 | * SWL := max(GSR + 1 - floor(W/4), ISR), | ||
153 | * AWL := max(GSS - W' + 1, ISS). | ||
154 | * These adjustments MUST be applied only at the beginning of the | ||
155 | * connection. | ||
156 | */ | ||
157 | dccp_set_seqno(&newdp->dccps_swl, | ||
158 | max48(newdp->dccps_swl, newdp->dccps_isr)); | ||
159 | dccp_set_seqno(&newdp->dccps_awl, | ||
160 | max48(newdp->dccps_awl, newdp->dccps_iss)); | ||
161 | |||
149 | dccp_init_xmit_timers(newsk); | 162 | dccp_init_xmit_timers(newsk); |
150 | 163 | ||
151 | DCCP_INC_STATS_BH(DCCP_MIB_PASSIVEOPENS); | 164 | DCCP_INC_STATS_BH(DCCP_MIB_PASSIVEOPENS); |
diff --git a/net/dccp/timer.c b/net/dccp/timer.c index 47b1616e6189..aa34b576e228 100644 --- a/net/dccp/timer.c +++ b/net/dccp/timer.c | |||
@@ -144,7 +144,7 @@ static void dccp_retransmit_timer(struct sock *sk) | |||
144 | /* | 144 | /* |
145 | * sk->sk_send_head has to have one skb with | 145 | * sk->sk_send_head has to have one skb with |
146 | * DCCP_SKB_CB(skb)->dccpd_type set to one of the retransmittable DCCP | 146 | * DCCP_SKB_CB(skb)->dccpd_type set to one of the retransmittable DCCP |
147 | * packet types (REQUEST, RESPONSE, the ACK in the 3way hanshake | 147 | * packet types (REQUEST, RESPONSE, the ACK in the 3way handshake |
148 | * (PARTOPEN timer), etc). | 148 | * (PARTOPEN timer), etc). |
149 | */ | 149 | */ |
150 | BUG_TRAP(sk->sk_send_head != NULL); | 150 | BUG_TRAP(sk->sk_send_head != NULL); |