summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McDonald <danmcd@joyent.com>2020-05-29 12:44:20 -0400
committerGitHub <noreply@github.com>2020-05-29 12:44:20 -0400
commitb46b025a675e74978d102d023bc022568429d1bb (patch)
treeb95bca3f5489a02bddc382908c9d1d4a9ee41512
parent965d01d91d661bf158907bbf3082ba2df0d71cd2 (diff)
downloadillumos-joyent-b46b025a675e74978d102d023bc022568429d1bb.tar.gz
OS-8181 lx getsockopt of SO_PROTOCOL fails (#306)
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>
-rw-r--r--usr/src/uts/common/brand/lx/syscall/lx_socket.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/usr/src/uts/common/brand/lx/syscall/lx_socket.c b/usr/src/uts/common/brand/lx/syscall/lx_socket.c
index 628b3490db..b67deee14f 100644
--- a/usr/src/uts/common/brand/lx/syscall/lx_socket.c
+++ b/usr/src/uts/common/brand/lx/syscall/lx_socket.c
@@ -3974,6 +3974,20 @@ lx_getsockopt_socket(sonode_t *so, int optname, void *optval,
lx_socket_aux_data_t *sad;
switch (optname) {
+ case LX_SO_PROTOCOL:
+ /*
+ * We need to special-case netlink and AF_UNIX too.
+ */
+ if (so->so_family != AF_LX_NETLINK && so->so_family != AF_UNIX)
+ break; /* Common-case it. */
+ if (*optlen < sizeof (int)) {
+ error = EINVAL;
+ } else {
+ *intval = so->so_protocol;
+ }
+ *optlen = sizeof (int);
+ return (error);
+
case LX_SO_TYPE:
/*
* Special handling for connectionless AF_UNIX sockets.