RSH helper concurrent sessions fix
Hi,
here is a fix for a small error I discovered in the RSH conntrack helper when trying to establish multiple concurrent sessions to a host (working for me, at least).
rsh/linux/net/ipv4/netfilter/ip_conntrack_rsh.c +1 -1
@@ -230,7 +230,7 @@ static int help(const struct iphdr *iph, exp->mask.dst.ip =0xffffffff ; exp->mask.src.u.tcp.port =htons (0xfc00 ); - exp->mask.dst.u.tcp.port =htons (0xfc00 ); + exp->mask.dst.u.tcp.port =htons (0xffff ); exp->mask.dst.protonum =0xffff ; exp->expectfn =NULL ;
rsh/linux-2.6.11/net/ipv4/netfilter/ip_conntrack_rsh.c +1 -1
@@ -231,7 +231,7 @@ static int help(struct sk_buff **pskb, exp->mask.dst.ip =0xffffffff ; exp->mask.src.u.tcp.port =htons (0xfc00 ); - exp->mask.dst.u.tcp.port =htons (0xfc00 ); + exp->mask.dst.u.tcp.port =htons (0xffff ); exp->mask.dst.protonum =0xff ; exp->expectfn =NULL ;
Greetings,
Sebastian Aberle
--
InfoTech GmbH
Holthoffstrasse 126
45659 Recklinghausen, GERMANY
www.infotech.de
Quoted 5 lines · Sebastian Aberle
Hi,
here is a fix for a small error I discovered in the RSH conntrack helper when trying to establish multiple concurrent sessions to a host (working for me, at least).
Thanks for your patch.
It's up to Jozsef (Cc) to comment (and ACK/NACK) on this, he's the author of the rsh helper.
Jozsef?
Signature · 5 lines
- Harald Welte <[email protected]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie
Quoted 11 lines · Harald Welte
Quoted 5 lines · Sebastian Aberle
Hi,
here is a fix for a small error I discovered in the RSH conntrack helper when trying to establish multiple concurrent sessions to a host (working for me, at least).
Thanks for your patch.
It's up to Jozsef (Cc) to comment (and ACK/NACK) on this, he's the author of the rsh helper.
I'm not the author of the rsh helper ;-), but anyway, here goes my opinion:
The protocol descriptions of rsh available for me are a little bit fuzzy:
- According to Chapman & Zwicky, both the source and destination ports of the error channel are below 1024.
- The source code of rshd from netkit-rsh indeed makes sure that both ports of the error channel be reserved.
- The manpage of rshd does not state that the destination port must be below 1024.
- The protocol description in ip_conntrack_rsh.c itself does not state either, but the code checks and rejects requested destination ports above 1023.
So first, what kind of system and rsh version do you use on the client and the server side? Could you post a tcpdump recording of an rsh session where the ports of the error channel are above 1023? Second, I don't understand how could your patch relax the check on the destination port without other modifications.
Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
H-1525 Budapest 114, POB. 49, Hungary
Quoted 15 lines · Jozsef Kadlecsik
I'm not the author of the rsh helper ;-), but anyway, here goes my opinion:
The protocol descriptions of rsh available for me are a little bit fuzzy:
- According to Chapman & Zwicky, both the source and destination ports of the error channel are below 1024.
- The source code of rshd from netkit-rsh indeed makes sure that both ports of the error channel be reserved.
- The manpage of rshd does not state that the destination port must be below 1024.
- The protocol description inip_conntrack_rsh.citself does not state either, but the code checks and rejects requested destination ports above 1023.
Quoted 2 lines
So first, what kind of system and rsh version do you use on the client and the server side?
I use quite a lot versions of RSH servers for different OSes (Windows NT4, 2000, Linux, SunOS). The client and also the server I tested with during experimenting are Linux NetKit 0.16 versions comming with SuSE 7.0.
Quoted 2 lines
Could you post a tcpdump recording of an rsh session where the ports of the error channel are above 1023?
I never said that ports above 1023 are being used - indeed, they're not. My patch does not enable the error channel connections to use unprivileged ports, it only limits the expection being created from the data seen in the first channel to exactly the one port the client communicates there. I could post a tcpdump of such a (normal) connection though, of course.
I'll try to clarify my view of things:
The unpatched helper created an expectation with a dport mask of 0xfc00, meaning any unprivileged port matches. In my case, I run an automated machine status report generator that uses RSH to gather data from some machines, like disk, memory and CPU usage etc. This script creates several parallel RSH sessions at a quite fast interval, and that obviously confused the connection tracker in a way that it "uses" the wrong expectation for some incoming error channel connections, resulting in dropping these packets. Creating one connection after another always worked flawlessly.
Now after my patch, the expectations are created for exactly the one port that was chosen in the first connection (mask 0xffff). That seems to help the connection tracker to find the right expectation for each RSH session.
Quoted 3 lines
Second, I don't
understand how could your patch relax the check on the destination port without other modifications.
It does not relax the checks, it even enforces them. That seems to be the trick at all...
After all, please correct me if I'm wrong somewhere, I'm totally new to all this. :-)
Greetings,
Sebastian Aberle
--
InfoTech GmbH
Holthoffstrasse 126
45659 Recklinghausen, GERMANY
www.infotech.de
Hi,
Quoted 11 lines · Sebastian Aberle
I'll try to clarify my view of things:
The unpatched helper created an expectation with a dport mask of
0xfc00, meaning any unprivileged port matches. In my case, I run an automated machine status report generator that uses RSH to gather data from some machines, like disk, memory and CPU usage etc. This script creates several parallel RSH sessions at a quite fast interval, and that obviously confused the connection tracker in a way that it "uses" the wrong expectation for some incoming error channel connections, resulting in dropping these packets. Creating one connection after another always worked flawlessly.
Quoted 3 lines
Now after my patch, the expectations are created for exactly the one port that was chosen in the first connection (mask
0xffff). That seems to help the connection tracker to find the right expectation for each RSH session.
I see, sorry for my confusion. I applied your patch in svn with one slight
addition: in linux-2.6.11/net/ipv4/netfilter/ip_conntrack_rsh.c exp->mask.dst.protonum was set in the original file to 0xff instead of 0xffff.
Best regards,
Jozsef
-
E-mail : [email protected], [email protected] PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
H-1525 Budapest 114, POB. 49, Hungary