Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Dec 2008 19:00:25 GMT
From:      Paolo Pisati <piso@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 154350 for review
Message-ID:  <200812081900.mB8J0P0x008697@repoman.freebsd.org>

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

Change 154350 by piso@piso_newluxor on 2008/12/08 18:59:35

	fix kernel compilation

Affected files ...

.. //depot/projects/soc2005/libalias/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h#4 edit
.. //depot/projects/soc2005/libalias/sys/dev/cs/if_csvar.h#5 edit
.. //depot/projects/soc2005/libalias/sys/net/radix_mpath.h#5 edit
.. //depot/projects/soc2005/libalias/sys/netgraph/ng_nat.c#19 edit
.. //depot/projects/soc2005/libalias/sys/netinet/ip_fw_nat.c#14 edit
.. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#84 edit
.. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_db.c#35 edit
.. //depot/projects/soc2005/libalias/sys/netinet/tcp_subr.c#21 edit

Differences ...

==== //depot/projects/soc2005/libalias/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h#4 (text+ko) ====

@@ -17,6 +17,8 @@
  * information: Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
+ *
+ * $FreeBSD: src/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h,v 1.3 2008/06/01 01:46:37 jb Exp $
  */
 
 /*
@@ -1137,8 +1139,13 @@
 	uint32_t dts_dblerrors;			/* errors in ERROR probes */
 	uint32_t dts_reserve;			/* space reserved for END */
 	hrtime_t dts_laststatus;		/* time of last status */
+#if defined(sun)
 	cyclic_id_t dts_cleaner;		/* cleaning cyclic */
 	cyclic_id_t dts_deadman;		/* deadman cyclic */
+#else
+	struct callout dts_cleaner;		/* Cleaning callout. */
+	struct callout dts_deadman;		/* Deadman callout. */
+#endif
 	hrtime_t dts_alive;			/* time last alive */
 	char dts_speculates;			/* boolean: has speculations */
 	char dts_destructive;			/* boolean: has dest. actions */

==== //depot/projects/soc2005/libalias/sys/dev/cs/if_csvar.h#5 (text+ko) ====

@@ -22,7 +22,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/cs/if_csvar.h,v 1.9 2006/09/15 15:16:10 glebius Exp $
+ * $FreeBSD: src/sys/dev/cs/if_csvar.h,v 1.12 2008/06/06 05:25:24 imp Exp $
  */
 
 #ifndef _IF_CSVAR_H
@@ -50,11 +50,7 @@
 	struct ifmedia media;		/* Media information */
 
 	int     port_rid;		/* resource id for port range */
-	int     port_used;		/* nonzero if ports used */
 	struct resource* port_res;	/* resource for port range */
-	int     mem_rid;  		/* resource id for memory range */
-	int     mem_used;  		/* nonzero if memory used */
-	struct resource* mem_res;	/* resource for memory range */
 	int     irq_rid;		/* resource id for irq */
 	struct resource* irq_res;	/* resource for irq */
 	void*   irq_handle;		/* handle for irq handler */
@@ -69,15 +65,20 @@
 
 	unsigned char *buffer;
 	int buf_len;
+	struct mtx lock;
+	struct callout timer;
+	int	tx_timeout;
 };
 
+#define	CS_LOCK(sc)		mtx_lock(&(sc)->lock)
+#define	CS_UNLOCK(sc)		mtx_unlock(&(sc)->lock)
+#define	CS_ASSERT_LOCKED(sc)	mtx_assert(&(sc)->lock, MA_OWNED)
+
 int	cs_alloc_port(device_t dev, int rid, int size);
-int	cs_alloc_memory(device_t dev, int rid, int size);
-int	cs_alloc_irq(device_t dev, int rid, int flags);
+int	cs_alloc_irq(device_t dev, int rid);
 int	cs_attach(device_t dev);
 int	cs_cs89x0_probe(device_t dev);
 int	cs_detach(device_t dev);
 void	cs_release_resources(device_t dev);
-driver_intr_t	csintr;
 
 #endif /* _IF_CSVAR_H */

==== //depot/projects/soc2005/libalias/sys/net/radix_mpath.h#5 (text+ko) ====

