From owner-freebsd-current@FreeBSD.ORG Fri Mar 16 12:47:14 2007 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A365416A46F for ; Fri, 16 Mar 2007 12:47:14 +0000 (UTC) (envelope-from Hartmut.Brandt@dlr.de) Received: from smtp-3.dlr.de (smtp-3.dlr.de [195.37.61.187]) by mx1.freebsd.org (Postfix) with ESMTP id 4070213C455 for ; Fri, 16 Mar 2007 12:47:14 +0000 (UTC) (envelope-from Hartmut.Brandt@dlr.de) Received: from [129.247.12.22] ([129.247.12.22]) by smtp-3.dlr.de with Microsoft SMTPSVC(6.0.3790.1830); Fri, 16 Mar 2007 13:47:12 +0100 Message-ID: <45FA91CA.4030300@dlr.de> Date: Fri, 16 Mar 2007 13:47:06 +0100 From: Hartmut Brandt User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: Maxim Konovalov References: <20070316104749.J88087@knop-beagle.kn.op.dlr.de> <20070316145524.T40420@mp2.macomnet.net> In-Reply-To: <20070316145524.T40420@mp2.macomnet.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 16 Mar 2007 12:47:12.0588 (UTC) FILETIME=[37D100C0:01C767C9] X-Mailman-Approved-At: Fri, 16 Mar 2007 13:07:36 +0000 Cc: freebsd-current@freebsd.org Subject: Re: LOCAL_CREDS socket option X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Mar 2007 12:47:14 -0000 Maxim Konovalov wrote: > On Fri, 16 Mar 2007, 10:51+0100, Harti Brandt wrote: > > >> Hi, >> >> is there any specific reason that we don't support the LOCAL_CREDS >> option for SOCK_DGRAM sockets in the local domain? It's documented >> in unix(4) for a long time and it looks like it is supported, for >> example, in NetBSD. >> > > IIRC it is supported. > > From tools/regression/sockets/unix_cmsg/README: > > For SOCK_DGRAM sockets: > ---------------------- > [...] > 3: Sending cmsgcred, receiving sockcred > > Server creates datagram socket and set socket option LOCAL_CREDS > for it. Client sends one message with data and control message with > SOCK_CREDS type to Server. Server should receive one message with > data and control message with SCM_CREDS type followed by struct > sockcred{} and this structure should contain correct information. > > Well, this comment does not actually mean, that the feature works - it just means that the regression test tests it. If you look at uipc_usrreq.c: static struct protosw localsw[] = { { .pr_type = SOCK_STREAM, .pr_domain = &localdomain, .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_RIGHTS, .pr_ctloutput = &uipc_ctloutput, .pr_usrreqs = &uipc_usrreqs }, { .pr_type = SOCK_DGRAM, .pr_domain = &localdomain, .pr_flags = PR_ATOMIC|PR_ADDR|PR_RIGHTS, .pr_usrreqs = &uipc_usrreqs }, you see that .pr_ctloutput is NULL for SOCK_DGRAM sockets which means they don't support any of the socket options described in unix(4). Also I included that feature into bsnmp(1) where I found out that it doesn't work. I've a patch to fix it, but wanted to know whether it was left out on purpose or not. harti };