[Bug 256917] ftp-proxy doesn't work properly

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 01 Jul 2021 08:27:23 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256917

            Bug ID: 256917
           Summary: ftp-proxy doesn't work properly
           Product: Base System
           Version: 12.2-STABLE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: sasaki@fcc.ad.jp

stable/12-n233341-43a58daffe72

I have recently updated my server to the above. Since then, ftp-proxy doesn't
work properly.
When I connect to the ftp server, login succeeds. However, when I type ls, the
connection is closed.

# ftp xxx
Connected to xxx
220 XXX FTP server ready
Name (xxx:xxx):
331 Please specify the password.
Password: 
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
421 Service not available, remote server has closed connection.
257 "/" is the current directory


The result of truss -p PID_OF_FTP_PROXY after typing ls is as follows.

kevent(6,{ },0,{ 7,EVFILT_READ,EV_ONESHOT,0,0x6,0x8014dd1c0 },64,{
86399.998605000 }) = 1 (0x1)
ioctl(7,FIONREAD,0x7fffffffe6ec)                 = 0 (0x0)
read(7,"EPSV\r\n",6)                             = 6 (0x6)
kevent(6,{ 7,EVFILT_READ,EV_DELETE,0,0,0x0
7,EVFILT_READ,EV_ADD|EV_ONESHOT,0,0,0x8014dd1c0
8,EVFILT_WRITE,EV_ADD|EV_ONESHOT,0,0,0x8014dd098 },3,{
7,EVFILT_READ,EV_ERROR,0,0x2,0x0 },64,{ 86394.255447000 }) = 1 (0x1)
kevent(6,{ },0,{ 8,EVFILT_WRITE,EV_ONESHOT,0,0x832c,0x8014dd098 },64,{
86394.255383000 }) = 1 (0x1)
write(8,"EPSV\r\n",6)                            = 6 (0x6)
kevent(6,{ 8,EVFILT_WRITE,EV_DELETE,0,0,0x0 },1,{
8,EVFILT_WRITE,EV_ERROR,0,0x2,0x0 },64,{ 86394.255268000 }) = 1 (0x1)
kevent(6,{ },0,{ 8,EVFILT_READ,EV_ONESHOT,0,0x30,0x8014dd000 },64,{
86394.255214000 }) = 1 (0x1)
ioctl(8,FIONREAD,0x7fffffffe6ec)                 = 0 (0x0)
read(8,"229 Entering Extended Passive Mo"...,48) = 48 (0x30)
getpid()                                         = 7802 (0x1e7a)
ioctl(4,DIOCXBEGIN,0x102d958)                    = 0 (0x0)
getpid()                                         = 7802 (0x1e7a)
ioctl(4,DIOCBEGINADDRS,0x102d4e8)                = 0 (0x0)
ioctl(4,DIOCADDRULENV,0x7fffffffe560)            ERR#22 'Invalid argument'
__sysctl("kern.hostname",2,0x7fffffffe0c0,0x7fffffffd368,0x0,0) = 0 (0x0)
getpid()                                         = 7802 (0x1e7a)
sendto(5,"<26>1 2021-07-01T17:22:03.310854"...,129,0,NULL,0) = 129 (0x81)
ioctl(4,DIOCXROLLBACK,0x102d958)                 = 0 (0x0)
write(7,0x8014e4000,0)                           = 0 (0x0)
write(8,0x8014e4200,0)                           = 0 (0x0)
close(7)                                         = 0 (0x0)
close(8)                                         = 0 (0x0)
getpid()                                         = 7802 (0x1e7a)
ioctl(4,DIOCXBEGIN,0x102d958)                    = 0 (0x0)
ioctl(4,DIOCXCOMMIT,0x102d958)                   = 0 (0x0)
kevent(6,{ 8,EVFILT_READ,EV_DELETE,0,0,0x0
8,EVFILT_READ,EV_ADD|EV_ONESHOT,0,0,0x8014dd000 7,EVFILT_READ,EV_DELETE,0,0,0x0
8,EVFILT_READ,EV_DELETE,0,0,0x0 },4,{ 8,EVFILT_READ,EV_ERROR,0,0x9,0x0
8,EVFILT_READ,EV_ERROR,0,0x9,0x8014dd000 7,EVFILT_READ,EV_ERROR,0,0x9,0x0
8,EVFILT_READ,EV_ERROR,0,0x9,0x0 },64,{ 5.000000000 }) = 4 (0x4)
kevent(6,{ },0,{ },64,{ 5.000000000 })           = 0 (0x0)


I changed the source back to 0d71f9f36e6c and the issue has gone. I think the
following commit is causing this issue.

commit 95be9288f01f30a50440ea56d11468a2c6e18fed (HEAD)
Author: Kristof Provost <kp@FreeBSD.org>
Date:   Mon Mar 29 14:03:39 2021 +0200

    (t)ftp-proxy: use libpfctl

    Reviewed by:    glebius
    MFC after:      4 weeks
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D29641

-- 
You are receiving this mail because:
You are the assignee for the bug.