Page MenuHomeFreeBSD

D28164.id82285.diff
No OneTemporary

D28164.id82285.diff

Index: sys/compat/linux/linux_socket.h
===================================================================
--- sys/compat/linux/linux_socket.h
+++ sys/compat/linux/linux_socket.h
@@ -195,6 +195,7 @@
#endif
#define LINUX_SO_TIMESTAMP 29
#define LINUX_SO_ACCEPTCONN 30
+#define LINUX_SO_PEERSEC 31
#define LINUX_SO_SNDBUFFORCE 32
#define LINUX_SO_RCVBUFFORCE 33
#define LINUX_SO_PROTOCOL 38
Index: sys/compat/linux/linux_socket.c
===================================================================
--- sys/compat/linux/linux_socket.c
+++ sys/compat/linux/linux_socket.c
@@ -82,6 +82,8 @@
#include <compat/linux/linux_timer.h>
#include <compat/linux/linux_util.h>
+#define SECURITY_CONTEXT_STRING "unconfined"
+
static int linux_sendmsg_common(struct thread *, l_int, struct l_msghdr *,
l_uint);
static int linux_recvmsg_common(struct thread *, l_int, struct l_msghdr *,
@@ -1861,6 +1863,27 @@
return (error);
}
+static int
+linux_getsockopt_so_peersec(struct thread *td,
+ struct linux_getsockopt_args *args)
+{
+ socklen_t len;
+ int error;
+
+ len = sizeof(SECURITY_CONTEXT_STRING);
+ if (args->optlen < len) {
+ error = ERANGE;
+ error = copyout(&len, PTRIN(args->optlen), sizeof(len));
+ return (error);
+ }
+
+ error = copyout(SECURITY_CONTEXT_STRING,
+ PTRIN(args->optval), sizeof(SECURITY_CONTEXT_STRING));
+ if (error == 0)
+ error = copyout(&len, PTRIN(args->optlen), sizeof(len));
+ return (error);
+}
+
int
linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args)
{
@@ -1875,6 +1898,8 @@
level = linux_to_bsd_sockopt_level(args->level);
switch (level) {
case SOL_SOCKET:
+ if (args->optname == LINUX_SO_PEERSEC)
+ return (linux_getsockopt_so_peersec(td, args));
name = linux_to_bsd_so_sockopt(args->optname);
switch (name) {
case LOCAL_CREDS_PERSISTENT:

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 17, 12:11 AM (2 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23809830
Default Alt Text
D28164.id82285.diff (1 KB)

Event Timeline