linux(4): Emulate Linux SOL_SOCKET:SO_PASSCRED

This is required by some major linux applications, such as Chrome and
Firefox.  (As well as Electron-using applications, which are essentially
a bundled version of Chrome.)

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D27012
This commit is contained in:
Conrad Meyer 2020-11-03 01:19:13 +00:00
parent 2de07e4096
commit 443d8a07df

View File

@ -222,6 +222,8 @@ linux_to_bsd_so_sockopt(int opt)
return (SO_LINGER);
case LINUX_SO_REUSEPORT:
return (SO_REUSEPORT_LB);
case LINUX_SO_PASSCRED:
return (LOCAL_CREDS_PERSISTENT);
case LINUX_SO_PEERCRED:
return (LOCAL_PEERCRED);
case LINUX_SO_RCVLOWAT:
@ -1445,6 +1447,9 @@ linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args)
case SOL_SOCKET:
name = linux_to_bsd_so_sockopt(args->optname);
switch (name) {
case LOCAL_CREDS_PERSISTENT:
level = SOL_LOCAL;
break;
case SO_RCVTIMEO:
/* FALLTHROUGH */
case SO_SNDTIMEO:
@ -1522,6 +1527,9 @@ linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args)
case SOL_SOCKET:
name = linux_to_bsd_so_sockopt(args->optname);
switch (name) {
case LOCAL_CREDS_PERSISTENT:
level = SOL_LOCAL;
break;
case SO_RCVTIMEO:
/* FALLTHROUGH */
case SO_SNDTIMEO: