Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Aug 2008 09:41:19 GMT
From:      Gleb Kurtsou <gk@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 146440 for review
Message-ID:  <200808020941.m729fJFG084693@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=146440

Change 146440 by gk@gk_h1 on 2008/08/02 09:40:50

	ifc

Affected files ...

.. //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifconfig.8#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifieee80211.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sbin-ipfw/ipfw.8#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/bpf.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/bpfdesc.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if.h#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_loop.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-net/if_media.h#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_divert.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_fw2.c#12 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/raw_ip.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp.h#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_asconf.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_bsd_addr.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_constants.h#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_input.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_output.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_pcb.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_pcb.h#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_timer.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_usrreq.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_var.h#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/sctputil.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_input.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_output.c#3 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_syncache.c#4 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_usrreq.c#2 integrate
.. //depot/projects/soc2008/gk_l2filter/sys-netinet/tcp_var.h#2 integrate

Differences ...

==== //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifconfig.8#4 (text+ko) ====

@@ -26,9 +26,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     From: @(#)ifconfig.8	8.3 (Berkeley) 1/5/94
-.\" $FreeBSD: src/sbin/ifconfig/ifconfig.8,v 1.148 2008/06/20 17:26:34 thompsa Exp $
+.\" $FreeBSD: src/sbin/ifconfig/ifconfig.8,v 1.149 2008/07/30 16:22:52 sam Exp $
 .\"
-.Dd June 20, 2008
+.Dd July 30, 2008
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -869,13 +869,11 @@
 depends on the region your adaptor was manufactured for.
 Setting
 the channel to
-.Li 0 ,
-.Cm any ,
+.Li any ,
 or
 .Cm -
-will give you the default for your adaptor.
-Some
-adapters ignore this setting unless you are in ad-hoc mode.
+will clear any desired channel and, if the device is marked up,
+force a scan for a channel to operate on.
 Alternatively the frequency, in megahertz, may be specified
 instead of the channel number.
 .Pp

==== //depot/projects/soc2008/gk_l2filter/sbin-ifconfig/ifieee80211.c#3 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sbin/ifconfig/ifieee80211.c,v 1.52 2008/06/23 16:08:40 thompsa Exp $
+ * $FreeBSD: src/sbin/ifconfig/ifieee80211.c,v 1.53 2008/08/01 01:27:52 sam Exp $
  */
 
 /*-
@@ -3064,9 +3064,9 @@
 }
 
 #define	IEEE80211_C_BITS \
-	"\20\7FF\10TURBOP\11IBSS\12PMGT" \
+	"\20\1STA\7FF\10TURBOP\11IBSS\12PMGT" \
 	"\13HOSTAP\14AHDEMO\15SWRETRY\16TXPMGT\17SHSLOT\20SHPREAMBLE" \
-	"\21MONITOR\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \
+	"\21MONITOR\22DFS\30WPA1\31WPA2\32BURST\33WME\34WDS\36BGSCAN" \
 	"\37TXFRAG"
 
 #define	IEEE80211_CRYPTO_BITS \

==== //depot/projects/soc2008/gk_l2filter/sbin-ipfw/ipfw.8#4 (text+ko) ====

@@ -1,5 +1,5 @@
 .\"
-.\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.213 2008/07/24 18:39:36 julian Exp $
+.\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.215 2008/08/01 23:31:28 julian Exp $
 .\"
 .Dd November 26, 2007
 .Dt IPFW 8
@@ -815,12 +815,20 @@
 Discard packets that match this rule, and if the
 packet is a TCP packet, try to send a TCP reset (RST) notice.
 The search terminates.
-.It Cm skipto Ar number
+.It Cm skipto Ar number | tablearg
 Skip all subsequent rules numbered less than
 .Ar number .
 The search continues with the first rule numbered
 .Ar number
 or higher.
+It is possible to use the 
+.Cm tablearg
+keyword with a skipto for a 
+.Em computed
+skipto, but care should be used, as no destination caching
+is possible in this case so the rules are always walked to find it,
+starting from the 
+.Cm skipto .
 .It Cm tee Ar port
 Send a copy of packets matching this rule to the
 .Xr divert 4
@@ -1628,10 +1636,12 @@
 feature provides the ability to use a value, looked up in the table, as
 the argument for a rule action, action parameter or rule option.
 This can significantly reduce number of rules in some configurations.
+If two tables are used in a rule, the result of the second (destination)
+is used.
 The
 .Cm tablearg
 argument can be used with the following actions:
-.Cm nat, pipe , queue, divert, tee, netgraph, ngtee, fwd
+.Cm nat, pipe , queue, divert, tee, netgraph, ngtee, fwd, skipto
 action parameters:
 .Cm tag, untag,
 rule options:
@@ -1644,6 +1654,12 @@
 See the
 .Sx EXAMPLES
 Section for example usage of tables and the tablearg keyword.
+.Pp
+When used with the
+.Cm skipto
+action, the user should be aware that the code will walk the ruleset
+up to a rule equal to, or past, the given number, and should therefore try keep the
+ruleset compact between the skipto and the target rules. 
 .Sh SETS OF RULES
 Each rule belongs to one of 32 different
 .Em sets

==== //depot/projects/soc2008/gk_l2filter/sys-net/bpf.c#4 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net/bpf.c,v 1.198 2008/07/14 22:41:48 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/net/bpf.c,v 1.199 2008/08/01 21:38:46 csjp Exp $");
 
 #include "opt_bpf.h"
 #include "opt_mac.h"
@@ -1583,6 +1583,12 @@
 	LIST_FOREACH(d, &bp->bif_dlist, bd_next) {
 		BPFD_LOCK(d);
 		++d->bd_rcount;
+		/*
+		 * NB: We dont call BPF_CHECK_DIRECTION() here since there is no
+		 * way for the caller to indiciate to us whether this packet
+		 * is inbound or outbound.  In the bpf_mtap() routines, we use
+		 * the interface pointers on the mbuf to figure it out.
+		 */
 #ifdef BPF_JITTER
 		if (bpf_jitter_enable != 0 && d->bd_bfilter != NULL)
 			slen = (*(d->bd_bfilter->func))(pkt, pktlen, pktlen);

==== //depot/projects/soc2008/gk_l2filter/sys-net/bpfdesc.h#2 (text+ko) ====

@@ -33,7 +33,7 @@
  *
  *      @(#)bpfdesc.h	8.1 (Berkeley) 6/10/93
  *
- * $FreeBSD: src/sys/net/bpfdesc.h,v 1.39 2008/03/24 13:49:17 csjp Exp $
+ * $FreeBSD: src/sys/net/bpfdesc.h,v 1.40 2008/08/01 22:08:14 antoine Exp $
  */
 
 #ifndef _NET_BPFDESC_H_
@@ -108,7 +108,7 @@
 
 #define BPFD_LOCK(bd)		mtx_lock(&(bd)->bd_mtx)
 #define BPFD_UNLOCK(bd)		mtx_unlock(&(bd)->bd_mtx)
-#define BPFD_LOCK_ASSERT(bd)	mtx_assert(&(bd)->bd_mtx, MA_OWNED);
+#define BPFD_LOCK_ASSERT(bd)	mtx_assert(&(bd)->bd_mtx, MA_OWNED)
 
 /*
  * External representation of the bpf descriptor

==== //depot/projects/soc2008/gk_l2filter/sys-net/if.h#3 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)if.h	8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/net/if.h,v 1.113 2008/03/27 18:02:30 iedowse Exp $
+ * $FreeBSD: src/sys/net/if.h,v 1.114 2008/07/30 21:01:51 jhb Exp $
  */
 
 #ifndef _NET_IF_H_
@@ -376,7 +376,7 @@
 #define	ifc_req	ifc_ifcu.ifcu_req	/* array of structures returned */
 };
 
-#if defined (__amd64__) || defined (COMPAT_32BIT)
+#if defined (__amd64__)
 struct ifconf32 {
 	int	ifc_len;		/* size of associated buffer */
 	union {

==== //depot/projects/soc2008/gk_l2filter/sys-net/if_loop.c#3 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)if_loop.c	8.2 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/net/if_loop.c,v 1.117 2008/06/29 13:17:01 ed Exp $
+ * $FreeBSD: src/sys/net/if_loop.c,v 1.118 2008/08/01 09:41:45 rwatson Exp $
  */
 
 /*
@@ -237,7 +237,7 @@
 		if (bpf_peers_present(loif->if_bpf)) {
 			if ((m->m_flags & M_MCAST) == 0 || loif == ifp) {
 				/* XXX beware sizeof(af) != 4 */
-				u_int32_t af1 = af;	
+				u_int32_t af1 = af;
 
 				/*
 				 * We need to prepend the address family.

==== //depot/projects/soc2008/gk_l2filter/sys-net/if_media.h#2 (text+ko) ====

@@ -1,5 +1,5 @@
 /*	$NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $	*/
-/* $FreeBSD: src/sys/net/if_media.h,v 1.42 2008/04/20 16:17:44 antoine Exp $ */
+/* $FreeBSD: src/sys/net/if_media.h,v 1.43 2008/08/01 22:13:39 antoine Exp $ */
 
 /*-
  * Copyright (c) 1997
@@ -343,7 +343,7 @@
 	{ IFM_1000_SX,	"1000baseSX" },					\
 	{ IFM_1000_LX,	"1000baseLX" },					\
 	{ IFM_1000_CX,	"1000baseCX" },					\
-	{ IFM_1000_T,	"1000baseTX" },					\
+	{ IFM_1000_T,	"1000baseT" },					\
 	{ IFM_HPNA_1,	"homePNA" },					\
 	{ IFM_10G_LR,	"10Gbase-LR" },					\
 	{ IFM_10G_SR,	"10Gbase-SR" },					\
@@ -368,7 +368,7 @@
 	{ IFM_1000_SX,	"1000SX" },					\
 	{ IFM_1000_LX,	"1000LX" },					\
 	{ IFM_1000_CX,	"1000CX" },					\
-	{ IFM_1000_T,	"1000baseT" },					\
+	{ IFM_1000_T,	"1000baseTX" },					\
 	{ IFM_1000_T,	"1000TX" },					\
 	{ IFM_1000_T,	"1000T" },					\
 	{ IFM_2500_SX,	"2500SX" },					\

==== //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_divert.c#2 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/ip_divert.c,v 1.133 2008/04/21 12:03:59 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/ip_divert.c,v 1.134 2008/07/27 20:48:22 mav Exp $");
 
 #if !defined(KLD_MODULE)
 #include "opt_inet.h"
@@ -268,9 +268,9 @@
 	nport = htons((u_int16_t)divert_info(mtag));
 	INP_INFO_RLOCK(&divcbinfo);
 	LIST_FOREACH(inp, &divcb, inp_list) {
-		INP_RLOCK(inp);
 		/* XXX why does only one socket match? */
 		if (inp->inp_lport == nport) {
+			INP_RLOCK(inp);
 			sa = inp->inp_socket;
 			SOCKBUF_LOCK(&sa->so_rcv);
 			if (sbappendaddr_locked(&sa->so_rcv,
@@ -283,7 +283,6 @@
 			INP_RUNLOCK(inp);
 			break;
 		}
-		INP_RUNLOCK(inp);
 	}
 	INP_INFO_RUNLOCK(&divcbinfo);
 	if (sa == NULL) {

==== //depot/projects/soc2008/gk_l2filter/sys-netinet/ip_fw2.c#12 (text+ko) ====

@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/ip_fw2.c,v 1.186 2008/05/09 23:02:57 julian Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/ip_fw2.c,v 1.187 2008/08/01 22:21:03 julian Exp $");
 
 #define        DEB(x)
 #define        DDB(x) x
@@ -1776,10 +1776,11 @@
  */
 
 static struct ip_fw *
-lookup_next_rule(struct ip_fw *me)
+lookup_next_rule(struct ip_fw *me, u_int32_t tablearg)
 {
 	struct ip_fw *rule = NULL;
 	ipfw_insn *cmd;
+	u_int16_t	rulenum;
 
 	/* look for action, in case it is a skipto */
 	cmd = ACTION_PTR(me);
@@ -1789,10 +1790,18 @@
 		cmd += F_LEN(cmd);
 	if (cmd->opcode == O_TAG)
 		cmd += F_LEN(cmd);
-	if ( cmd->opcode == O_SKIPTO )
-		for (rule = me->next; rule ; rule = rule->next)
-			if (rule->rulenum >= cmd->arg1)
+	if (cmd->opcode == O_SKIPTO ) {
+		if (tablearg != 0) {
+			rulenum = (u_int16_t)tablearg;
+		} else {
+			rulenum = cmd->arg1;
+		}
+		for (rule = me->next; rule ; rule = rule->next) {
+			if (rule->rulenum >= rulenum) {
 				break;
+			}
+		}
+	}
 	if (rule == NULL)			/* failure or not a skipto */
 		rule = me->next;
 	me->next_rule = rule;
@@ -2527,7 +2536,7 @@
 
 		f = args->rule->next_rule;
 		if (f == NULL)
-			f = lookup_next_rule(args->rule);
+			f = lookup_next_rule(args->rule, 0);
 	} else {
 		/*
 		 * Find the starting rule. It can be either the first
@@ -3286,9 +3295,13 @@
 				if (cmd->opcode == O_COUNT)
 					goto next_rule;
 				/* handle skipto */
-				if (f->next_rule == NULL)
-					lookup_next_rule(f);
-				f = f->next_rule;
+				if (cmd->arg1 == IP_FW_TABLEARG) {
+					f = lookup_next_rule(f, tablearg);
+				} else {
+					if (f->next_rule == NULL)
+						lookup_next_rule(f, 0);
+					f = f->next_rule;
+				}
 				goto again;
 
 			case O_REJECT:

==== //depot/projects/soc2008/gk_l2filter/sys-netinet/raw_ip.c#4 (text+ko) ====

@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/raw_ip.c,v 1.190 2008/07/26 21:12:00 mav Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/raw_ip.c,v 1.191 2008/07/28 06:57:28 mav Exp $");
 
 #include "opt_inet6.h"
 #include "opt_ipsec.h"
@@ -126,12 +126,13 @@
 	INP_INFO_WLOCK_ASSERT(pcbinfo);
 	INP_WLOCK_ASSERT(inp);
 	
-	if (inp->inp_ip_p && inp->inp_laddr.s_addr && inp->inp_faddr.s_addr) {
+	if (inp->inp_ip_p != 0 &&
+	    inp->inp_laddr.s_addr != INADDR_ANY &&
+	    inp->inp_faddr.s_addr != INADDR_ANY) {
 		hash = INP_PCBHASH_RAW(inp->inp_ip_p, inp->inp_laddr.s_addr,
 		    inp->inp_faddr.s_addr, pcbinfo->ipi_hashmask);
-	} else {
+	} else
 		hash = 0;
-	}
 	pcbhash = &pcbinfo->ipi_hashbase[hash];
 	LIST_INSERT_HEAD(pcbhash, inp, inp_hash);
 }
@@ -139,7 +140,10 @@
 static void
 rip_delhash(struct inpcb *inp)
 {
+
+	INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo);
 	INP_WLOCK_ASSERT(inp);
+
 	LIST_REMOVE(inp, inp_hash);
 }
 
@@ -708,6 +712,8 @@
 static void
 rip_dodisconnect(struct socket *so, struct inpcb *inp)
 {
+
+	INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo);
 	INP_WLOCK_ASSERT(inp);
 
 	rip_delhash(inp);

==== //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp.h#3 (text+ko) ====

@@ -30,7 +30,7 @@
 /* $KAME: sctp.h,v 1.18 2005/03/06 16:04:16 itojun Exp $	 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp.h,v 1.25 2008/06/14 07:58:05 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp.h,v 1.26 2008/07/31 11:08:30 rrs Exp $");
 
 #ifndef _NETINET_SCTP_H_
 #define _NETINET_SCTP_H_
@@ -110,6 +110,7 @@
 #define SCTP_CONTEXT                    0x0000001a	/* rw */
 /* explict EOR signalling */
 #define SCTP_EXPLICIT_EOR               0x0000001b
+#define SCTP_REUSE_PORT                 0x0000001c	/* rw */
 
 /*
  * read-only options
@@ -418,7 +419,6 @@
 #define SCTP_PCB_FLAGS_BOUNDALL		0x00000004
 #define SCTP_PCB_FLAGS_ACCEPTING	0x00000008
 #define SCTP_PCB_FLAGS_UNBOUND		0x00000010
-#define SCTP_PCB_FLAGS_LISTENING	0x00000020
 #define SCTP_PCB_FLAGS_CLOSE_IP         0x00040000
 #define SCTP_PCB_FLAGS_WAS_CONNECTED    0x00080000
 #define SCTP_PCB_FLAGS_WAS_ABORTED      0x00100000
@@ -449,7 +449,6 @@
 #define SCTP_PCB_FLAGS_DO_ASCONF	0x00000020
 #define SCTP_PCB_FLAGS_AUTO_ASCONF	0x00000040
 #define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE 0x00000080
-
 /* socket options */
 #define SCTP_PCB_FLAGS_NODELAY		0x00000100
 #define SCTP_PCB_FLAGS_AUTOCLOSE	0x00000200
@@ -467,7 +466,7 @@
 #define SCTP_PCB_FLAGS_EXPLICIT_EOR     0x00400000
 #define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4	0x00800000
 #define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS	0x01000000
-
+#define SCTP_PCB_FLAGS_PORTREUSE        0x02000000
 /*-
  * mobility_features parameters (by micchie).Note
  * these features are applied against the

==== //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_asconf.c#4 (text+ko) ====

@@ -31,7 +31,7 @@
 /* $KAME: sctp_asconf.c,v 1.24 2005/03/06 16:04:16 itojun Exp $	 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_asconf.c,v 1.38 2008/07/09 16:45:30 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_asconf.c,v 1.39 2008/07/29 09:06:35 rrs Exp $");
 #include <netinet/sctp_os.h>
 #include <netinet/sctp_var.h>
 #include <netinet/sctp_sysctl.h>
@@ -937,18 +937,13 @@
  */
 static uint32_t
 sctp_addr_match(
-#ifdef INET6
     struct sctp_ipv6addr_param *v6addr,
-#else
-    struct sctp_ipv4addr_param *v4addr,
-#endif
     struct sockaddr *sa)
 {
 	uint16_t param_type, param_length;
+	struct sctp_ipv4addr_param *v4addr = (struct sctp_ipv4addr_param *)v6addr;
 
 #ifdef INET6
-	struct sctp_ipv4addr_param *v4addr = (struct sctp_ipv4addr_param *)v6addr;
-
 	if (sa->sa_family == AF_INET6) {
 		/* IPv6 sa address */
 		/* XXX scopeid */
@@ -963,8 +958,8 @@
 		    sizeof(struct in6_addr)) == 0)) {
 			return (1);
 		}
-	} else
-#endif				/* INET6 */
+	}
+#endif
 	if (sa->sa_family == AF_INET) {
 		/* IPv4 sa address */
 		struct sockaddr_in *sin = (struct sockaddr_in *)sa;

==== //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_bsd_addr.c#4 (text+ko) ====

@@ -31,7 +31,7 @@
 /* $KAME: sctp_output.c,v 1.46 2005/03/06 16:04:17 itojun Exp $	 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_bsd_addr.c,v 1.20 2008/07/09 16:45:30 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_bsd_addr.c,v 1.22 2008/07/29 09:30:50 rrs Exp $");
 
 #include <netinet/sctp_os.h>
 #include <netinet/sctp_var.h>
@@ -95,6 +95,10 @@
 		msleep(&SCTP_BASE_INFO(iterator_running),
 		    &SCTP_BASE_INFO(ipi_iterator_wq_mtx),
 		    0, "waiting_for_work", 0);
+		if (SCTP_BASE_INFO(threads_must_exit)) {
+			kthread_exit(
+			    );
+		}
 		sctp_iterator_worker();
 	}
 }

==== //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_constants.h#3 (text+ko) ====

@@ -31,7 +31,7 @@
 /* $KAME: sctp_constants.h,v 1.17 2005/03/06 16:04:17 itojun Exp $	 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_constants.h,v 1.37 2008/07/09 16:45:30 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_constants.h,v 1.38 2008/07/29 09:06:35 rrs Exp $");
 
 #ifndef __sctp_constants_h__
 #define __sctp_constants_h__
@@ -382,8 +382,6 @@
 						 * hit this value) */
 #define SCTP_DATAGRAM_RESEND		4
 #define SCTP_DATAGRAM_ACKED		10010
-#define SCTP_DATAGRAM_INBOUND		10011
-#define SCTP_READY_TO_TRANSMIT		10012
 #define SCTP_DATAGRAM_MARKED		20010
 #define SCTP_FORWARD_TSN_SKIP		30010
 

==== //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_input.c#4 (text+ko) ====

@@ -31,7 +31,7 @@
 /* $KAME: sctp_input.c,v 1.27 2005/03/06 16:04:17 itojun Exp $	 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_input.c,v 1.73 2008/07/09 16:45:30 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_input.c,v 1.74 2008/07/29 09:06:35 rrs Exp $");
 
 #include <netinet/sctp_os.h>
 #include <netinet/sctp_var.h>
@@ -323,7 +323,7 @@
 	asoc->str_reset_seq_in = asoc->asconf_seq_in + 1;
 
 	asoc->mapping_array_base_tsn = ntohl(init->initial_tsn);
-	asoc->cumulative_tsn = asoc->asconf_seq_in;
+	asoc->tsn_last_delivered = asoc->cumulative_tsn = asoc->asconf_seq_in;
 	asoc->last_echo_tsn = asoc->asconf_seq_in;
 	asoc->advanced_peer_ack_point = asoc->last_acked_seq;
 	/* open the requested streams */
@@ -3293,7 +3293,7 @@
 					if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) {
 						sctp_log_map(0, 7, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
 					}
-					stcb->asoc.cumulative_tsn = stcb->asoc.highest_tsn_inside_map;
+					stcb->asoc.tsn_last_delivered = stcb->asoc.cumulative_tsn = stcb->asoc.highest_tsn_inside_map;
 					stcb->asoc.mapping_array_base_tsn = ntohl(resp->senders_next_tsn);
 					memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size);
 					stcb->asoc.sending_seq = ntohl(resp->receivers_next_tsn);
@@ -3399,7 +3399,7 @@
 		if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) {
 			sctp_log_map(0, 10, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
 		}
-		stcb->asoc.cumulative_tsn = stcb->asoc.highest_tsn_inside_map;
+		stcb->asoc.tsn_last_delivered = stcb->asoc.cumulative_tsn = stcb->asoc.highest_tsn_inside_map;
 		stcb->asoc.mapping_array_base_tsn = stcb->asoc.highest_tsn_inside_map + 1;
 		memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size);
 		atomic_add_int(&stcb->asoc.sending_seq, 1);

