incubator-ftpserver-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Gustavsson <nik...@protocol7.com>
Subject Re: Allow configuring IP address for PASV response
Date Wed, 07 Feb 2007 19:13:52 GMT
Clinton Foster wrote:
 > JDK 1.4 added three new methods on InetAddress to make this 
determination.
 > Have a look at this code snippet:
 >
 >   InetAddress remoteInetAddress = controlSocket.getInetAddress();
 >
 >   if (remoteInetAddress.isLinkLocalAddress() ||
 >       remoteInetAddress.isSiteLocalAddress() ||
 >       remoteInetAddress.isLoopbackAddress()) {
 >          // client is local
 >   }
 >
 > The one thing I'm unsure about is whether it is correct to check both
 > isLinkLocal and isSiteLocal. The Javadoc is not very helpful. If 
anyone can
 > provide some additional insight, that would be great.
 >
 > I have tested this with various different FTP clients connecting from 
inside
 > and outside the firewall, both SSL and non-SSL, and it works in all the
 > scenarios I've tried.

After reading the JavaDocs, I'm not entirely sure this will catch the 
case where the server is on a private network (192.168.*.*), e.g. behind 
a NAT? Link local seems to cover only 169.254.*.* addresses.

/niklas


Mime
View raw message