@@ -32,7 +32,7 @@
  * BE LIABLE FOR ANY INFRINGEMENT OF ANY OTHERS' INTELLECTUAL
  * PROPERTIES.
  */
-/* $FreeBSD: src/sys/net/radix_mpath.h,v 1.2 2008/05/09 23:02:56 julian Exp $ */
+/* $FreeBSD: src/sys/net/radix_mpath.h,v 1.3 2008/05/30 09:34:35 qingli Exp $ */
 
 #ifndef _NET_RADIX_MPATH_H_
 #define	_NET_RADIX_MPATH_H_
@@ -46,11 +46,11 @@
 struct sockaddr;
 int	rn_mpath_capable(struct radix_node_head *);
 struct radix_node *rn_mpath_next(struct radix_node *);
-int rn_mpath_count(struct radix_node *);
+u_int32_t rn_mpath_count(struct radix_node *);
 struct rtentry *rt_mpath_matchgate(struct rtentry *, struct sockaddr *);
 int rt_mpath_conflict(struct radix_node_head *, struct rtentry *,
     struct sockaddr *);
-void rtalloc_mpath_fib(struct route *, int, u_int);
+void rtalloc_mpath_fib(struct route *, u_int32_t, u_int);
 #define rtalloc_mpath(_route, _hash) rtalloc_mpath_fib((_route), (_hash), 0)
 struct radix_node *rn_mpath_lookup(void *, void *,
     struct radix_node_head *);

==== //depot/projects/soc2005/libalias/sys/netgraph/ng_nat.c#19 (text+ko) ====

@@ -675,7 +675,6 @@
 	struct mbuf	*m;
 	struct ip	*ip;
 	int rval, error = 0;
