From owner-svn-src-all@FreeBSD.ORG Sun Mar 20 09:08:59 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 2D2DB1065782; Sun, 20 Mar 2011 09:08:59 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (bird.sbone.de [46.4.1.90]) by mx1.freebsd.org (Postfix) with ESMTP id D92B38FC1A; Sun, 20 Mar 2011 09:08:58 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id A5CAF25D3868; Sun, 20 Mar 2011 09:08:27 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id BAFE9159B273; Sun, 20 Mar 2011 09:08:26 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id d9e2suqGBdci; Sun, 20 Mar 2011 09:08:25 +0000 (UTC) Received: from nv.sbone.de (nv.sbone.de [IPv6:fde9:577b:c1a9:31::2013:138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 6E0FA159B275; Sun, 20 Mar 2011 09:08:25 +0000 (UTC) Date: Sun, 20 Mar 2011 09:08:24 +0000 (UTC) From: "Bjoern A. Zeeb" To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201103191908.p2JJ8sk2032274@svn.freebsd.org> Message-ID: References: <201103191908.p2JJ8sk2032274@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Subject: Re: svn commit: r219779 - head/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: Sun, 20 Mar 2011 09:08:59 -0000 On Sat, 19 Mar 2011, Bjoern A. Zeeb wrote: > Author: bz > Date: Sat Mar 19 19:08:54 2011 > New Revision: 219779 > URL: http://svn.freebsd.org/changeset/base/219779 > > Log: > Properly check for an IPv4 socket after r219579. > > In some cases as udp6_connect() without an earlier bind(2) to an > address, v4-mapped scokets 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. For your information and future reference: UDP and TCP come in with flags set differently for the 6 cases. The only conistent one is IPv4 only. v4-mapped v6 is the trouble maker. So while this one fixed the panic with plain IPv6 and v4-mapped enabled, it actually broke udp on v4-mapped as further investigation has shown. I am working on regression tests as well as harmonizing the initial calls setting the flags and documenting things (and obviously fixing that one case as well;) /bz > Reported by: Pawel Worach (pawel.worach gmail.com) > Tested by: Pawel Worach (pawel.worach gmail.com) > MFC after: 6 days > X-MFC with: r219579 > > Modified: > head/sys/netinet/in_pcb.c > > Modified: head/sys/netinet/in_pcb.c > ============================================================================== > --- head/sys/netinet/in_pcb.c Sat Mar 19 18:26:54 2011 (r219778) > +++ head/sys/netinet/in_pcb.c Sat Mar 19 19:08:54 2011 (r219779) > @@ -387,7 +387,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; > @@ -423,7 +423,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; > -- Bjoern A. Zeeb You have to have visions! Stop bit received. Insert coin for new address family.