From owner-cvs-all Sat Dec 29 10: 2:26 2001 Delivered-To: cvs-all@freebsd.org Received: from zibbi.icomtek.csir.co.za (zibbi.icomtek.csir.co.za [146.64.24.58]) by hub.freebsd.org (Postfix) with ESMTP id 5E4B937B419; Sat, 29 Dec 2001 10:02:07 -0800 (PST) Received: (from jhay@localhost) by zibbi.icomtek.csir.co.za (8.11.6/8.11.6) id fBTI1AA55652; Sat, 29 Dec 2001 20:01:10 +0200 (SAT) (envelope-from jhay) From: John Hay Message-Id: <200112291801.fBTI1AA55652@zibbi.icomtek.csir.co.za> Subject: Re: cvs commit: src/usr.bin/ftp Makefile cmds.c cmdtab.c complet In-Reply-To: from Hajimu UMEMOTO at "Dec 23, 2001 00:02:11 am" To: ume@mahoroba.org (Hajimu UMEMOTO) Date: Sat, 29 Dec 2001 20:01:10 +0200 (SAT) Cc: jhay@icomtek.csir.co.za (John Hay), mheffner@vt.edu (Mike Heffner), mikeh@FreeBSD.ORG (Mike Heffner), cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, FreeBSD-current@FreeBSD.ORG (FreeBSD-current) X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This patch works just fine here, thanks. Any chance of getting it as part of lukem distribution or ours? John -- John Hay -- John.Hay@icomtek.csir.co.za > > Differences/Losses: > > > > *) FTP_PASSIVE_MODE vs. FTP_MODE > > *) -4/-6 for forcing IPV4/IPV6 > > jhay> Any chance of getting -4/-6 or something like it, back? It is very useful > jhay> here in our environment that have a lot of dual-stack machines. > > I think it is still useful in the environment where IPv6 link is > relatively slow than IPv4 link. > How about this patch? > > Index: contrib/lukemftp/src/fetch.c > =================================================================== > RCS file: /home/ncvs/src/contrib/lukemftp/src/fetch.c,v > retrieving revision 1.1.1.1 > diff -u -u -r1.1.1.1 fetch.c > --- contrib/lukemftp/src/fetch.c 19 Jul 2001 16:26:13 -0000 1.1.1.1 > +++ contrib/lukemftp/src/fetch.c 22 Dec 2001 14:47:28 -0000 > @@ -617,7 +617,7 @@ > > memset(&hints, 0, sizeof(hints)); > hints.ai_flags = 0; > - hints.ai_family = AF_UNSPEC; > + hints.ai_family = family; > hints.ai_socktype = SOCK_STREAM; > hints.ai_protocol = 0; > error = getaddrinfo(host, NULL, &hints, &res0); > Index: contrib/lukemftp/src/ftp.1 > =================================================================== > RCS file: /home/ncvs/src/contrib/lukemftp/src/ftp.1,v > retrieving revision 1.1.1.1 > diff -u -u -r1.1.1.1 ftp.1 > --- contrib/lukemftp/src/ftp.1 19 Jul 2001 16:26:13 -0000 1.1.1.1 > +++ contrib/lukemftp/src/ftp.1 22 Dec 2001 14:47:29 -0000 > @@ -77,7 +77,7 @@ > Internet file transfer program > .Sh SYNOPSIS > .Nm "" > -.Op Fl AadefginpRtvV > +.Op Fl 46AadefginpRtvV > .Bk -words > .Op Fl o Ar output > .Ek > @@ -146,6 +146,14 @@ > Options may be specified at the command line, or to the > command interpreter. > .Bl -tag -width "port " > +.It Fl 4 > +Forces > +.Nm > +to use IPv4 addresses only. > +.It Fl 6 > +Forces > +.Nm > +to use IPv6 addresses only. > .It Fl A > Force active mode ftp. > By default, > Index: contrib/lukemftp/src/ftp.c > =================================================================== > RCS file: /home/ncvs/src/contrib/lukemftp/src/ftp.c,v > retrieving revision 1.1.1.1 > diff -u -u -r1.1.1.1 ftp.c > --- contrib/lukemftp/src/ftp.c 19 Jul 2001 16:26:14 -0000 1.1.1.1 > +++ contrib/lukemftp/src/ftp.c 22 Dec 2001 14:47:31 -0000 > @@ -149,7 +149,7 @@ > memset(&hints, 0, sizeof(hints)); > portnum = parseport(port, FTP_PORT); > hints.ai_flags = AI_CANONNAME; > - hints.ai_family = AF_UNSPEC; > + hints.ai_family = family; > hints.ai_socktype = SOCK_STREAM; > hints.ai_protocol = 0; > error = getaddrinfo(host, NULL, &hints, &res0); > Index: contrib/lukemftp/src/ftp_var.h > =================================================================== > RCS file: /home/ncvs/src/contrib/lukemftp/src/ftp_var.h,v > retrieving revision 1.1.1.1 > diff -u -u -r1.1.1.1 ftp_var.h > --- contrib/lukemftp/src/ftp_var.h 19 Jul 2001 16:26:14 -0000 1.1.1.1 > +++ contrib/lukemftp/src/ftp_var.h 22 Dec 2001 14:47:31 -0000 > @@ -279,6 +279,8 @@ > GLOBAL char remotepwd[MAXPATHLEN]; /* remote dir */ > GLOBAL char *username; /* name of user logged in as. (dynamic) */ > > +GLOBAL sa_family_t family; /* address family to use for connections */ > + > GLOBAL char *ftpport; /* port number to use for FTP connections */ > GLOBAL char *httpport; /* port number to use for HTTP connections */ > GLOBAL char *gateport; /* port number to use for gateftp connections */ > Index: contrib/lukemftp/src/main.c > =================================================================== > RCS file: /home/ncvs/src/contrib/lukemftp/src/main.c,v > retrieving revision 1.1.1.1 > diff -u -u -r1.1.1.1 main.c > --- contrib/lukemftp/src/main.c 19 Jul 2001 16:26:14 -0000 1.1.1.1 > +++ contrib/lukemftp/src/main.c 22 Dec 2001 14:47:32 -0000 > @@ -171,6 +171,7 @@ > upload_path = NULL; > isupload = 0; > reply_callback = NULL; > + family = AF_UNSPEC; > > /* > * Get the default socket buffer sizes if we don't already have them. > @@ -255,8 +256,16 @@ > } > } > > - while ((ch = getopt(argc, argv, "Aadefgino:pP:r:RtT:u:vV")) != -1) { > + while ((ch = getopt(argc, argv, "46Aadefgino:pP:r:RtT:u:vV")) != -1) { > switch (ch) { > + case '4': > + family = AF_INET; > + break; > + > + case '6': > + family = AF_INET6; > + break; > + > case 'A': > activefallback = 0; > passivemode = 0; > > -- > Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan > ume@mahoroba.org ume@bisd.hitachi.co.jp ume@{,jp.}FreeBSD.org > http://www.imasy.org/~ume/ > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message