Hi,
the following patch was posted from Rogier Wolff, but the Mailing List
Daemon refused to accept it. We are crrently fixing the posting problem,
and here is his posting.
Volker
---------- Forwarded message ----------
Date: Fri, 10 Dec 1999 14:09:30 +0100 (MET)
From: Rogier Wolff
On Sat, 11 Dec 1999, Volker Wiegand wrote:
Hi,
When the data port for connections to the server is specified as 41000 - 41999, there will always be a data connection between realserver:20 and proxyserver:41000, as the ftp-proxy always uses the lowest possible port. Some ftp-servers don't seem to like this. They end up refusing to build a dataconnection half of the time. (i.e. first request works, second request doesn't, and so forth).
Okay, I admit that there is a bug in my brain, because I have not fully understood the ReUseAddr thing. :-) All you Gurus on the list out there, please help me with this: is the patch provided by Rogier, and a second one disabling the SO_REUSEADDR option (at least on the data connections) the correct way to handle the connections? I remember that when I did not have SO_REUSEADDR it was nearly impossible to use the proxy. I could open one control connection and perform one data transfer. All went well, but I could not perform a second transfer within the 180 second timeout. When I introduced the flag, I could do as many sequential transfers as I wanted. As soon as I have this sorted out, I will release a new update with all issues of the past few weeks addressed.
Anyway, I've modified the ftp-proxy to start looking for a free port at a random position in the range. This reduces the problem from occurring 50% of the time to 0.05% of the time. (range is 1000 entries). This is acceptable, as the retry will simply work.
Roger.
Volker -- Volker Wiegand Phone: +49 (0) 6196 / 50951-24 SuSE Rhein/Main AG Fax: +49 (0) 6196 / 40 96 07 Mergenthalerallee 45-47 Mobile: +49 (0) 179 / 292 66 76 D-65760 Eschborn E-Mail: Volker.Wiegand@suse.de ++ Only users lose drugs. Or was it the other way round? ++
Volker Wiegand wrote:
On Sat, 11 Dec 1999, Volker Wiegand wrote:
Hi,
When the data port for connections to the server is specified as 41000 - 41999, there will always be a data connection between realserver:20 and proxyserver:41000, as the ftp-proxy always uses the lowest possible port. Some ftp-servers don't seem to like this. They end up refusing to build a dataconnection half of the time. (i.e. first request works, second request doesn't, and so forth).
Okay, I admit that there is a bug in my brain, because I have not fully understood the ReUseAddr thing. :-)
All you Gurus on the list out there, please help me with this: is the patch provided by Rogier, and a second one disabling the SO_REUSEADDR option (at least on the data connections) the correct way to handle the connections?
TCP doesn't allow you to reuse the source-IP source-port dest-IP dest-port quad in the 3 minute timeout period. To prevent this from happening you forget about the SO_REUSEADDR. That unique-ifies the local source-port. As we'll be connecting to port 20 on a fixed IP, from our own fixed IP, the source port is the only variable thing. So, theory says that removing the SO_REUSEADDR is obligatory.
I remember that when I did not have SO_REUSEADDR it was nearly impossible to use the proxy. I could open one control connection and perform one data transfer. All went well, but I could not perform a second transfer within the 180 second timeout. When I introduced the flag, I could do as many sequential transfers as I wanted.
In theory, theory and practise agree. In practise they don't. Roger. -- ** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 ** *-- BitWizard writes Linux device drivers for any device you may have! --* "I didn't say it was your fault. I said I was going to blame it on you."
Volker Wiegand wrote:
+ if (port >= urng) port = lrng;
I think the range is intended to be INCLUDING the last port so that should be if (port > urng) (The patched version is in production, and not going to change for no apparent reason). Roger. -- ** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 ** *-- BitWizard writes Linux device drivers for any device you may have! --* "I didn't say it was your fault. I said I was going to blame it on you."
On Sat, 11 Dec 1999, Rogier Wolff wrote:
Volker Wiegand wrote:
+ if (port >= urng) port = lrng;
I think the range is intended to be INCLUDING the last port so that should be
if (port > urng)
Okay. It is meant to be including.
Roger.
Volker -- Volker Wiegand Phone: +49 (0) 6196 / 50951-24 SuSE Rhein/Main AG Fax: +49 (0) 6196 / 40 96 07 Mergenthalerallee 45-47 Mobile: +49 (0) 179 / 292 66 76 D-65760 Eschborn E-Mail: Volker.Wiegand@suse.de ++ Only users lose drugs. Or was it the other way round? ++
participants (2)
-
R.E.Wolff@BitWizard.nl
-
Volker Wiegand