Skip to contentSkip to conversation

: Fix sequence number arithmetic/comparisons

PATCH In review Gerrit Renker 2 participants 2 messages Oct 27, 2007 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 3/6 : Fix sequence number arithmetic/comparisons

[CCID2]: Fix sequence number arithmetic/comparisons

This replaces use of normal subtraction with modulo-48 subtraction.

---
 net/dccp/ccids/ccid2.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
net/dccp/ccids/ccid2.c +2 -7
@@ -24,9 +24,6 @@
 
 /*
  * This implementation should follow RFC 4341
- *
- * BUGS:
- * - sequence number wrapping
  */
 
 #include "../ccid.h"
@@ -619,9 +616,8 @@ static void ccid2_hc_tx_packet_recv(stru
 		/* go through this ack vector */
 		while (veclen--) {
 			const u8 rl = *vector & DCCP_ACKVEC_LEN_MASK;
-			u64 ackno_end_rl;
+			u64 ackno_end_rl = SUB48(ackno, rl);
 
-			dccp_set_seqno(&ackno_end_rl, ackno - rl);
 			ccid2_pr_debug("ackvec start:%llu end:%llu\n",
 				       (unsigned long long)ackno,
 				       (unsigned long long)ackno_end_rl);
@@ -671,8 +667,7 @@ static void ccid2_hc_tx_packet_recv(stru
 			if (done)
 				break;
 
-
-			dccp_set_seqno(&ackno, ackno_end_rl - 1);
+			ackno = SUB48(ackno_end_rl, 1);
 			vector++;
 		}
 		if (done)