I have similar satuation here with a NetBSD 1.5.1 stack.
3 line rules are like this:
$ cat ipnat.conf
map en0 12.0.0.0/8 -> 10.0.0.176/32 proxy port ftp ftp/tcp
map en0 12.0.0.0/8 -> 10.0.0.176/32 portmap tcp/udp 20000:40000
map en0 12.0.0.0/8 -> 10.0.0.176/32
It looks to me that if the internal address is "longer"
then the external address, the ftp proxy stopped working.
That is, if the "PORT" packet "shrink", returning inc < 0,
the ippf_ftp_process() can't do the right thing.
The Patch below seems fix the problem for me.
-xtang
*** /home/xtang/src/ip_fil3.4.27/ip_ftp_pxy.c Fri Apr 26 10:22:45 2002
--- ip_ftp_pxy.c Fri May 10 15:13:17 2002
***************
*** 766,776 ****
i = 0;
sel = nat->nat_aps->aps_sel[1 - rv];
if (rv) {
! if (nat->nat_aps->aps_ackmin[sel] > ntohl(tcp->th_seq))
! i = nat->nat_aps->aps_ackoff[sel];
} else {
! if (nat->nat_aps->aps_seqmin[sel] > ntohl(tcp->th_seq))
! i = nat->nat_aps->aps_seqoff[sel];
}
/*
* XXX - Ideally, this packet should get dropped because we now know
--- 766,774 ----
i = 0;
sel = nat->nat_aps->aps_sel[1 - rv];
if (rv) {
! i = nat->nat_aps->aps_ackoff[sel];
} else {
! i = nat->nat_aps->aps_seqoff[sel];
}
/*
* XXX - Ideally, this packet should get dropped because we now know
***************
*** 780,789 ****
if (f->ftps_len + f->ftps_seq == ntohl(tcp->th_seq))
f->ftps_seq = ntohl(tcp->th_seq);
else {
! inc = ntohl(tcp->th_seq) - f->ftps_seq;
! if (inc > i) {
! return APR_ERR(1);
! }
}
inc = 0;
f->ftps_len = mlen;
--- 778,785 ----
if (f->ftps_len + f->ftps_seq == ntohl(tcp->th_seq))
f->ftps_seq = ntohl(tcp->th_seq);
else {
! if (ntohl(tcp->th_seq) + i != f->ftps_seq)
! return APR_ERR(1);
}
inc = 0;
f->ftps_len = mlen;