]> err.no Git - linux-2.6/commitdiff
[DCCP] ACKVEC: fix ackvector length calculation
authorAndrea Bittau <a.bittau@cs.ucl.ac.uk>
Tue, 19 Sep 2006 20:04:54 +0000 (13:04 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 22 Sep 2006 22:19:07 +0000 (15:19 -0700)
Fix ackvector length calculation upon receiving an "ack-of-ack".  This
patch avoids the ackvector from growing too large which causes it to
not be inserted into packets.

Signed-off-by: Andrea Bittau <a.bittau@cs.ucl.ac.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dccp/ackvec.c

index 8c211c58893b2a6de115110743ed33a88befbe4d..8dab723cc704899e84a9c5b8c495fd6ad4265ca0 100644 (file)
@@ -353,11 +353,13 @@ static void dccp_ackvec_throw_record(struct dccp_ackvec *av,
 {
        struct dccp_ackvec_record *next;
 
-       av->dccpav_buf_tail = avr->dccpavr_ack_ptr - 1;
-       if (av->dccpav_buf_tail == 0)
-               av->dccpav_buf_tail = DCCP_MAX_ACKVEC_LEN - 1;
-
-       av->dccpav_vec_len -= avr->dccpavr_sent_len;
+       /* sort out vector length */
+       if (av->dccpav_buf_head <= avr->dccpavr_ack_ptr)
+               av->dccpav_vec_len = avr->dccpavr_ack_ptr - av->dccpav_buf_head;
+       else
+               av->dccpav_vec_len = DCCP_MAX_ACKVEC_LEN - 1
+                                    - av->dccpav_buf_head
+                                    + avr->dccpavr_ack_ptr;
 
        /* free records */
        list_for_each_entry_safe_from(avr, next, &av->dccpav_records,