==== //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_output.c#4 (text+ko) ====

@@ -31,7 +31,7 @@
 /* $KAME: sctp_output.c,v 1.46 2005/03/06 16:04:17 itojun Exp $	 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_output.c,v 1.73 2008/07/09 16:45:30 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_output.c,v 1.74 2008/07/31 11:08:30 rrs Exp $");
 
 #include <netinet/sctp_os.h>
 #include <sys/proc.h>
@@ -11718,7 +11718,13 @@
 	struct sctp_inpcb *inp;
 	int error, use_rcvinfo = 0;
 	struct sctp_sndrcvinfo srcv;
+	struct sockaddr *addr_to_use;
+
+#ifdef INET6
+	struct sockaddr_in sin;
 
+#endif
+
 	inp = (struct sctp_inpcb *)so->so_pcb;
 	if (control) {
 		/* process cmsg snd/rcv info (maybe a assoc-id) */
@@ -11728,7 +11734,19 @@
 			use_rcvinfo = 1;
 		}
 	}
-	error = sctp_lower_sosend(so, addr, uio, top,
+	addr_to_use = addr;
+#ifdef INET6
+	if ((addr) && (addr->sa_family == AF_INET6)) {
+		struct sockaddr_in6 *sin6;
+
+		sin6 = (struct sockaddr_in6 *)addr;
+		if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
+			in6_sin6_2_sin(&sin, sin6);
+			addr_to_use = (struct sockaddr *)&sin;
+		}
+	}
+#endif
+	error = sctp_lower_sosend(so, addr_to_use, uio, top,
 	    control,
 	    flags,
 	    use_rcvinfo, &srcv

==== //depot/projects/soc2008/gk_l2filter/sys-netinet/sctp_pcb.c#4 (text+ko) ====

@@ -31,7 +31,7 @@
 /* $KAME: sctp_pcb.c,v 1.38 2005/03/06 16:04:18 itojun Exp $	 */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/netinet/sctp_pcb.c,v 1.71 2008/07/09 16:45:30 rrs Exp $");
+__FBSDID("$FreeBSD: src/sys/netinet/sctp_pcb.c,v 1.72 2008/07/31 11:08:30 rrs Exp $");
 
 #include <netinet/sctp_os.h>
 #include <sys/proc.h>
@@ -860,8 +860,7 @@
 	} else {
 		return NULL;
 	}
