I have an ftpd protocol module for apache
(http://www.outoforder.cc/projects/apache/mod_ftpd) and have been tracking
down a bug that a user is having and have finally tracked down the cause
of the issue.. I

mod_ftpd is running on a (linux in this case 2.4 or 2.6 kernel) system w/
IPV4 and IPV6 support enabled. (in apache 2.0.48 or 2.0.53)

client logs into the ftp server and issues a PASV command.  The docs and
*current practive* specify that the ftp server should bind to a port under
the same IP family as the original connection came in on. IF the client
uses the newer EPSV command they can specify the family
  'EPSV 1' for IPV4
  'EPSV 2' for IPV6
  'EPSV' then use the same family that the connection came in on.

The issue is, when you have IPV6 enabled the r->connection->local_addr
socket structure has a ->family member of APR_INET6 even if the connection
came in under an IPV4 connection.  and apr_sockaddr_ip_get(&ipaddr,
r->connection->local_addr) will set ip_addr to the IPV4 ip address.

Why is the family set to APR_INET6 for an IPV4 incoming connection, and is
there a way for me to *truly* figure out how the connection really came in
originally.


Reply via email to