From owner-svn-src-head@FreeBSD.ORG Fri Dec 21 15:52:11 2012 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 030829C3; Fri, 21 Dec 2012 15:52:11 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from ns.kevlo.org (kevlo.org [220.128.136.52]) by mx1.freebsd.org (Postfix) with ESMTP id 691728FC0C; Fri, 21 Dec 2012 15:52:09 +0000 (UTC) Received: from srg.kevlo.org (git.kevlo.org [220.128.136.52]) by ns.kevlo.org (8.14.5/8.14.5) with ESMTP id qBLFpqV8091827; Fri, 21 Dec 2012 23:51:52 +0800 (CST) (envelope-from kevlo@FreeBSD.org) Message-ID: <50D485A1.8040006@FreeBSD.org> Date: Fri, 21 Dec 2012 23:52:01 +0800 From: Kevin Lo User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Garrett Cooper Subject: Re: Broken error handling with AF_* and socket(2) [was Re: svn commit: r243965 - in head/sys: kern sys] References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@FreeBSD.org, freebsd-net@FreeBSD.org, svn-src-all@FreeBSD.org, Gleb Smirnoff , svn-src-head@FreeBSD.org, Rick Macklem X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Dec 2012 15:52:11 -0000 On 2012/12/21 20:11, Garrett Cooper wrote: > On Thu, Dec 6, 2012 at 6:22 PM, Kevin Lo wrote: >> Author: kevlo >> Date: Fri Dec 7 02:22:48 2012 >> New Revision: 243965 >> URL: http://svnweb.freebsd.org/changeset/base/243965 >> >> Log: >> - according to POSIX, make socket(2) return EAFNOSUPPORT rather than >> EPROTONOSUPPORT if the address family is not supported. >> - introduce pffinddomain() to find a domain by family and use it as >> appropriate. >> >> Reviewed by: glebius > This commit broke netgraph (and potentially more things). I fixed > netgraph locally like so: > > $ git diff lib/libnetgraph/ > diff --git a/lib/libnetgraph/sock.c b/lib/libnetgraph/sock.c > index fca3900..5f9f563 100644 > --- a/lib/libnetgraph/sock.c > +++ b/lib/libnetgraph/sock.c > @@ -71,10 +71,10 @@ NgMkSockNode(const char *name, int *csp, int *dsp) > name = NULL; > > /* Create control socket; this also creates the netgraph node. > - If we get an EPROTONOSUPPORT then the socket node type is > + If we get an EAFNOSUPPORT then the socket node type is > not loaded, so load it and try again. */ > if ((cs = socket(AF_NETGRAPH, SOCK_DGRAM, NG_CONTROL)) < 0) { > - if (errno == EPROTONOSUPPORT) { > + if (errno == EAFNOSUPPORT) { > if (kldload(NG_SOCKET_KLD) < 0) { > errnosv = errno; > if (_gNgDebugLevel >= 1) > > Reproing the issue was trivial using the ether.bridge example > script setup with appropriate interfaces. > I have the patch with the netgraph fix attached, along with other > potential fixes that needs to be more properly tested. Ah, seems I forgot to commit the change. Thanks for the patch, Garrett, I'll fix it right away. > Thanks, > -Garrett Kevin