-	ephead = &SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR(
-	    (lport + rport), SCTP_BASE_INFO(hashtcpmark))];
+	ephead = &SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR((lport), SCTP_BASE_INFO(hashtcpmark))];
 	/*
 	 * Ok now for each of the guys in this bucket we must look and see:
 	 * - Does the remote port match. - Does there single association's
@@ -1432,6 +1431,7 @@
 		/* unsupported family */
 		return (NULL);
 	}
+
 	if (head == NULL)
 		return (NULL);
 	LIST_FOREACH(inp, head, sctp_hash) {
@@ -1468,7 +1468,6 @@
 		}
 		SCTP_INP_RUNLOCK(inp);
 	}
-
 	if ((nam->sa_family == AF_INET) &&
 	    (sin->sin_addr.s_addr == INADDR_ANY)) {
 		/* Can't hunt for one that has no address specified */
@@ -1555,6 +1554,106 @@
 	return (NULL);
 }
 
+
+static struct sctp_inpcb *
+sctp_isport_inuse(struct sctp_inpcb *inp, uint16_t lport, uint32_t vrf_id)
+{
+	struct sctppcbhead *head;
+	struct sctp_inpcb *t_inp;
+	int fnd;
+
+	head = &SCTP_BASE_INFO(sctp_ephash)[SCTP_PCBHASH_ALLADDR(lport,
+	    SCTP_BASE_INFO(hashmark))];
+	LIST_FOREACH(t_inp, head, sctp_hash) {
+		if (t_inp->sctp_lport != lport) {
+			continue;
+		}
+		/* is it in the VRF in question */
+		fnd = 0;
+		if (t_inp->def_vrf_id == vrf_id)
+			fnd = 1;
+		if (!fnd)
+			continue;
+
+		/* This one is in use. */
+		/* check the v6/v4 binding issue */
+		if ((t_inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
+		    SCTP_IPV6_V6ONLY(t_inp)) {
+			if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
+				/* collision in V6 space */
+				return (t_inp);
+			} else {
+				/* inp is BOUND_V4 no conflict */
+				continue;
+			}
+		} else if (t_inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
+			/* t_inp is bound v4 and v6, conflict always */
+			return (t_inp);
+		} else {
+			/* t_inp is bound only V4 */
+			if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
+			    SCTP_IPV6_V6ONLY(inp)) {
+				/* no conflict */
+				continue;
+			}
+			/* else fall through to conflict */
+		}
+		return (t_inp);
+	}
+	return (NULL);
+}
+
+
+int
+sctp_swap_inpcb_for_listen(struct sctp_inpcb *inp)
+{
+	/* For 1-2-1 with port reuse */
+	struct sctppcbhead *head;
+	struct sctp_inpcb *tinp;
+
+	if (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_PORTREUSE)) {
+		/* only works with port reuse on */
+		return (-1);
+	}
+	if ((inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) == 0) {
+		return (0);
+	}
+	SCTP_INP_RUNLOCK(inp);
+	head = &SCTP_BASE_INFO(sctp_ephash)[SCTP_PCBHASH_ALLADDR(inp->sctp_lport,
+	    SCTP_BASE_INFO(hashmark))];
+	/* Kick out all non-listeners to the TCP hash */
+	LIST_FOREACH(tinp, head, sctp_hash) {
+		if (tinp->sctp_lport != inp->sctp_lport) {
+			continue;
+		}
+		if (tinp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) {
+			continue;
+		}
+		if (tinp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) {
+			continue;
+		}
+		if (tinp->sctp_socket->so_qlimit) {
+			continue;
+		}
+		SCTP_INP_WLOCK(tinp);
+		LIST_REMOVE(tinp, sctp_hash);
+		head = &SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR(tinp->sctp_lport, SCTP_BASE_INFO(hashtcpmark))];
+		tinp->sctp_flags |= SCTP_PCB_FLAGS_IN_TCPPOOL;
+		LIST_INSERT_HEAD(head, tinp, sctp_hash);
+		SCTP_INP_WUNLOCK(tinp);
+	}
+	SCTP_INP_WLOCK(inp);
+	/* Pull from where he was */
+	LIST_REMOVE(inp, sctp_hash);
+	inp->sctp_flags &= ~SCTP_PCB_FLAGS_IN_TCPPOOL;
+	head = &SCTP_BASE_INFO(sctp_ephash)[SCTP_PCBHASH_ALLADDR(inp->sctp_lport, SCTP_BASE_INFO(hashmark))];
+	LIST_INSERT_HEAD(head, inp, sctp_hash);
+	SCTP_INP_WUNLOCK(inp);
+	SCTP_INP_RLOCK(inp);
+	return (0);
+}
+
+
 struct sctp_inpcb *
 sctp_pcb_findep(struct sockaddr *nam, int find_tcp_pool, int have_lock,
     uint32_t vrf_id)
