Title: ftplib passive ftp problem on multihomed clients
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 3.3, Python 2.7
Status: open Resolution:
Dependencies: Superseder: Add a "source_address" option to ftplib
View: 8594
Assigned To: giampaolo.rodola Nosy List: exarkun, giampaolo.rodola, pitrou, timbaum
Priority: normal Keywords: patch

Created on 2007-02-16 19:36 by timbaum, last changed 2011-03-03 22:24 by giampaolo.rodola.

File name Uploaded Description Edit
ftplib.patch timbaum, 2007-02-16 19:36 patch in unified forward diff format
ftplib.patch giampaolo.rodola, 2011-03-03 22:12 review
Messages (4)
msg51894 - (view) Author: Tim Baum (timbaum) Date: 2007-02-16 19:36
When using passive FTP on a multihomed client, data connections should originate from the same address as the control connection.  Otherwise, the connection can be blocked by stateful firewalls or rejected by the ftp server.  The library allows the OS to choose the local address for each passive data connection, so connections fail intermittently if the operating system selects a different local address than used for the initial connection.

The attached patch binds the passive-mode data connection to the same local address as the control connection.
msg104750 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2010-05-01 20:39
Issue 8594 is related with this one.
msg130007 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2011-03-03 22:12
Patch in attachment updates the previous one which no longer applies cleanly in py 3.3.
The control connection address is used for *both* passive (PASV) and active (PORT) connections, which is the same approach I used in pyftpdlib.

Removed test_source_address_passive_connection test because we do not want that the same (host, port) is used for both control and data connections.

I think it makes sense to port this patch in previous python versions as well.
msg130009 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2011-03-03 22:24
> we do not want that the same (host, port) is used for
> both control and data connections.

I meant *port*, not (host, port).
Date User Action Args
2011-03-03 22:24:05giampaolo.rodolasetnosy: exarkun, pitrou, giampaolo.rodola, timbaum
messages: + msg130009
2011-03-03 22:13:20giampaolo.rodolasetassignee: giampaolo.rodola
nosy: exarkun, pitrou, giampaolo.rodola, timbaum
2011-03-03 22:12:34giampaolo.rodolasetfiles: + ftplib.patch
versions: + Python 3.3
nosy: + exarkun, pitrou

messages: + msg130007

stage: test needed -> patch review
2010-09-16 21:04:04BreamoreBoysetversions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6, Python 3.0
2010-05-01 20:39:48giampaolo.rodolasetsuperseder: Add a "source_address" option to ftplib
messages: + msg104750
2009-03-30 21:41:08ajaksu2setnosy: + giampaolo.rodola
versions: + Python 2.6, Python 3.0, - Python 2.5

type: behavior
stage: test needed
2007-02-16 19:36:59timbaumcreate