Received: from eggs.gnu.org ([2001:4830:134:3::10]:38793) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAN6N-0002eh-9o for qemu-devel@nongnu.org; Wed, 10 Oct 2018 18:37:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gAN6K-0000NU-RL for qemu-devel@nongnu.org; Wed, 10 Oct 2018 18:37:10 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:37052) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gAN6K-0000Jk-Ha for qemu-devel@nongnu.org; Wed, 10 Oct 2018 18:37:08 -0400 Received: by mail-wm1-x332.google.com with SMTP id 185-v6so7375558wmt.2 for ; Wed, 10 Oct 2018 15:37:08 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Thu, 11 Oct 2018 00:36:51 +0200 Message-Id: <20181010223656.31632-6-f4bug@amsat.org> In-Reply-To: <20181010223656.31632-1-f4bug@amsat.org> References: <20181010223656.31632-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v5 05/10] linux-user/syscall: Introduce target_sockaddr_nl List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laurent Vivier Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, Riku Voipio , =?UTF-8?q?Guido=20G=C3=BCnther?= Signed-off-by: Philippe Mathieu-Daudé Tested-By: Guido Günther --- linux-user/syscall_defs.h | 7 +++++++ linux-user/syscall.c | 6 ++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 18d434d6dc..8ddeec1bae 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -152,6 +152,13 @@ struct target_sockaddr_un { uint8_t sun_path[108]; }; +struct target_sockaddr_nl { + uint16_t nl_family; /* AF_NETLINK */ + uint16_t __pad; + uint32_t nl_pid; + uint32_t nl_groups; +}; + struct target_in_addr { uint32_t s_addr; /* big endian */ }; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index ea503381aa..e9cadfd748 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1447,8 +1447,10 @@ static inline abi_long host_to_target_sockaddr(abi_ulong target_addr, sizeof(target_saddr->sa_family)) { target_saddr->sa_family = tswap16(addr->sa_family); } - if (addr->sa_family == AF_NETLINK && len >= sizeof(struct sockaddr_nl)) { - struct sockaddr_nl *target_nl = (struct sockaddr_nl *)target_saddr; + if (addr->sa_family == AF_NETLINK && + len >= sizeof(struct target_sockaddr_nl)) { + struct target_sockaddr_nl *target_nl = + (struct target_sockaddr_nl *)target_saddr; target_nl->nl_pid = tswap32(target_nl->nl_pid); target_nl->nl_groups = tswap32(target_nl->nl_groups); } else if (addr->sa_family == AF_PACKET) { -- 2.19.1