@@ -1600,24 +1699,8 @@
 	 * further code to look at all TCP models.
 	 */
 	if (inp == NULL && find_tcp_pool) {
-		unsigned int i;
-
-		for (i = 0; i < SCTP_BASE_INFO(hashtblsize); i++) {
-			/*
-			 * This is real gross, but we do NOT have a remote
-			 * port at this point depending on who is calling.
-			 * We must therefore look for ANY one that matches
-			 * our local port :/
-			 */
-			head = &SCTP_BASE_INFO(sctp_tcpephash)[i];
-			if (LIST_FIRST(head)) {
-				inp = sctp_endpoint_probe(nam, head, lport, vrf_id);
-				if (inp) {
-					/* Found one */
-					break;
-				}
-			}
-		}
+		head = &SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR(lport, SCTP_BASE_INFO(hashtcpmark))];
+		inp = sctp_endpoint_probe(nam, head, lport, vrf_id);
 	}
 	if (inp) {
 		SCTP_INP_INCR_REF(inp);
@@ -2383,7 +2466,7 @@
 	LIST_REMOVE(stcb, sctp_tcblist);
 
 	/* Now insert the new_inp into the TCP connected hash */
-	head = &SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR((lport + rport),
+	head = &SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR((lport),
 	    SCTP_BASE_INFO(hashtcpmark))];
 
 	LIST_INSERT_HEAD(head, new_inp, sctp_hash);
@@ -2456,54 +2539,7 @@
 	SCTP_INP_WUNLOCK(old_inp);
 }
 
