🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #15403

Re: Problems streaming to Linux systems?

#15403
From: Brian Kelly
Date: Thu, 27 Feb 1997 00:00
80 lines
3712 bytes
[Crossposted to comp.os.linux.networking as I believe they would appreciate a
"heads-up" on this issue]

In article <BKELLY.97Feb24221926@sulaco.com> I wrote:
>At the moment I believe this to be a problem in the net code in the kernel, 
>not libc. I'll continue to try and track it down (seeing as I can reproduce it
>reliably and in a few minutes) and report back with any results.

After quite a bit of detective work I've located and (I believe) fixed this
problem. It is a problem in the kernel TCP code. What I am seeing happen is
that the advertised window from the other side of the link is set to 0, then
the congestion window is set to 0 and the connection relies on the persist
timer and window probes to start things up again. There are two problems here
I believe. The congestion window should never go to 0, otherwise the packets
in flight counter will never be less than it and so we'll never get to send
data again. The second problem is the code that is run when the persist timer
fires. If there is data waiting to go, it tries to send it as the window probe.
However the nimber of bytes it sucks out of the waiting data is governed by
the size of the currently available window, not by the amount of data in the
first buffer on the send queue!!! This is why I was seeing a single 31k TCP
packet where the first bytes were correct and the remainder were garbage.

I've sent details of what I believe to be the fix to Alan Cox and the patch is
appended here. All this was carried out on the 2.0.27 kernel, but it should 
apply gracefully to most recent kernels. [I've just got word back from Alan
that the congestion window fix will be in 2.0.30]

--------- Start of patch---------
diff -u --recursive --new-file tmp/linux/net/ipv4/tcp_input.c linux/net/ipv4/tcp_input.c
--- tmp/linux/net/ipv4/tcp_input.c	Wed Feb 26 23:54:06 1997
+++ linux/net/ipv4/tcp_input.c	Wed Feb 26 20:37:30 1997
@@ -830,7 +830,7 @@
 	else
 	{
 		if (sk->rcv_ack_cnt > MAX_DUP_ACKS) {
-			sk->cong_window = sk->ssthresh;
+			sk->cong_window = max(sk->ssthresh, 1);
 		}
 		sk->window_seq = window_seq;
 		sk->rcv_ack_seq = ack;
diff -u --recursive --new-file tmp/linux/net/ipv4/tcp_output.c linux/net/ipv4/tcp_output.c
--- tmp/linux/net/ipv4/tcp_output.c	Wed Feb 26 23:54:06 1997
+++ linux/net/ipv4/tcp_output.c	Wed Feb 26 21:35:49 1997
@@ -1048,17 +1048,18 @@
 #endif
 	
 		/*
-		 *	How many bytes can we send ?
-		 */
-		 
-		win_size = sk->window_seq - sk->sent_seq;
-
-		/*
 		 *	Recover the buffer pointers
 		 */
 		 
 	    	iph = (struct iphdr *)skb->ip_hdr;
 	    	th = (struct tcphdr *)(((char *)iph) +(iph->ihl << 2));
+
+		/*
+		 *	How many bytes can we send ?
+		 */
+		
+		win_size = skb->len - (((unsigned char *) th) - skb->data);
+		win_size -= th->doff * 4;
 
 		/*
 		 *	Grab the data for a temporary frame


--------- End of patch---------

Brian
-- 
ObAFUFAQ: F. Grace Hopper coined the term "bug" as a result of this event.

bkelly@sulaco.com

Technical Details
Message-ID: <BKELLY.97Feb27000436@sulaco.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <E5t578.M6x@spcuna.spc.edu> <5eg4d2$ruc@usenet1y.prodigy.net>

Show Full Headers
Complete Article Headers
Message-ID: <BKELLY.97Feb27000436@sulaco.com>
Subject: Re: Problems streaming to Linux systems?
Date: Thu, 27 Feb 1997 00:00:00 +0000
From: bkelly@sulaco.com (Brian Kelly)
References: <E5t578.M6x@spcuna.spc.edu> <5eg4d2$ruc@usenet1y.prodigy.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 221678674
Distribution: inet
X-NNTP-Posting-Host: dropship.demon.co.uk
Organization: None
Newsgroups: news.software.nntp,comp.os.linux.networking