aboutsummaryrefslogtreecommitdiff
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorMathis Marion <mathis.marion@silabs.com>2023-03-07 16:42:55 +0100
committerLaurent Vivier <laurent@vivier.eu>2023-03-10 20:45:47 +0100
commit44cf6731d6b9a48bcd57392e8cd6f0f712aaa677 (patch)
treebbed52466f5142c1d6e19e94fd0b5dc8d5590cdc /linux-user/syscall.c
parentdae81a083b13fe1607d369f103b0357a610a3167 (diff)
downloadqemu-44cf6731d6b9a48bcd57392e8cd6f0f712aaa677.zip
qemu-44cf6731d6b9a48bcd57392e8cd6f0f712aaa677.tar.gz
qemu-44cf6731d6b9a48bcd57392e8cd6f0f712aaa677.tar.bz2
linux-user: fix sockaddr_in6 endianness
The sin6_scope_id field uses the host byte order, so there is a conversion to be made when host and target endianness differ. Signed-off-by: Mathis Marion <mathis.marion@silabs.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230307154256.101528-2-Mathis.Marion@silabs.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 931f9db..05c8107 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1714,6 +1714,11 @@ static inline abi_long target_to_host_sockaddr(int fd, struct sockaddr *addr,
lladdr = (struct target_sockaddr_ll *)addr;
lladdr->sll_ifindex = tswap32(lladdr->sll_ifindex);
lladdr->sll_hatype = tswap16(lladdr->sll_hatype);
+ } else if (sa_family == AF_INET6) {
+ struct sockaddr_in6 *in6addr;
+
+ in6addr = (struct sockaddr_in6 *)addr;
+ in6addr->sin6_scope_id = tswap32(in6addr->sin6_scope_id);
}
unlock_user(target_saddr, target_addr, 0);