-static int
-sctp_isport_inuse(struct sctp_inpcb *inp, uint16_t lport, uint32_t vrf_id)
-{
-	struct sctppcbhead *head;
-	struct sctp_inpcb *t_inp;
-	int fnd;
-
-	head = &SCTP_BASE_INFO(sctp_ephash)[SCTP_PCBHASH_ALLADDR(lport,
-	    SCTP_BASE_INFO(hashmark))];
-	LIST_FOREACH(t_inp, head, sctp_hash) {
-		if (t_inp->sctp_lport != lport) {
-			continue;
-		}
-		/* is it in the VRF in question */
-		fnd = 0;
-		if (t_inp->def_vrf_id == vrf_id)
-			fnd = 1;
-		if (!fnd)
-			continue;
 
-		/* This one is in use. */
-		/* check the v6/v4 binding issue */
-		if ((t_inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
-		    SCTP_IPV6_V6ONLY(t_inp)) {
-			if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
-				/* collision in V6 space */
-				return (1);
-			} else {
-				/* inp is BOUND_V4 no conflict */
-				continue;
-			}
-		} else if (t_inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
-			/* t_inp is bound v4 and v6, conflict always */
-			return (1);
-		} else {
-			/* t_inp is bound only V4 */
-			if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
-			    SCTP_IPV6_V6ONLY(inp)) {
-				/* no conflict */
-				continue;
-			}
-			/* else fall through to conflict */
-		}
-		return (1);
-	}
-	return (0);
-}
-
 
 
 /* sctp_ifap is used to bypass normal local address validation checks */
