Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Apr 2011 07:53:04 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r220819 - stable/8/sys/netinet
Message-ID:  <201104190753.p3J7r4aE099012@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Tue Apr 19 07:53:04 2011
New Revision: 220819
URL: http://svn.freebsd.org/changeset/base/220819

Log:
  MFC r219779:
  
   Properly check for an IPv4 socket after r219579.
  
   In some cases as udp6_connect() without an earlier bind(2) to an
   address, v4-mapped sockets allowed and a non mapped destination
   address, we can end up here with both v4 and v6 indicated:
   	inp_vflag = (INP_IPV4|INP_IPV6|INP_IPV6PROTO)
  
   In that case however laddrp is NULL as the IPv6 path does not
   pass in a copy currently.
  
   Reported by:	Pawel Worach (pawel.worach gmail.com)
   Tested by:	Pawel Worach (pawel.worach gmail.com)

Modified:
  stable/8/sys/netinet/in_pcb.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/netinet/in_pcb.c
==============================================================================
--- stable/8/sys/netinet/in_pcb.c	Tue Apr 19 07:49:58 2011	(r220818)
+++ stable/8/sys/netinet/in_pcb.c	Tue Apr 19 07:53:04 2011	(r220819)
@@ -346,7 +346,7 @@ in_pcb_lport(struct inpcb *inp, struct i
 #ifdef INET
 	/* Make the compiler happy. */
 	laddr.s_addr = 0;
-	if ((inp->inp_vflag & INP_IPV4) != 0) {
+	if ((inp->inp_vflag & (INP_IPV4|INP_IPV6)) == INP_IPV4) {
 		KASSERT(laddrp != NULL, ("%s: laddrp NULL for v4 inp %p",
 		    __func__, inp));
 		laddr = *laddrp;
@@ -382,7 +382,7 @@ in_pcb_lport(struct inpcb *inp, struct i
 	} while (tmpinp != NULL);
 
 #ifdef INET
-	if ((inp->inp_vflag & INP_IPV4) != 0)
+	if ((inp->inp_vflag & (INP_IPV4|INP_IPV6)) == INP_IPV4)
 		laddrp->s_addr = laddr.s_addr;
 #endif                 
 	*lportp = lport;



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