kern/90644: [patch] inherit LOCAL_CREDS option for accepted sockets
from listen socket
Andrey Simonenko
simon at comsys.ntu-kpi.kiev.ua
Mon Dec 19 03:20:04 PST 2005
>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:
More information about the freebsd-bugs
mailing list