Subject: kern/7368: ipnat not rewriting PORT command 100% of time
To: None <gnats-bugs@gnats.netbsd.org>
From: TheMan <andrew@untraceable.net>
List: netbsd-bugs
Date: 04/12/1999 16:53:22
>Number:         7368
>Category:       kern
>Synopsis:       ipnat does not always rewrite the PORT command on an ftp connection
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 12 14:05:01 1999
>Last-Modified:
>Originator:     TheMan
>Organization:
don't need none
>Release:        1.4_alpha
>Environment:
System: NetBSD noc 1.3.3 NetBSD 1.3.3 (LINGAM) #0: Sat Mar 6 23:57:16 EST 1999 root@:/usr/src/sys/arch/i386/compile/LINGAM i386

>Description:

my network setup is as follows:

1 sparc voyager with netbsd 1.4_alpha	eth 192.168.0.2 alias 10.0.0.1
1 mac running mklinux			eth 10.0.0.2
1 cable modem				eth 192.168.0.1
1 hub, connected to all three previous

the default route for the mac is to 10.0.0.1, which works fine except
for linux's ftp.  ipnat properly nats the packets and sends them back
out onto the ethernet to the cable modem.  after it was working for a
little while, i noticed that "ncftp" would work, but "ftp" would not,
unless i specifically requested "passive" mode.  which is a drag,
since ncftp (yes, 2.4.3) dumps core every time i try to use it).  so
looked at the packets.

the control channel packets from ncftp have the crlf sequence at the
end of the port command.  in the control channel packets from ftp, the
crlf is missing, and appears in a subsequent packet.  ipnat doesn't
"notice" the port command (presumably because of this) and doesn't
rewrite the port command to account for the nat.

imho, it should still rewrite it.

arguably, this could be considered a bug in the linux ftp program
(wherever that came from), but i still think it's a shortcoming in
ipnat.

>How-To-Repeat:

um...get a cable modem, get 1.4_alpha (the fact that it's a sparc
doesn't matter much (i don't think)), set up nat, and make your own
connection to an ftp server somewhere such that you can send the port
command and the crlf sequence in different packets, and finally look
at the packets.

>Fix:

i only wish i knew.  <sigh>
>Audit-Trail:
>Unformatted: