Hi,

>>>>> On Fri, 14 Dec 2001 08:43:49 +0200 (SAT)
>>>>> John Hay <[EMAIL PROTECTED]> said:

> On 13-Dec-2001 Mike Heffner wrote:
> | mikeh       2001/12/13 15:46:45 PST
jhay> ...
> |   Log:
> |   Connect lukemftp to the build as the default ftp client. Lukemftp
> |   supports most of the previous features of FreeBSD ftp, but has been
> |   better maintained and includes new features.
> 
> Short summary of differences:
> 
jhay> ...
> 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
[EMAIL PROTECTED]  [EMAIL PROTECTED]  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to