-	char *c;
 
 	/* We have no required hooks. */
 	if (!(priv->flags & NGNAT_CONNECTED)) {
@@ -697,21 +696,20 @@
 
 	NGI_M(item) = m;
 
-	c = mtod(m, char *);
 	ip = mtod(m, struct ip *);
 
 	KASSERT(m->m_pkthdr.len == ntohs(ip->ip_len),
 	    ("ng_nat: ip_len != m_pkthdr.len"));
 
 	if (hook == priv->in) {
-		rval = LibAliasIn(priv->lib, c, m->m_len + M_TRAILINGSPACE(m));
+		rval = LibAliasIn(priv->lib, &m, m->m_len + M_TRAILINGSPACE(m));
 		if (rval != PKT_ALIAS_OK &&
 		    rval != PKT_ALIAS_FOUND_HEADER_FRAGMENT) {
 			NG_FREE_ITEM(item);
 			return (EINVAL);
 		}
 	} else if (hook == priv->out) {
-		rval = LibAliasOut(priv->lib, c, m->m_len + M_TRAILINGSPACE(m));
+		rval = LibAliasOut(priv->lib, &m, m->m_len + M_TRAILINGSPACE(m));
 		if (rval != PKT_ALIAS_OK) {
 			NG_FREE_ITEM(item);
 			return (EINVAL);
@@ -719,7 +717,16 @@
 	} else
 		panic("ng_nat: unknown hook!\n");
 
-	m->m_pkthdr.len = m->m_len = ntohs(ip->ip_len);
+	if ((m = m_pullup(m, sizeof(struct ip))) == NULL) {
+		NGI_M(item) = NULL;     /* avoid double free */
+		NG_FREE_ITEM(item);
+		return (ENOBUFS);
+	}
+
+	NGI_M(item) = m;
+	
+	ip = mtod(m, struct ip *);
+	m->m_pkthdr.len = ntohs(ip->ip_len);
 
 	if ((ip->ip_off & htons(IP_OFFMASK)) == 0 &&
 	    ip->ip_p == IPPROTO_TCP) {

==== //depot/projects/soc2005/libalias/sys/netinet/ip_fw_nat.c#14 (text+ko) ====

@@ -86,7 +86,7 @@
 	struct cfg_nat *ptr;
 	struct ifaddr *ifa;
 
-	IPFW_WLOCK(&V_layer3_chain);			
+	IPFW_WLOCK(&V_layer3_chain);
 	/* Check every nat entry... */
 	LIST_FOREACH(ptr, &V_layer3_chain.nat, _next) {
 		/* ...using nic 'ifp->if_xname' as dynamic alias address. */
@@ -104,7 +104,7 @@
 			mtx_unlock(&ifp->if_addr_mtx);
 		}
 	}
-	IPFW_WUNLOCK(&V_layer3_chain);	
+	IPFW_WUNLOCK(&V_layer3_chain);
 }
 
 static void
@@ -248,19 +248,48 @@
 static int
 ipfw_nat(struct ip_fw_args *args, struct cfg_nat *t, struct mbuf *m)
 {
-	struct mbuf *mcl;
 	struct ip *ip;
 	/* XXX - libalias duct tape */
 	int ldt, retval;
-	char *c;
+
+	/* ipfw_nat works only at layer 3 */
+	if (args->eh != NULL)
+		goto badnat;
 
 	ldt = 0;
 	retval = 0;
-	if ((mcl = m_megapullup(m, m->m_pkthdr.len)) ==
+	if ((m = m_pullup(m, sizeof(struct ip))) ==
 	    NULL)
 		goto badnat;
-	ip = mtod(mcl, struct ip *);
-	if (args->eh == NULL) {
+	ip = mtod(m, struct ip *);
+	if (ip->ip_off & (IP_MF | IP_OFFMASK)) {
+		struct mbuf *reass;
+
+		/* Reassemble packet. */
+		reass = ip_reass(m);
+
+		/*
+		 * IP header checksum fixup after reassembly and leave header
+		 * in network byte order.
+		 */
+		if (reass != NULL) {
+			int hlen;
+			
+			ip = mtod(reass, struct ip *);
+			hlen = ip->ip_hl << 2;
+			ip->ip_len = htons(ip->ip_len);
+			ip->ip_off = htons(ip->ip_off);
+			ip->ip_sum = 0;
+			if (hlen == sizeof(struct ip))
+				ip->ip_sum = in_cksum_hdr(ip);
+			else
+				ip->ip_sum = in_cksum(reass, hlen);
+			m = reass;
+		} else {
+			m = NULL;
+			goto badnat;
+		}
+	} else {
 		ip->ip_len = htons(ip->ip_len);
 		ip->ip_off = htons(ip->ip_off);
 	}
@@ -313,28 +342,34 @@
 	 * it can handle delayed checksum and tso)
 	 */
 
-	if (mcl->m_pkthdr.rcvif == NULL && 
-	    mcl->m_pkthdr.csum_flags & 
+	if (m->m_pkthdr.rcvif == NULL && 
+	    m->m_pkthdr.csum_flags & 
 	    CSUM_DELAY_DATA)
 		ldt = 1;
-
-	c = mtod(mcl, char *);
+	
 	if (args->oif == NULL)
-		retval = LibAliasIn(t->lib, c, 
-			mcl->m_len + M_TRAILINGSPACE(mcl));
+		retval = LibAliasIn(t->lib, &m,
+		    IP_MAXPACKET);
 	else
-		retval = LibAliasOut(t->lib, c, 
-			mcl->m_len + M_TRAILINGSPACE(mcl));
-	if (retval != PKT_ALIAS_OK &&
-	    retval != PKT_ALIAS_FOUND_HEADER_FRAGMENT) {
+		retval = LibAliasOut(t->lib, &m,
+		    IP_MAXPACKET);
+	if (retval != PKT_ALIAS_OK) {
+		printf("retval: %d", retval);
 		/* XXX - should i add some logging? */
-		m_free(mcl);
+		m_free(m);
 	badnat:
+		printf("badnat ");
+		if (args->oif == NULL)
+			printf("LibAliasIn");
+		else
+			printf("LibAliasOut");
+		printf("\n");
 		args->m = NULL;
 		return (IP_FW_DENY);
 	}
-	mcl->m_pkthdr.len = mcl->m_len = 
-	    ntohs(ip->ip_len);
+	m = m_pullup(m, sizeof(struct ip));
+	ip = mtod(m, struct ip *);
+	m->m_pkthdr.len = ntohs(ip->ip_len);
 
 	/* 
 	 * XXX - libalias checksum offload 
@@ -345,6 +380,10 @@
 	    ip->ip_p == IPPROTO_TCP) {
 		struct tcphdr 	*th; 
 
+		if ((m = m_pullup(m, (ip->ip_hl << 2) +
+			sizeof(struct tcphdr))) == NULL)
+			goto badnat;
+		ip = mtod(m, struct ip *);
 		th = (struct tcphdr *)(ip + 1);
 		if (th->th_x2) 
 			ldt = 1;
@@ -364,6 +403,9 @@
 					
 		switch (ip->ip_p) {
 		case IPPROTO_TCP:
+			if ((m = m_pullup(m, (ip->ip_hl << 2) + sizeof(struct tcphdr))) == NULL)
+				goto badnat;
+			ip = mtod(m, struct ip *);
 			th = (struct tcphdr *)(ip + 1);
 			/* 
 			 * Maybe it was set in 
@@ -371,13 +413,16 @@
 			 */
 			th->th_x2 = 0;
 			th->th_sum = cksum;
-			mcl->m_pkthdr.csum_data = 
+			m->m_pkthdr.csum_data = 
 			    offsetof(struct tcphdr, th_sum);
 			break;
 		case IPPROTO_UDP:
+			    if ((m = m_pullup(m, (ip->ip_hl << 2) + sizeof(struct udphdr))) == NULL)
+				goto badnat;
+			ip = mtod(m, struct ip *);
 			uh = (struct udphdr *)(ip + 1);
 			uh->uh_sum = cksum;
-			mcl->m_pkthdr.csum_data = 
+			m->m_pkthdr.csum_data = 
 			    offsetof(struct udphdr, uh_sum);
 			break;						
 		}
@@ -385,21 +430,18 @@
 		 * No hw checksum offloading: do it 
 		 * by ourself. 
 		 */
-		if ((mcl->m_pkthdr.csum_flags & 
+		if ((m->m_pkthdr.csum_flags & 
 		     CSUM_DELAY_DATA) == 0) {
-			in_delayed_cksum(mcl);
-			mcl->m_pkthdr.csum_flags &= 
+			in_delayed_cksum(m);
+			m->m_pkthdr.csum_flags &= 
 			    ~CSUM_DELAY_DATA;
 		}
 		ip->ip_len = htons(ip->ip_len);
 	}
+	ip->ip_len = ntohs(ip->ip_len);
+	ip->ip_off = ntohs(ip->ip_off);
 
-	if (args->eh == NULL) {
-		ip->ip_len = ntohs(ip->ip_len);
-		ip->ip_off = ntohs(ip->ip_off);
-	}
-
-	args->m = mcl;
+	args->m = m;
 	return (IP_FW_NAT);
 }
 

==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias.c#84 (text+ko) ====

@@ -271,20 +271,8 @@
 		    struct in_addr ip_dst, u_char ip_p, u_short *ip_sum, 
 		    int create);
 
->>>> ORIGINAL //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#14
-static int	UdpAliasIn(struct libalias *, struct ip *);
->>>> ORIGINAL //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#14
-==== THEIRS //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#15
-static int	UdpAliasOut(struct libalias *, struct ip *, int, int create);
-==== YOURS //piso_newluxor/piso_libalias/sys/netinet/libalias/alias.c
-==== THEIRS //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#15
-static int	UdpAliasIn(struct libalias *, struct ip *);
-static int	UdpAliasOut(struct libalias *, struct ip *, int, int create);
-==== YOURS //piso_newluxor/piso_libalias/sys/netinet/libalias/alias.c
 static int	UdpAliasIn(struct libalias *, pkt_t);
-static int	UdpAliasOut(struct libalias *, pkt_t, int create);
-<<<<
-<<<<
+static int	UdpAliasOut(struct libalias *, pkt_t, int, int create);
 
 static int	TcpAliasIn(struct libalias *, pkt_t);
 static int	TcpAliasOut(struct libalias *, pkt_t, int, int create);
@@ -817,17 +805,7 @@
 }
 
 static int
->>>> ORIGINAL //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#14
->>>> ORIGINAL //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#14
-==== THEIRS //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#15
-UdpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create)
-==== YOURS //piso_newluxor/piso_libalias/sys/netinet/libalias/alias.c
-==== THEIRS //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#15
-UdpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create)
-==== YOURS //piso_newluxor/piso_libalias/sys/netinet/libalias/alias.c
-UdpAliasOut(struct libalias *la, pkt_t ptr, int create)
-<<<<
-<<<<
+UdpAliasOut(struct libalias *la, pkt_t ptr, int maxpacketsize, int create)
 {
 	struct ip *pip;
 	struct udphdr *ud;
@@ -842,6 +820,7 @@
 	LIBALIAS_LOCK_ASSERT(la);
 
 /* Return if proxy-only mode is enabled and not proxyrule found.*/
+	PULLUP_UDPHDR(pip, ptr);
 	ud = (struct udphdr *)ip_next(pip);
 	proxy_type = ProxyCheck(la, &proxy_server_address, 
 		&proxy_server_port, pip->ip_src, pip->ip_dst, 
@@ -849,9 +828,6 @@
 	if (proxy_type == 0 && (la->packetAliasMode & PKT_ALIAS_PROXY_ONLY))
 		return (PKT_ALIAS_OK);
 
->>>> ORIGINAL //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#14
-	ud = (struct udphdr *)ip_next(pip);
-==== THEIRS //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#15
 /* If this is a transparent proxy, save original destination,
  * then alter the destination and adjust checksums */
 	dest_port = ud->uh_dport;
@@ -864,15 +840,6 @@
 		accumulate -= twowords(&proxy_server_address);
 
 	        ADJUST_CHECKSUM(accumulate, pip->ip_sum);
->>>> ORIGINAL //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#14
-	ud = (struct udphdr *)ip_next(pip);
-==== THEIRS //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#15
-==== YOURS //piso_newluxor/piso_libalias/sys/netinet/libalias/alias.c
-==== YOURS //piso_newluxor/piso_libalias/sys/netinet/libalias/alias.c
-	PULLUP_UDPHDR(pip, ptr);
-	ud = (struct udphdr *)ip_next(pip);
-<<<<
-<<<<
 
 		if (ud->uh_sum != 0) {
 			accumulate = twowords(&pip->ip_dst);
@@ -1525,17 +1492,7 @@
 			iresult = IcmpAliasOut(la, ptr, create);
 			break;
 		case IPPROTO_UDP:
->>>> ORIGINAL //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#14
->>>> ORIGINAL //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#14
-==== THEIRS //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#15
-			iresult = UdpAliasOut(la, pip, maxpacketsize, create);
-==== YOURS //piso_newluxor/piso_libalias/sys/netinet/libalias/alias.c
-==== THEIRS //depot/vendor/freebsd/src/sys/netinet/libalias/alias.c#15
-			iresult = UdpAliasOut(la, pip, maxpacketsize, create);
-==== YOURS //piso_newluxor/piso_libalias/sys/netinet/libalias/alias.c
-			iresult = UdpAliasOut(la, ptr, create);
-<<<<
-<<<<
+			iresult = UdpAliasOut(la, ptr, maxpacketsize, create);
 			break;
 			case IPPROTO_TCP:
 			iresult = TcpAliasOut(la, ptr, maxpacketsize, create);

==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_db.c#35 (text+ko) ====

@@ -25,13 +25,7 @@
  */
 
 #include <sys/cdefs.h>
->>>> ORIGINAL //depot/vendor/freebsd/src/sys/netinet/libalias/alias_db.c#12
-__FBSDID("$FreeBSD: src/sys/netinet/libalias/alias_db.c,v 1.73 2008/06/01 18:34:58 mav Exp $");
-==== THEIRS //depot/vendor/freebsd/src/sys/netinet/libalias/alias_db.c#14
 __FBSDID("$FreeBSD: src/sys/netinet/libalias/alias_db.c,v 1.75 2008/08/30 20:58:34 csjp Exp $");
-==== YOURS //piso_newluxor/piso_libalias/sys/netinet/libalias/alias_db.c
-__FBSDID("$FreeBSD: src/sys/netinet/libalias/alias_db.c,v 1.72 2008/03/06 21:50:40 piso Exp $");
-<<<<
 
 /*
     Alias_db.c encapsulates all data structures used for storing
@@ -827,15 +821,7 @@
 	for (i = 0; i < LINK_TABLE_OUT_SIZE; i++) {
 		lnk = LIST_FIRST(&la->linkTableOut[i]);
 		while (lnk != NULL) {
->>>> ORIGINAL //depot/vendor/freebsd/src/sys/netinet/libalias/alias_db.c#12
-==== THEIRS //depot/vendor/freebsd/src/sys/netinet/libalias/alias_db.c#14
 			struct alias_link *link_next = LIST_NEXT(lnk, list_out);
-==== YOURS //piso_newluxor/piso_libalias/sys/netinet/libalias/alias_db.c
-			struct alias_link *link_next;
-
-			link_next = LIST_NEXT(lnk, list_out);
-			icount++;
-<<<<
 			DeleteLink(lnk);
 			lnk = link_next;
 		}

==== //depot/projects/soc2005/libalias/sys/netinet/tcp_subr.c#21 (text+ko) ====

@@ -30,13 +30,7 @@
  */
 
 #include <sys/cdefs.h>
->>>> ORIGINAL //depot/vendor/freebsd/src/sys/netinet/tcp_subr.c#197
-__FBSDID("$FreeBSD: src/sys/netinet/tcp_subr.c,v 1.308 2008/06/02 14:20:26 rwatson Exp $");
-==== THEIRS //depot/vendor/freebsd/src/sys/netinet/tcp_subr.c#214
 __FBSDID("$FreeBSD: src/sys/netinet/tcp_subr.c,v 1.325 2008/12/02 21:37:28 bz Exp $");
-==== YOURS //piso_newluxor/piso_libalias/sys/netinet/tcp_subr.c
-__FBSDID("$FreeBSD: src/sys/netinet/tcp_subr.c,v 1.306 2008/05/09 23:02:57 julian Exp $");
-<<<<
 
 #include "opt_compat.h"
 #include "opt_inet.h"
@@ -483,17 +477,13 @@
 struct tcptemp *
 tcpip_maketemplate(struct inpcb *inp)
 {
-	struct mbuf *m;
-	struct tcptemp *n;
+	struct tcptemp *t;
 
-	m = m_get(M_DONTWAIT, MT_DATA);
-	if (m == NULL)
-		return (0);
-	m->m_len = sizeof(struct tcptemp);
-	n = mtod(m, struct tcptemp *);
-
-	tcpip_fillheaders(inp, (void *)&n->tt_ipgen, (void *)&n->tt_t);
-	return (n);
+	t = malloc(sizeof(*t), M_TEMP, M_NOWAIT);
+	if (t == NULL)
+		return (NULL);
+	tcpip_fillheaders(inp, (void *)&t->tt_ipgen, (void *)&t->tt_t);
+	return (t);
 }
 
 /*
@@ -1062,7 +1052,7 @@
 	INP_INFO_RLOCK(&V_tcbinfo);
 	for (inp = LIST_FIRST(V_tcbinfo.ipi_listhead), i = 0;
 	    inp != NULL && i < n; inp = LIST_NEXT(inp, inp_list)) {
-		INP_WLOCK(inp);
+		INP_RLOCK(inp);
 		if (inp->inp_gencnt <= gencnt) {
 			/*
 			 * XXX: This use of cr_cansee(), introduced with
@@ -1080,7 +1070,7 @@
 			if (error == 0)
 				inp_list[i++] = inp;
 		}
-		INP_WUNLOCK(inp);
+		INP_RUNLOCK(inp);
 	}
 	INP_INFO_RUNLOCK(&V_tcbinfo);
 	n = i;
@@ -1088,7 +1078,7 @@
 	error = 0;
 	for (i = 0; i < n; i++) {
 		inp = inp_list[i];
-		INP_WLOCK(inp);
+		INP_RLOCK(inp);
 		if (inp->inp_gencnt <= gencnt) {
 			struct xtcpcb xt;
 			void *inp_ppcb;
@@ -1112,10 +1102,10 @@
 				xt.xt_socket.xso_protocol = IPPROTO_TCP;
 			}
 			xt.xt_inp.inp_gencnt = inp->inp_gencnt;
-			INP_WUNLOCK(inp);
+			INP_RUNLOCK(inp);
 			error = SYSCTL_OUT(req, &xt, sizeof xt);
 		} else
-			INP_WUNLOCK(inp);
+			INP_RUNLOCK(inp);
 	
 	}
 	if (!error) {
@@ -1158,21 +1148,6 @@
 	INP_INFO_RLOCK(&V_tcbinfo);
 	inp = in_pcblookup_hash(&V_tcbinfo, addrs[1].sin_addr,
 	    addrs[1].sin_port, addrs[0].sin_addr, addrs[0].sin_port, 0, NULL);
->>>> ORIGINAL //depot/vendor/freebsd/src/sys/netinet/tcp_subr.c#197
-	if (inp != NULL) {
-		INP_RLOCK(inp);
-		INP_INFO_RUNLOCK(&tcbinfo);
-		if (inp->inp_socket == NULL)
-			error = ENOENT;
-		if (error == 0)
-			error = cr_canseesocket(req->td->td_ucred,
-			    inp->inp_socket);
-		if (error == 0)
-			cru2x(inp->inp_socket->so_cred, &xuc);
-		INP_RUNLOCK(inp);
-	} else {
-		INP_INFO_RUNLOCK(&tcbinfo);
-==== THEIRS //depot/vendor/freebsd/src/sys/netinet/tcp_subr.c#214
 	if (inp != NULL) {
 		INP_RLOCK(inp);
 		INP_INFO_RUNLOCK(&V_tcbinfo);
@@ -1185,25 +1160,8 @@
 		INP_RUNLOCK(inp);
 	} else {
 		INP_INFO_RUNLOCK(&V_tcbinfo);
-==== YOURS //piso_newluxor/piso_libalias/sys/netinet/tcp_subr.c
-	if (inp == NULL) {
-		error = ENOENT;
-		goto outunlocked;
-	}
-	INP_WLOCK(inp);
-	if (inp->inp_socket == NULL) {
-<<<<
 		error = ENOENT;
-		goto out;
 	}
-	error = cr_canseesocket(req->td->td_ucred, inp->inp_socket);
-	if (error)
-		goto out;
-	cru2x(inp->inp_socket->so_cred, &xuc);
-out:
-	INP_WUNLOCK(inp);
-outunlocked:
-	INP_INFO_RUNLOCK(&tcbinfo);
 	if (error == 0)
 		error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred));
 	return (error);
@@ -1253,21 +1211,6 @@
 		inp = in6_pcblookup_hash(&V_tcbinfo,
 			&addrs[1].sin6_addr, addrs[1].sin6_port,
 			&addrs[0].sin6_addr, addrs[0].sin6_port, 0, NULL);
->>>> ORIGINAL //depot/vendor/freebsd/src/sys/netinet/tcp_subr.c#197
-	if (inp != NULL) {
-		INP_RLOCK(inp);
-		INP_INFO_RUNLOCK(&tcbinfo);
-		if (inp->inp_socket == NULL)
-			error = ENOENT;
-		if (error == 0)
-			error = cr_canseesocket(req->td->td_ucred,
-			    inp->inp_socket);
-		if (error == 0)
-			cru2x(inp->inp_socket->so_cred, &xuc);
-		INP_RUNLOCK(inp);
-	} else {
-		INP_INFO_RUNLOCK(&tcbinfo);
-==== THEIRS //depot/vendor/freebsd/src/sys/netinet/tcp_subr.c#214
 	if (inp != NULL) {
 		INP_RLOCK(inp);
 		INP_INFO_RUNLOCK(&V_tcbinfo);
@@ -1280,25 +1223,8 @@
 		INP_RUNLOCK(inp);
 	} else {
 		INP_INFO_RUNLOCK(&V_tcbinfo);
-==== YOURS //piso_newluxor/piso_libalias/sys/netinet/tcp_subr.c
-	if (inp == NULL) {
-		error = ENOENT;
-		goto outunlocked;
-	}
-	INP_WLOCK(inp);
-	if (inp->inp_socket == NULL) {
-<<<<
 		error = ENOENT;
-		goto out;
 	}
-	error = cr_canseesocket(req->td->td_ucred, inp->inp_socket);
-	if (error)
-		goto out;
-	cru2x(inp->inp_socket->so_cred, &xuc);
-out:
-	INP_WUNLOCK(inp);
-outunlocked:
-	INP_INFO_RUNLOCK(&tcbinfo);
 	if (error == 0)
 		error = SYSCTL_OUT(req, &xuc, sizeof(struct xucred));
 	return (error);



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