summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_ftp_pxy.c
diff options
context:
space:
mode:
authordarrenr <darrenr@FreeBSD.org>2001-02-04 14:26:56 +0000
committerdarrenr <darrenr@FreeBSD.org>2001-02-04 14:26:56 +0000
commit48b4ca8e6a57c62a30178ad743504003bfd60b92 (patch)
treeb47e8b2fc77a6ae3122c2f25213a7861e67eee2f /sys/netinet/ip_ftp_pxy.c
parent53b25e2c4c7f67b0a0f4809050fb478bd1ff2d88 (diff)
downloadFreeBSD-src-48b4ca8e6a57c62a30178ad743504003bfd60b92.zip
FreeBSD-src-48b4ca8e6a57c62a30178ad743504003bfd60b92.tar.gz
fix conflicts
Diffstat (limited to 'sys/netinet/ip_ftp_pxy.c')
-rw-r--r--sys/netinet/ip_ftp_pxy.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/sys/netinet/ip_ftp_pxy.c b/sys/netinet/ip_ftp_pxy.c
index 42966fe..6e4fe53 100644
--- a/sys/netinet/ip_ftp_pxy.c
+++ b/sys/netinet/ip_ftp_pxy.c
@@ -1,6 +1,7 @@
/*
* Simple FTP transparent proxy for in-kernel use. For use with the NAT
* code.
+ *
* $FreeBSD$
*/
#if SOLARIS && defined(_KERNEL)
@@ -237,7 +238,7 @@ int dlen;
*/
dp = htons(fin->fin_data[1] - 1);
ipn = nat_outlookup(fin->fin_ifp, IPN_TCP, nat->nat_p, nat->nat_inip,
- ip->ip_dst, (dp << 16) | sp);
+ ip->ip_dst, (dp << 16) | sp, 0);
if (ipn == NULL) {
int slen;
@@ -253,7 +254,9 @@ int dlen;
fi.fin_data[1] = 0;
fi.fin_dlen = sizeof(*tcp2);
fi.fin_dp = (char *)tcp2;
+ fi.fin_fr = &natfr;
swip = ip->ip_src;
+ fi.fin_fi.fi_saddr = nat->nat_inip.s_addr;
ip->ip_src = nat->nat_inip;
ipn = nat_new(nat->nat_ptr, ip, &fi, IPN_TCP|FI_W_DPORT,
NAT_OUTBOUND);
@@ -455,7 +458,7 @@ int dlen;
sp = 0;
dp = htons(fin->fin_data[1] - 1);
ipn = nat_outlookup(fin->fin_ifp, IPN_TCP, nat->nat_p, nat->nat_inip,
- ip->ip_dst, (dp << 16) | sp);
+ ip->ip_dst, (dp << 16) | sp, 0);
if (ipn == NULL) {
int slen;
@@ -466,13 +469,16 @@ int dlen;
tcp2->th_win = htons(8192);
tcp2->th_sport = 0; /* XXX - fake it for nat_new */
tcp2->th_off = 5;
- fi.fin_data[0] = a5 << 8 | a6;
+ fi.fin_data[1] = a5 << 8 | a6;
fi.fin_dlen = sizeof(*tcp2);
- tcp2->th_dport = htons(fi.fin_data[0]);
- fi.fin_data[1] = 0;
+ tcp2->th_dport = htons(fi.fin_data[1]);
+ fi.fin_data[0] = 0;
fi.fin_dp = (char *)tcp2;
+ fi.fin_fr = &natfr;
swip = ip->ip_src;
swip2 = ip->ip_dst;
+ fi.fin_fi.fi_daddr = ip->ip_src.s_addr;
+ fi.fin_fi.fi_saddr = nat->nat_inip.s_addr;
ip->ip_dst = ip->ip_src;
ip->ip_src = nat->nat_inip;
ipn = nat_new(nat->nat_ptr, ip, &fi, IPN_TCP|FI_W_SPORT,
@@ -613,14 +619,18 @@ int rv;
#else
mlen = mbufchainlen(m) - off;
#endif
+
t = &ftp->ftp_side[1 - rv];
+ f = &ftp->ftp_side[rv];
if (!mlen) {
- t->ftps_seq = ntohl(tcp->th_ack);
+ if (!t->ftps_seq ||
+ (int)ntohl(tcp->th_ack) - (int)t->ftps_seq > 0)
+ t->ftps_seq = ntohl(tcp->th_ack);
+ f->ftps_len = 0;
return 0;
}
inc = 0;
- f = &ftp->ftp_side[rv];
rptr = f->ftps_rptr;
wptr = f->ftps_wptr;
@@ -634,9 +644,12 @@ int rv;
* that it is out of order (and there is no real danger in doing so
* apart from causing packets to go through here ordered).
*/
- if (ntohl(tcp->th_seq) + i != f->ftps_seq) {
+ 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);
}
+ f->ftps_len = mlen;
while (mlen > 0) {
len = MIN(mlen, FTP_BUFSZ / 2);
OpenPOWER on IntegriCloud