From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrWLN-0002qV-Lb for qemu-devel@nongnu.org; Wed, 28 Oct 2015 15:25:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZrWLK-0001Q7-FS for qemu-devel@nongnu.org; Wed, 28 Oct 2015 15:25:09 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:53155) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrWLK-0001Pq-9s for qemu-devel@nongnu.org; Wed, 28 Oct 2015 15:25:06 -0400 References: <1446059583-16340-1-git-send-email-laurent@vivier.eu> <1446059583-16340-5-git-send-email-laurent@vivier.eu> From: Laurent Vivier Message-ID: <5631210F.20302@vivier.eu> Date: Wed, 28 Oct 2015 20:25:03 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v2 4/4] linux-user: manage bind with a socket of SOCK_PACKET type. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Riku Voipio , QEMU Developers Le 28/10/2015 20:20, Peter Maydell a écrit : > On 28 October 2015 at 19:13, Laurent Vivier wrote: >> This is obsolete, but if we want to use dhcp with an old distro (like debian >> etch), we need it. Some users (like dhclient) use SOCK_PACKET with AF_PACKET >> and the kernel allows that. >> >> packet(7) >> >> In Linux 2.0, the only way to get a packet socket was by calling >> socket(AF_INET, SOCK_PACKET, protocol). This is still supported but >> strongly deprecated. The main difference between the two methods is >> that SOCK_PACKET uses the old struct sockaddr_pkt to specify an inter‐ >> face, which doesn't provide physical layer independence. >> >> struct sockaddr_pkt { >> unsigned short spkt_family; >> unsigned char spkt_device[14]; >> unsigned short spkt_protocol; >> }; >> >> spkt_family contains the device type, spkt_protocol is the IEEE 802.3 >> protocol type as defined in and spkt_device is the >> device name as a null-terminated string, for example, eth0. >> >> Signed-off-by: Laurent Vivier >> --- >> linux-user/syscall.c | 30 ++++++++++++++++++++++++++++++ >> 1 file changed, 30 insertions(+) >> >> diff --git a/linux-user/syscall.c b/linux-user/syscall.c >> index 31b5c2c..f048437 100644 >> --- a/linux-user/syscall.c >> +++ b/linux-user/syscall.c >> @@ -2086,6 +2086,30 @@ static int sock_flags_fixup(int fd, int target_type) >> return fd; >> } >> >> +static abi_long packet_target_to_host_addr(void *host_addr, >> + abi_ulong target_addr, >> + socklen_t len) > > Should the function name be ..._to_host_sockaddr ? It was what I did in my first draft, but as I have called the type TargetFdDataFunc and TargetFdAddrFunc, I have chosen to call the function _addr. If you think it is better, I can change that. > > Otherwise, > Reviewed-by: Peter Maydell > > thanks > -- PMM >