Skip to content

Commit

Permalink
linux-user: add TARGET_SO_{DOMAIN,PROTOCOL}
Browse files Browse the repository at this point in the history
These were defined for other platforms but mistakenly left out of mips
and generic, so this commit adds them to the places missing. Then it
makes them be translated in getsockopt.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20210204153925.2030606-1-Jason@zx2c4.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
  • Loading branch information
zx2c4 authored and vivier committed Feb 13, 2021
1 parent 4df7b7f commit ec63e06
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions linux-user/generic/sockbits.h
Expand Up @@ -55,4 +55,7 @@
#define TARGET_SO_ACCEPTCONN 30

#define TARGET_SO_PEERSEC 31

#define TARGET_SO_PROTOCOL 38
#define TARGET_SO_DOMAIN 39
#endif
2 changes: 2 additions & 0 deletions linux-user/mips/sockbits.h
Expand Up @@ -40,6 +40,8 @@
#define TARGET_SO_SNDTIMEO 0x1005 /* send timeout */
#define TARGET_SO_RCVTIMEO 0x1006 /* receive timeout */
#define TARGET_SO_ACCEPTCONN 0x1009
#define TARGET_SO_PROTOCOL 0x1028 /* protocol type */
#define TARGET_SO_DOMAIN 0x1029 /* domain/socket family */

/* linux-specific, might as well be the same as on i386 */
#define TARGET_SO_NO_CHECK 11
Expand Down
6 changes: 6 additions & 0 deletions linux-user/syscall.c
Expand Up @@ -2837,6 +2837,12 @@ static abi_long do_getsockopt(int sockfd, int level, int optname,
case TARGET_SO_ACCEPTCONN:
optname = SO_ACCEPTCONN;
goto int_case;
case TARGET_SO_PROTOCOL:
optname = SO_PROTOCOL;
goto int_case;
case TARGET_SO_DOMAIN:
optname = SO_DOMAIN;
goto int_case;
default:
goto int_case;
}
Expand Down

0 comments on commit ec63e06

Please sign in to comment.