The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=0ae7df3708dd97515a5bc2a068d25a733c9b2b10
commit 0ae7df3708dd97515a5bc2a068d25a733c9b2b10 Author: Kyle Evans <[email protected]> AuthorDate: 2026-06-19 04:03:30 +0000 Commit: Kyle Evans <[email protected]> CommitDate: 2026-06-19 04:03:30 +0000 sockets: plumb SO_PASSRIGHTS into *sockopt(2) This is a little different than the others in that it's not valid for anything but unix(4) sockets. New cases were added that jump into the more standard case out of a light preference for not taking advantage of case FALLTHROUGH with the additional logic- it doesn't scale very well for new cases added that might be slightly special, so we might as well just add the labels up-front. Reviewed by: glebius, markj Differential Revision: https://reviews.freebsd.org/D57424 --- sys/kern/uipc_socket.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 3debec547a80..c7a7fdd44aa0 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -3911,6 +3911,7 @@ sosetopt(struct socket *so, struct sockopt *sopt) case SO_NO_DDP: case SO_NO_OFFLOAD: case SO_RERROR: +stdopt: error = sooptcopyin(sopt, &optval, sizeof optval, sizeof optval); if (error) @@ -3923,6 +3924,14 @@ sosetopt(struct socket *so, struct sockopt *sopt) SOCK_UNLOCK(so); break; + case SO_PASSRIGHTS: + if (so->so_proto->pr_domain->dom_family != AF_LOCAL) { + error = EOPNOTSUPP; + goto bad; + } + + goto stdopt; + case SO_SETFIB: error = so->so_proto->pr_ctloutput(so, sopt); break; @@ -4162,11 +4171,20 @@ sogetopt(struct socket *so, struct sockopt *sopt) case SO_NO_DDP: case SO_NO_OFFLOAD: case SO_RERROR: +stdopt: optval = so->so_options & sopt->sopt_name; integer: error = sooptcopyout(sopt, &optval, sizeof optval); break; + case SO_PASSRIGHTS: + if (so->so_proto->pr_domain->dom_family != AF_LOCAL) { + error = EOPNOTSUPP; + goto bad; + } + + goto stdopt; + case SO_FIB: SOCK_LOCK(so); optval = so->so_fibnum;