@@ -2515,6 +2551,7 @@
 	struct sctppcbhead *head;
 	struct sctp_inpcb *inp, *inp_tmp;
 	struct inpcb *ip_inp;
+	int port_reuse_active = 0;
 	int bindall;
 	int prison = 0;
 	uint16_t lport;
@@ -2664,8 +2701,17 @@
 				 * so we must lower it.
 				 */
 				SCTP_INP_DECR_REF(inp_tmp);
+				/* unlock info */
+				if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) &&
+				    (sctp_is_feature_on(inp_tmp, SCTP_PCB_FLAGS_PORTREUSE))) {
+					/*
+					 * Ok, must be one-2-one and
+					 * allowing port re-use
+					 */
+					port_reuse_active = 1;
+					goto continue_anyway;
+				}
 				SCTP_INP_DECR_REF(inp);
-				/* unlock info */
 				SCTP_INP_INFO_WUNLOCK();
 				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EADDRINUSE);
 				return (EADDRINUSE);
@@ -2681,23 +2727,40 @@
 				 * so we must lower it.
 				 */
 				SCTP_INP_DECR_REF(inp_tmp);
+				/* unlock info */
+				if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) &&
+				    (sctp_is_feature_on(inp_tmp, SCTP_PCB_FLAGS_PORTREUSE))) {
+					/*
+					 * Ok, must be one-2-one and
+					 * allowing port re-use
+					 */
+					port_reuse_active = 1;
+					goto continue_anyway;
+				}
 				SCTP_INP_DECR_REF(inp);
