From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X72rm-0004Rj-05 for qemu-devel@nongnu.org; Tue, 15 Jul 2014 09:33:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X72rl-0007IF-6C for qemu-devel@nongnu.org; Tue, 15 Jul 2014 09:33:57 -0400 Received: from [2001:4b98:dc0:45:216:3eff:fe3d:166f] (port=52295 helo=afflict.kos.to) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X72rk-0007HL-D7 for qemu-devel@nongnu.org; Tue, 15 Jul 2014 09:33:56 -0400 Date: Tue, 15 Jul 2014 16:33:55 +0300 From: Riku Voipio Message-ID: <20140715133355.GD607@afflict.kos.to> References: <1405172827-30693-1-git-send-email-Joakim.Tjernlund@transmode.se> <1405172827-30693-2-git-send-email-Joakim.Tjernlund@transmode.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1405172827-30693-2-git-send-email-Joakim.Tjernlund@transmode.se> Subject: Re: [Qemu-devel] [PATCH 2/2 v3] linux-user: handle AF_PACKET sockaddrs in target_to_host_sockaddr List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Joakim Tjernlund Cc: qemu-devel@nongnu.org On Sat, Jul 12, 2014 at 03:47:07PM +0200, Joakim Tjernlund wrote: > Implement conversion of the AF_PACKET sockaddr subtype > in target_to_host_sockaddr. Thanks, Applied to linux-user tree, Riku > Signed-off-by: Joakim Tjernlund > --- > 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 3ef046a..a50229d 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; > -- > 1.8.5.5 >