Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Jun 2022 19:39:06 GMT
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 61337dfb340e - stable/13 - linux(4): Handle SO_DOMAIN in getsockopt syscall.
Message-ID:  <202206171939.25HJd6KC015558@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=61337dfb340ec87019aa512be7e6df4c026ee2c5

commit 61337dfb340ec87019aa512be7e6df4c026ee2c5
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2022-04-11 20:31:28 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-06-17 19:33:51 +0000

    linux(4): Handle SO_DOMAIN in getsockopt syscall.
    
    Differential revision:  https://reviews.freebsd.org/D34714
    
    (cherry picked from commit cf312f799a867b4b1beef0536a162062659659a6)
---
 sys/compat/linux/linux_socket.c | 13 +++++++++++++
 sys/compat/linux/linux_socket.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
index 935d07ecb7e0..4ba023daaba2 100644
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -553,6 +553,8 @@ linux_to_bsd_so_sockopt(int opt)
 		return (SO_ACCEPTCONN);
 	case LINUX_SO_PROTOCOL:
 		return (SO_PROTOCOL);
+	case LINUX_SO_DOMAIN:
+		return (SO_DOMAIN);
 	}
 	return (-1);
 }
@@ -2008,6 +2010,17 @@ linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args)
 			newval = -bsd_to_linux_errno(newval);
 			return (copyout(&newval, PTRIN(args->optval), len));
 			/* NOTREACHED */
+		case SO_DOMAIN:
+			len = sizeof(newval);
+			error = kern_getsockopt(td, args->s, level,
+			    name, &newval, UIO_SYSSPACE, &len);
+			if (error != 0)
+				return (error);
+			newval = bsd_to_linux_domain(newval);
+			if (newval == -1)
+				return (ENOPROTOOPT);
+			return (copyout(&newval, PTRIN(args->optval), len));
+			/* NOTREACHED */
 		default:
 			break;
 		}
diff --git a/sys/compat/linux/linux_socket.h b/sys/compat/linux/linux_socket.h
index 9c37d8c97c3d..4decb24236bb 100644
--- a/sys/compat/linux/linux_socket.h
+++ b/sys/compat/linux/linux_socket.h
@@ -199,6 +199,7 @@ int linux_accept(struct thread *td, struct linux_accept_args *args);
 #define	LINUX_SO_SNDBUFFORCE	32
 #define	LINUX_SO_RCVBUFFORCE	33
 #define	LINUX_SO_PROTOCOL	38
+#define	LINUX_SO_DOMAIN		39
 #define	LINUX_SO_PEERGROUPS	59
 
 /* Socket options */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206171939.25HJd6KC015558>