-				/* unlock info */
 				SCTP_INP_INFO_WUNLOCK();
 				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EADDRINUSE);
 				return (EADDRINUSE);
 			}
 		}
+continue_anyway:
 		SCTP_INP_WLOCK(inp);
 		if (bindall) {
 			/* verify that no lport is not used by a singleton */
-			if (sctp_isport_inuse(inp, lport, vrf_id)) {
+			if ((port_reuse_active == 0) &&
+			    (inp_tmp = sctp_isport_inuse(inp, lport, vrf_id))
+			    ) {
 				/* Sorry someone already has this one bound */
-				SCTP_INP_DECR_REF(inp);
-				SCTP_INP_WUNLOCK(inp);
-				SCTP_INP_INFO_WUNLOCK();
-				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EADDRINUSE);
-				return (EADDRINUSE);
+				if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) &&
+				    (sctp_is_feature_on(inp_tmp, SCTP_PCB_FLAGS_PORTREUSE))) {
+					port_reuse_active = 1;
+				} else {
+					SCTP_INP_DECR_REF(inp);
+					SCTP_INP_WUNLOCK(inp);
+					SCTP_INP_INFO_WUNLOCK();
+					SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PCB, EADDRINUSE);
+					return (EADDRINUSE);
+				}
 			}
 		}
 	} else {
@@ -2736,7 +2799,7 @@
 
 		done = 0;
 		while (!done) {
-			if (sctp_isport_inuse(inp, htons(candidate), inp->def_vrf_id) == 0) {
+			if (sctp_isport_inuse(inp, htons(candidate), inp->def_vrf_id) == NULL) {
 				done = 1;
 			}
 			if (!done) {
@@ -2884,12 +2947,19 @@
 		inp->laddr_count++;
 	}
 	/* find the bucket */
-	head = &SCTP_BASE_INFO(sctp_ephash)[SCTP_PCBHASH_ALLADDR(lport,
-	    SCTP_BASE_INFO(hashmark))];
+	if (port_reuse_active) {
+		/* Put it into tcp 1-2-1 hash */
+		head = &SCTP_BASE_INFO(sctp_tcpephash)[SCTP_PCBHASH_ALLADDR((lport),
+		    SCTP_BASE_INFO(hashtcpmark))];
+		inp->sctp_flags |= SCTP_PCB_FLAGS_IN_TCPPOOL;
+	} else {
+		head = &SCTP_BASE_INFO(sctp_ephash)[SCTP_PCBHASH_ALLADDR(lport,
+		    SCTP_BASE_INFO(hashmark))];
+	}
 	/* put it in the bucket */
 	LIST_INSERT_HEAD(head, inp, sctp_hash);
-	SCTPDBG(SCTP_DEBUG_PCB1, "Main hash to bind at head:%p, bound port:%d\n",
-	    head, ntohs(lport));
+	SCTPDBG(SCTP_DEBUG_PCB1, "Main hash to bind at head:%p, bound port:%d - in tcp_pool=%d\n",
+	    head, ntohs(lport), port_reuse_active);
 	/* set in the port */
 	inp->sctp_lport = lport;
 
@@ -3834,7 +3904,9 @@
 		return (NULL);
 	}
 	SCTP_INP_RLOCK(inp);
-	if (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) {
+	if ((inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) &&
+	    ((sctp_is_feature_off(inp, SCTP_PCB_FLAGS_PORTREUSE)) ||
+	    (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED))) {
 		/*
 		 * If its in the TCP pool, its NOT allowed to create an
 		 * association. The parent listener needs to call
@@ -5639,6 +5711,7 @@
 					 * we must validate the state again
 					 * here
 					 */
+			add_it_now:
 					if (stcb->asoc.state == 0) {
 						/* the assoc was freed? */

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808020941.m729fJFG084693>