Skip to contentSkip to conversation

tcp seq nr wrapping bug + patch

PATCH Ulrik De Bie 2 participants 2 messages Mar 10, 2003 – Mar 11, 2003

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hello,

I resend this patch which fixes a stupid mistake in the tcp sequence number in the 2.2 kernel.

Kind regards,
Ulrik De Bie

When the sequence number in a tcp session is about to wrap for packets leaving the system, a problem arises:

When the system call writev is called, with a count of 5 for instance, and the second iov entry makes the sequence number wrap, then the other 3 will be sent in separate packets, because the comparison will be wrong.

before() fixes this problem.

Sorry that I'm sending from a windows machine at the moment, I don't have a linux mail machine available at the very moment.

Kind regards,
Ulrik De Bie
[email protected]

net/ipv4/tcp.c +1 -1
@@ -823,7 +823,7 @@
 				 */
 				if (skb_tailroom(skb) > 0 &&
 				    (mss_now - copy) > 0 &&
-				    tp->snd_nxt < TCP_SKB_CB(skb)->end_seq) {
+				    before(tp->snd_nxt , TCP_SKB_CB(skb)->end_seq)) {
 					int last_byte_was_odd = (copy % 4);
 
 					/* 
#1 lore raw
Quoted 2 lines · Ulrik De Bie

I resend this patch which fixes a stupid mistake in the tcp sequence number in the 2.2 kernel.

This looks good, thanks.

Alan, please apply.

- James

Signature · 16 lines
James Morris
<[email protected]>


diff -urN -X dontdiff linux-2.2.24.orig/net/ipv4/tcp.c linux-2.2.24.w1/net/ipv4/tcp.c
--- linux-2.2.24.orig/net/ipv4/tcp.c	Wed Sep 25 00:06:26 2002
+++ linux-2.2.24.w1/net/ipv4/tcp.c	Tue Mar 11 23:26:00 2003
@@ -823,7 +823,7 @@
 				 */
 				if (skb_tailroom(skb) > 0 &&
 				    (mss_now - copy) > 0 &&
-				    tp->snd_nxt < TCP_SKB_CB(skb)->end_seq) {
+				    before(tp->snd_nxt, TCP_SKB_CB(skb)->end_seq)) {
 					int last_byte_was_odd = (copy % 4);
 
 					/*