aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/syscall.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 06a59b4417..965d7db7df 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2089,6 +2089,12 @@ static abi_long do_socket(int domain, int type, int protocol)
if (domain == PF_NETLINK)
return -TARGET_EAFNOSUPPORT;
+
+ if (domain == AF_PACKET ||
+ (domain == AF_INET && type == SOCK_PACKET)) {
+ protocol = tswap16(protocol);
+ }
+
ret = get_errno(socket(domain, type, protocol));
if (ret >= 0) {
ret = sock_flags_fixup(ret, target_type);