From owner-svn-src-all@FreeBSD.ORG Tue Apr 19 08:00:44 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6521106567B; Tue, 19 Apr 2011 08:00:44 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C48508FC12; Tue, 19 Apr 2011 08:00:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p3J80io2099306; Tue, 19 Apr 2011 08:00:44 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3J80iP6099304; Tue, 19 Apr 2011 08:00:44 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201104190800.p3J80iP6099304@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 19 Apr 2011 08:00:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220821 - stable/7/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2011 08:00:44 -0000 Author: bz Date: Tue Apr 19 08:00:44 2011 New Revision: 220821 URL: http://svn.freebsd.org/changeset/base/220821 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/7/sys/netinet/in_pcb.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netinet/in_pcb.c ============================================================================== --- stable/7/sys/netinet/in_pcb.c Tue Apr 19 07:54:21 2011 (r220820) +++ stable/7/sys/netinet/in_pcb.c Tue Apr 19 08:00:44 2011 (r220821) @@ -332,7 +332,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; @@ -368,7 +368,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;