commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (NET-346) FTP should support reporting NATed external IP address
Date Tue, 22 Mar 2011 03:38:06 GMT

    [ https://issues.apache.org/jira/browse/NET-346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009538#comment-13009538
] 

Sebb commented on NET-346:
--------------------------

What happens if you use

{code}
ftp.setActiveExternalIPAddress("X.X.X.X");
{code}

Does that not work?

> FTP should support reporting NATed external IP address
> ------------------------------------------------------
>
>                 Key: NET-346
>                 URL: https://issues.apache.org/jira/browse/NET-346
>             Project: Commons Net
>          Issue Type: Improvement
>          Components: FTP
>    Affects Versions: 2.2
>            Reporter: Kevin Samuel
>         Attachments: FTPClient.java
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> When trying to do an active FTP transfer as client from behind a firewall with NAT, setActiveExternalIPAddress
is not sufficient, as you can only report the internal IP of the client (e.g. 192.168.1.2
vs 72.14.X.X)
> FTPClient should support an additional function to set the REPORTABLE external active
IP Address
> I created and successfully tested a fix for this:
> ADD PRIVATE MEMBER:
> private InetAddress __reportActiveExternalHost;
> IN __initDefaults():
> __reportActiveExternalHost = null;
> ADD PUBLIC FUNCTIONS:
> private InetAddress getReportHostAddress()
>     {
>     	if (__reportActiveExternalHost != null)
>     	{
>     		return __reportActiveExternalHost ;
>     	}
>     	else if (__activeExternalHost != null)
>         {
>             return __activeExternalHost;
>         }
>         else
>         {
>             // default local address
>             return getLocalAddress();
>         }
>     }
> public void setReportActiveExternalIPAddress(String ipAddress) throws UnknownHostException
>     {
>         this.__reportActiveExternalHost = InetAddress.getByName(ipAddress);
>     }
> IN _openDataConnection_:
> if (isInet6Address)
>             {
>                 if (!FTPReply.isPositiveCompletion(eprt(getReportHostAddress(), server.getLocalPort())))
>                 {
>                     server.close();
>                     return null;
>                 }
>             }
>             else
>             {
>                 if (!FTPReply.isPositiveCompletion(port(getReportHostAddress(), server.getLocalPort())))
>                 {
>                     server.close();
>                     return null;
>                 }
>             }
> will also attach changed file
> sorry I am not familiar with the correct way to submit patches, although I tried to model
this on #NET-285 as much as possible

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message