Skip to content

Commit

Permalink
OS-8181 lx getsockopt of SO_PROTOCOL fails (#306)
Browse files Browse the repository at this point in the history
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>
  • Loading branch information
Dan McDonald committed May 29, 2020
1 parent 965d01d commit b46b025
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions usr/src/uts/common/brand/lx/syscall/lx_socket.c
Expand Up @@ -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.
Expand Down

0 comments on commit b46b025

Please sign in to comment.