OSDN Git Service

linux-user: manage bind with a socket of SOCK_PACKET type.
authorLaurent Vivier <laurent@vivier.eu>
Wed, 28 Oct 2015 20:40:45 +0000 (21:40 +0100)
committerRiku Voipio <riku.voipio@linaro.org>
Fri, 8 Jan 2016 13:20:15 +0000 (15:20 +0200)
commit0cf227229bfd288a67fd9d4005ee01ffdb492c70
tree4477c2d229a3fb89acdf810657df3ca02194d5c8
parent7b36f78274e701ee17db3171ec7e9f732a60f031
linux-user: manage bind with a socket of SOCK_PACKET type.

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 <sys/if_ether.h> and spkt_device is the
  device name as a null-terminated string, for example, eth0.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
linux-user/syscall.c