From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X73fG-0005gN-UP for qemu-devel@nongnu.org; Tue, 15 Jul 2014 10:25:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X73fA-0007WO-8l for qemu-devel@nongnu.org; Tue, 15 Jul 2014 10:25:06 -0400 Received: from afflict.kos.to ([92.243.29.197]:37252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X73fA-0007W7-2T for qemu-devel@nongnu.org; Tue, 15 Jul 2014 10:25:00 -0400 From: riku.voipio@linaro.org Date: Tue, 15 Jul 2014 17:24:55 +0300 Message-Id: <33a29b51c9fb56abd94d751dd3a51b84b82c8379.1405434118.git.riku.voipio@linaro.org> In-Reply-To: References: Subject: [Qemu-devel] [PULL for-2.1 3/5] linux-user: handle AF_PACKET sockaddrs in target_to_host_sockaddr List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Joakim Tjernlund From: Joakim Tjernlund Implement conversion of the AF_PACKET sockaddr subtype in target_to_host_sockaddr. Signed-off-by: Joakim Tjernlund Reviewed-by: Peter Maydell Signed-off-by: Riku Voipio --- linux-user/syscall.c | 7 +++++++ linux-user/syscall_defs.h | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index dcf1323..7163ade 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1140,6 +1140,13 @@ static inline abi_long target_to_host_sockaddr(struct sockaddr *addr, memcpy(addr, target_saddr, len); addr->sa_family = sa_family; + if (sa_family == AF_PACKET) { + struct target_sockaddr_ll *lladdr; + + lladdr = (struct target_sockaddr_ll *)addr; + lladdr->sll_ifindex = tswap32(lladdr->sll_ifindex); + lladdr->sll_hatype = tswap16(lladdr->sll_hatype); + } unlock_user(target_saddr, target_addr, 0); return 0; diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 8563027..c9e6323 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -121,6 +121,16 @@ struct target_sockaddr { uint8_t sa_data[14]; }; +struct target_sockaddr_ll { + uint16_t sll_family; /* Always AF_PACKET */ + uint16_t sll_protocol; /* Physical layer protocol */ + int sll_ifindex; /* Interface number */ + uint16_t sll_hatype; /* ARP hardware type */ + uint8_t sll_pkttype; /* Packet type */ + uint8_t sll_halen; /* Length of address */ + uint8_t sll_addr[8]; /* Physical layer address */ +}; + struct target_sock_filter { abi_ushort code; uint8_t jt; -- 2.0.0