Date: Mon, 19 Dec 2005 13:13:42 +0200 From: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/90644: [patch] inherit LOCAL_CREDS option for accepted sockets from listen socket Message-ID: <20051219111342.GA995@pm513-1.comsys.ntu-kpi.kiev.ua> Resent-Message-ID: <200512191120.jBJBK37F016006@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 90644 >Category: kern >Synopsis: [patch] inherit LOCAL_CREDS option for accepted sockets from listen socket >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Dec 19 11:20:02 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Andrey Simonenko >Release: FreeBSD 6.0-STABLE i386 >Organization: >Environment: FreeBSD 6.0-STABLE, sys/kern/uipc_usrreq.c,v 1.155.2.1 >Description: Sockets returned by the accept(2) system call do not inherit LOCAL_CREDS option from their listen socket. As the result it is necessary to call setsockopt(LOCAL_CREDS) for each accepted socket, what gives overhead. In NetBSD accepted sockets inherit LOCAL_CREDS option from their listen socket. Shouldn't __FreeBSD_version be incremented if this patch is committed ? >How-To-Repeat: Try to run src/regress/sys/kern/unfdpass/unfdpass.c from NetBSD 2.0 on FreeBSD, before and after patch. >Fix: --- uipc_usrreq.c.orig Thu Nov 24 09:07:51 2005 +++ uipc_usrreq.c Sun Dec 18 20:26:09 2005 @@ -1010,6 +1010,8 @@ memcpy(&unp->unp_peercred, &unp2->unp_peercred, sizeof(unp->unp_peercred)); unp->unp_flags |= UNP_HAVEPC; + if (unp2->unp_flags & UNP_WANTCRED) + unp3->unp_flags |= UNP_WANTCRED; #ifdef MAC SOCK_LOCK(so); mac_set_socket_peer_from_socket(so, so3); >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051219111342.GA995>