Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Resolve conflicts.
details: https://anonhg.NetBSD.org/src/rev/4366b6d97b4f
branches: trunk
changeset: 486418:4366b6d97b4f
user: veego <veego%NetBSD.org@localhost>
date: Sun May 21 18:45:53 2000 +0000
description:
Resolve conflicts.
diffstat:
sys/netinet/fil.c | 36 +++++++++++++++++++++++++++---------
sys/netinet/ip_fil.c | 18 +++++++++---------
sys/netinet/ip_ftp_pxy.c | 17 +++++------------
sys/netinet/ip_nat.c | 40 +++++++++++++++++++++++++---------------
sys/netinet/ip_nat.h | 6 ++++--
sys/netinet/ip_state.c | 23 ++++++++++++++++-------
sys/netinet/ipl.h | 6 +++---
7 files changed, 89 insertions(+), 57 deletions(-)
diffs (truncated from 438 to 300 lines):
diff -r 9ef289d82ad2 -r 4366b6d97b4f sys/netinet/fil.c
--- a/sys/netinet/fil.c Sun May 21 18:37:27 2000 +0000
+++ b/sys/netinet/fil.c Sun May 21 18:45:53 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fil.c,v 1.33 2000/05/11 19:46:05 veego Exp $ */
+/* $NetBSD: fil.c,v 1.34 2000/05/21 18:45:53 veego Exp $ */
/*
* Copyright (C) 1993-2000 by Darren Reed.
@@ -9,10 +9,11 @@
*/
#if !defined(lint)
#if defined(__NetBSD__)
-static const char rcsid[] = "$NetBSD: fil.c,v 1.33 2000/05/11 19:46:05 veego Exp $";
+static const char rcsid[] = "$NetBSD: fil.c,v 1.34 2000/05/21 18:45:53 veego Exp $";
#else
static const char sccsid[] = "@(#)fil.c 1.36 6/5/96 (C) 1993-2000 Darren Reed";
static const char rcsid[] = "@(#)Id: fil.c,v 2.35.2.6 2000/05/09 22:42:40 darrenr Exp";
+static const char rcsid[] = "@(#)Id: fil.c,v 2.35.2.7 2000/05/11 12:28:18 darrenr Exp";
#endif
#endif
@@ -306,17 +307,33 @@
}
case IPPROTO_TCP :
fi->fi_fl |= FI_TCPUDP;
- if ((v == 4) && ((!IPMINLEN(ip, tcphdr) && !off) ||
- (off && off < sizeof(struct tcphdr))))
- fi->fi_fl |= FI_SHORT;
+#ifdef USE_INET6
+ if (v == 6) {
+ if (plen < sizeof(struct tcphdr))
+ fi->fi_fl |= FI_SHORT;
+ } else
+#endif
+ if (v == 4) {
+ if ((!IPMINLEN(ip, tcphdr) && !off) ||
+ (off && off < sizeof(struct tcphdr)))
+ fi->fi_fl |= FI_SHORT;
+ }
if (!(fi->fi_fl & FI_SHORT) && !off)
fin->fin_tcpf = tcp->th_flags;
goto getports;
case IPPROTO_UDP :
fi->fi_fl |= FI_TCPUDP;
- if ((v == 4) && ((!IPMINLEN(ip, udphdr) && !off) ||
- (off && off < sizeof(struct udphdr))))
- fi->fi_fl |= FI_SHORT;
+#ifdef USE_INET6
+ if (v == 6) {
+ if (plen < sizeof(struct udphdr))
+ fi->fi_fl |= FI_SHORT;
+ } else
+#endif
+ if (v == 4) {
+ if ((!IPMINLEN(ip, udphdr) && !off) ||
+ (off && off < sizeof(struct udphdr)))
+ fi->fi_fl |= FI_SHORT;
+ }
getports:
if (!off && (fin->fin_dlen > 3)) {
fin->fin_data[0] = ntohs(tcp->th_sport);
@@ -818,6 +835,7 @@
if ((out) && (v == 4))
ip->ip_id = ntohs(ip->ip_id);
+ changed = 0;
fin->fin_v = v;
fin->fin_ifp = ifp;
fin->fin_out = out;
@@ -1341,7 +1359,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94
- * Id: fil.c,v 2.35.2.6 2000/05/09 22:42:40 darrenr Exp
+ * Id: fil.c,v 2.35.2.7 2000/05/11 12:28:18 darrenr Exp
*/
/*
* Copy data from an mbuf chain starting "off" bytes from the beginning,
diff -r 9ef289d82ad2 -r 4366b6d97b4f sys/netinet/ip_fil.c
--- a/sys/netinet/ip_fil.c Sun May 21 18:37:27 2000 +0000
+++ b/sys/netinet/ip_fil.c Sun May 21 18:45:53 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_fil.c,v 1.50 2000/05/11 19:46:05 veego Exp $ */
+/* $NetBSD: ip_fil.c,v 1.51 2000/05/21 18:45:54 veego Exp $ */
/*
* Copyright (C) 1993-2000 by Darren Reed.
@@ -9,10 +9,11 @@
*/
#if !defined(lint)
#if defined(__NetBSD__)
-static const char rcsid[] = "$NetBSD: ip_fil.c,v 1.50 2000/05/11 19:46:05 veego Exp $";
+static const char rcsid[] = "$NetBSD: ip_fil.c,v 1.51 2000/05/21 18:45:54 veego Exp $";
#else
static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed";
static const char rcsid[] = "@(#)Id: ip_fil.c,v 2.42.2.4 2000/05/09 22:43:31 darrenr Exp";
+static const char rcsid[] = "@(#)Id: ip_fil.c,v 2.42.2.6 2000/05/13 07:46:49 darrenr Exp";
#endif
#endif
@@ -1015,25 +1016,20 @@
# ifdef USE_INET6
ip6 = (ip6_t *)ip;
# endif
+ bzero((char *)ip, sizeof(*tcp2) + hlen)
tcp2 = (struct tcphdr *)((char *)ip + hlen);
tcp2->th_sport = tcp->th_dport;
tcp2->th_dport = tcp->th_sport;
- tcp2->th_seq = 0;
tcp2->th_ack = ntohl(tcp->th_seq);
tcp2->th_ack += tlen;
tcp2->th_ack = htonl(tcp2->th_ack);
- tcp2->th_x2 = 0;
tcp2->th_off = sizeof(*tcp2) >> 2;
tcp2->th_flags = TH_RST|TH_ACK;
- tcp2->th_win = 0;
- tcp2->th_sum = 0;
# ifdef USE_INET6
if (fin->fin_v == 6) {
- ip6->ip6_flow = 0;
ip6->ip6_plen = htons(sizeof(struct tcphdr));
ip6->ip6_nxt = IPPROTO_TCP;
- ip6->ip6_hlim = 0;
ip6->ip6_src = oip6->ip6_dst;
ip6->ip6_dst = oip6->ip6_src;
tcp2->th_sum = in6_cksum(m, IPPROTO_TCP,
@@ -1071,6 +1067,7 @@
ip->ip_tos = oip->ip_tos;
ip->ip_len = len;
ip->ip_id = oip->ip_id;
+ ip->ip_off = 0;
# if (BSD < 199306) || defined(__sgi)
ip->ip_ttl = tcp_ttl;
# else
@@ -1388,7 +1385,10 @@
*/
if (ip->ip_len <= ifp->if_mtu) {
# if BSD >= 199306
- int i = m->m_flags & M_EXT;
+ int i = 0;
+
+ if ((m->m_flags & M_EXT) && MCLISREFERENCED(m))
+ i = 1;
# endif
# ifndef __NetBSD__
ip->ip_id = htons(ip->ip_id);
diff -r 9ef289d82ad2 -r 4366b6d97b4f sys/netinet/ip_ftp_pxy.c
--- a/sys/netinet/ip_ftp_pxy.c Sun May 21 18:37:27 2000 +0000
+++ b/sys/netinet/ip_ftp_pxy.c Sun May 21 18:45:53 2000 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: ip_ftp_pxy.c,v 1.15 2000/05/11 19:46:06 veego Exp $ */
+/* $NetBSD: ip_ftp_pxy.c,v 1.16 2000/05/21 18:45:54 veego Exp $ */
/*
* Simple FTP transparent proxy for in-kernel use. For use with the NAT
* code.
*
- * Id: ip_ftp_pxy.c,v 2.7.2.5 2000/05/09 11:41:46 darrenr Exp
+ * Id: ip_ftp_pxy.c,v 2.7.2.7 2000/05/13 14:28:14 darrenr Exp
*/
#if SOLARIS && defined(_KERNEL)
extern kmutex_t ipf_rw;
@@ -311,21 +311,14 @@
int dlen;
{
tcphdr_t *tcp, tcph, *tcp2 = &tcph;
- char *s;
struct in_addr swip, swip2;
u_short a5, a6, sp, dp;
u_int a1, a2, a3, a4;
-#if 0
- char newbuf[IPF_FTPBUFSZ];
- size_t nlen, olen;
- mb_t *m;
-#if SOLARIS
- mb_t *m1;
-#endif
-#endif
fr_info_t fi;
int inc, off;
nat_t *ipn;
+ char *s;
+
/*
* Check for PASV reply message.
*/
@@ -631,7 +624,7 @@
* apart from causing packets to go through here ordered).
*/
if (ntohl(tcp->th_seq) != f->ftps_seq + (wptr - rptr)) {
- return APR_ERR(-1);
+ return APR_ERR(0);
}
while (mlen > 0) {
diff -r 9ef289d82ad2 -r 4366b6d97b4f sys/netinet/ip_nat.c
--- a/sys/netinet/ip_nat.c Sun May 21 18:37:27 2000 +0000
+++ b/sys/netinet/ip_nat.c Sun May 21 18:45:53 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_nat.c,v 1.32 2000/05/11 19:46:06 veego Exp $ */
+/* $NetBSD: ip_nat.c,v 1.33 2000/05/21 18:45:54 veego Exp $ */
/*
* Copyright (C) 1995-2000 by Darren Reed.
@@ -11,10 +11,10 @@
*/
#if !defined(lint)
#if defined(__NetBSD__)
-static const char rcsid[] = "$NetBSD: ip_nat.c,v 1.32 2000/05/11 19:46:06 veego Exp $";
+static const char rcsid[] = "$NetBSD: ip_nat.c,v 1.33 2000/05/21 18:45:54 veego Exp $";
#else
static const char sccsid[] = "@(#)ip_nat.c 1.11 6/5/96 (C) 1995 Darren Reed";
-static const char rcsid[] = "@(#)Id: ip_nat.c,v 2.37.2.4 2000/05/06 12:29:48 darrenr Exp";
+static const char rcsid[] = "@(#)Id: ip_nat.c,v 2.37.2.10 2000/05/19 15:54:44 darrenr Exp";
#endif
#endif
@@ -234,7 +234,7 @@
}
-void nat_delrdr(n)
+static void nat_delrdr(n)
ipnat_t *n;
{
if (n->in_rnext)
@@ -434,11 +434,17 @@
{
#ifdef IPFILTER_LOG
case SIOCIPFFB :
+ {
+ int tmp;
+
if (!(mode & FWRITE))
error = EPERM;
- else
- *(int *)data = ipflog_clear(IPL_LOGNAT);
+ else {
+ tmp = ipflog_clear(IPL_LOGNAT);
+ IWCOPY((char *)&tmp, (char *)data, sizeof(tmp));
+ }
break;
+ }
#endif
case SIOCADNAT :
if (!(mode & FWRITE)) {
@@ -1095,8 +1101,10 @@
/* Give me a new nat */
KMALLOC(nat, nat_t *);
- if (nat == NULL)
+ if (nat == NULL) {
+ nat_stats.ns_memfail++;
return NULL;
+ }
bzero((char *)nat, sizeof(*nat));
nat->nat_flags = flags;
@@ -1168,7 +1176,7 @@
port += MAPBLK_MINPORT;
port = htons(port);
}
- } else if (!np->in_nip &&
+ } else if (!np->in_outip &&
(np->in_outmsk == 0xffffffff)) {
/*
* 0/32 - use the interface's IP address.
@@ -1177,7 +1185,7 @@
fr_ifpaddr(4, fin->fin_ifp, &in) == -1)
goto badnat;
in.s_addr = ntohl(in.s_addr);
- } else if (!np->in_nip && !np->in_outmsk) {
+ } else if (!np->in_outip && !np->in_outmsk) {
/*
* 0/0 - use the original source address/port.
*/
@@ -1398,6 +1406,7 @@
np->in_use++;
return nat;
badnat:
+ nat_stats.ns_badnat++;
if ((hm = nat->nat_hm) != NULL)
nat_hostmapdel(hm);
KFREE(nat);
@@ -1694,7 +1703,7 @@
}
-int nat_match(fin, np, ip)
+static int nat_match(fin, np, ip)
fr_info_t *fin;
ipnat_t *np;
ip_t *ip;
@@ -1890,8 +1899,8 @@
if (nat->nat_age < fr_defnaticmpage)
nat->nat_age = fr_defnaticmpage;
#ifdef LARGE_NAT
- else if (nat->nat_age > DEF_NAT_AGE)
Home |
Main Index |
Thread Index |
Old Index