Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Nov 2011 12:59:26 GMT
From:      Charlie Root <email@forged.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/162661: [patch] ftp(8) is giving up on IPv6
Message-ID:  <201111181259.pAICxQhm017022@red.freebsd.org>
Resent-Message-ID: <201111181300.pAID0JAo005359@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         162661
>Category:       bin
>Synopsis:       [patch] ftp(8) is giving up on IPv6
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 18 13:00:18 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Charlie Root
>Release:        FreeBSD 9.0-RC2
>Organization:
none
>Environment:
FreeBSD b93 9.0-RC2 FreeBSD 9.0-RC2 #3: Fri Nov 18 10:35:03 UTC 2011 roo
t@b93:/usr/obj/usr/src/sys/C901 i386

The kernel has been compiled with options:

makeoptions MKMODULESENV+="WITHOUT_INET_SUPPORT="
nodevice gre
nooptions       INET
options         INET6

>Description:
The ftp(8) cannot be used when there is no AF_INET protocol family support within kernel. There is a fragment of code in the main.c which is trying to get the socket sizes when the PF is hardcoded to AF_INET.

>How-To-Repeat:
      1) Compile the kernel with above options to include INET6 and exclude INET from the kernel.
        2) run ftp from the shell.

        Here is a snippet from the screen:

b93# ftp
ftp: Can't create socket to determine default socket sizes: Protocol not supported

b93# ftp -6
ftp: Can't create socket to determine default socket sizes: Protocol not supported

b93# ftp ftp.freebsd.org.
ftp: Can't create socket to determine default socket sizes: Protocol not supported

b93# host -t AAAA ftp.freebsd.org.
ftp.freebsd.org has IPv6 address 2001:4f8:0:2::e
ftp.freebsd.org has IPv6 address 2001:6c8:2:600::132

b93# ftp 2001:4f8:0:2::e
ftp: Can't create socket to determine default socket sizes: Protocol not supported

>Fix:
        Apply the following patch:

--- main.c.orig 2011-11-18 12:16:01.000000000 +0000
+++ main.c      2011-11-18 12:11:11.000000000 +0000
@@ -203,7 +203,7 @@
        isupload = 0;
        reply_callback = NULL;
 #ifdef INET6
-       family = AF_UNSPEC;
+       family = AF_INET6;
 #else
        family = AF_INET;       /* force AF_INET if no INET6 support */
 #endif
@@ -219,7 +219,7 @@
         * call no socket buffer sizes will have been modified, so we are
         * guaranteed to get the system defaults.
         */
-       s = socket(AF_INET, SOCK_STREAM, 0);
+       s = socket(family, SOCK_STREAM, 0);
        if (s == -1)
                err(1, "Can't create socket to determine default socket sizes");
        slen = sizeof(rcvbuf_size);



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111181259.pAICxQhm017022>