Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Jul 1997 12:16:15 -0600 (MDT)
From:      Marc Slemko <marcs@znep.com>
To:        =?KOI8-R?B?4c7E0sXKIP7F0s7P1w==?= <ache@nagual.pp.ru>
Cc:        Garrett Wollman <wollman@khavrinen.lcs.mit.edu>, FreeBSD-current <current@FreeBSD.ORG>
Subject:   Re: Another 'fetch' reset by peer: -b NOT work for this site...
Message-ID:  <Pine.BSF.3.95.970727121512.26104A-100000@alive.znep.com>
In-Reply-To: <Pine.BSF.3.96.970727163555.679A-100000@nagual.pp.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 27 Jul 1997, [KOI8-R] Андрей Чернов wrote:

> On Sat, 26 Jul 1997, Garrett Wollman wrote:
> 
> > <<On Sat, 26 Jul 1997 18:04:01 -0600 (MDT), Marc Slemko <marcs@znep.com> said:
> > 
> > > 18:00:43.330713 valis.worldgate.com.tr-rsrb-p2 > 205.180.58.12.http: SP 1382936415:1382936515(100) win 16464 <mss 1460,nop,wscale 0,nop,nop,timestamp[|tcp]> (DF)
> > > 18:00:43.382215 205.180.58.12.http > valis.worldgate.com.tr-rsrb-p2: S 1234567:1234567(0) ack 1382936416 win 2048
> > > 18:00:43.382867 valis.worldgate.com.tr-rsrb-p2 > 205.180.58.12.http: FP 101:155(54) ack 1 win 16464 (DF)
> > > 18:00:43.433453 205.180.58.12.http > valis.worldgate.com.tr-rsrb-p2: R 1:1(0) ack 102 win 2048
> > 
> > This is pretty clearly brain-damaged behavior.
> 
> Coule you please add an option into fetch to turn off T/TCP? It is not
> good to turn it off globally just for fetch...

The following code, which I have been using locally for a while, does
that.  

Index: fetch.1
===================================================================
RCS file: /usr/cvs/src/usr.bin/fetch/fetch.1,v
retrieving revision 1.18
diff -u -r1.18 fetch.1
--- fetch.1	1997/07/25 19:35:41	1.18
+++ fetch.1	1997/07/27 18:13:01
@@ -99,6 +99,10 @@
 under any circumstances, even if the transfer failed or was incomplete.
 .It Fl r
 Restart a previously interrupted transfer.
+.It Fl t
+Ensure that the use of T/TCP is not attempted for connections.  This is
+used to workaround bugs in some remote OS stacks that give improper
+replies to T/TCP connections.
 .It Fl T Ar seconds
 Set timeout value to
 .Ar seconds.
Index: fetch.h
===================================================================
RCS file: /usr/cvs/src/usr.bin/fetch/fetch.h,v
retrieving revision 1.4
diff -u -r1.4 fetch.h
--- fetch.h	1997/07/25 19:35:42	1.4
+++ fetch.h	1997/07/27 18:13:01
@@ -50,6 +50,7 @@
 	int fs_precious;	/* -R option */
 	int fs_auto_retry;	/* -a option */
 	int fs_linux_bug;	/* -b option */
+	int fs_use_connect;	/* -t option */
 	time_t fs_modtime;
 	void *fs_proto;
 	int (*fs_retrieve)(struct fetch_state *);
Index: http.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/fetch/http.c,v
retrieving revision 1.10
diff -u -r1.10 http.c
--- http.c	1997/07/26 20:18:43	1.10
+++ http.c	1997/07/27 18:13:01
@@ -581,6 +581,20 @@
 	fs->fs_status = "sending request message";
 	setup_sigalrm();
 	alarm(timo);
+
+	/* some hosts do not properly handle T/TCP connections.  If
+	 * sendmsg() is used to establish the connection, the OS may
+	 * choose to try to use one which could cause the transfer
+	 * to fail.  Doing a connect() first ensures that the OS
+	 * does not attempt T/TCP.
+	 */
+	if (fs->fs_use_connect && (connect(s, (struct sockaddr *)&sin, 
+                                   sizeof(struct sockaddr_in)) < 0)) {
+		warn("connect: %s", https->http_hostname);
+		fclose(remote);
+		return EX_OSERR;
+	}
+
 	if (sendmsg(s, &msg, fs->fs_linux_bug ? 0 : MSG_EOF) < 0) {
 		warn("sendmsg: %s", https->http_hostname);
 		fclose(remote);
Index: main.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/fetch/main.c,v
retrieving revision 1.41
diff -u -r1.41 main.c
--- main.c	1997/07/25 19:35:44	1.41
+++ main.c	1997/07/27 18:13:01
@@ -73,7 +73,7 @@
     fs.fs_verbose = 1;
     change_to_dir = file_to_get = hostname = 0;
 
-    while ((c = getopt(argc, argv, "abc:D:f:h:HilLmMnNo:pPqRrT:vV:")) != -1) {
+    while ((c = getopt(argc, argv, "abc:D:f:h:HilLmMnNo:pPqRrtT:vV:")) != -1) {
 	    switch (c) {
 	    case 'D': case 'H': case 'I': case 'N': case 'L': case 'V': 
 		    break;	/* ncftp compatibility */
@@ -130,6 +130,10 @@
 		    fs.fs_precious = 1;
 		    break;
 	    
+	    case 't':
+		    fs.fs_use_connect = 1;
+		    break;
+
 	    case 'T':
 		    /* strtol sets errno to ERANGE in the case of overflow */
 		    errno = 0;




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.970727121512.26104A-100000>