On 28 October 2015 at 19:13, Laurent Vivier <laur...@vivier.eu> 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 <sys/if_ether.h> and spkt_device is the
>   device name as a null-terminated string, for example, eth0.
>
> Signed-off-by: Laurent Vivier <laur...@vivier.eu>
> ---
>  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 ?

Otherwise,
Reviewed-by: Peter Maydell <peter.mayd...@linaro.org>

thanks
-- PMM

Reply via email to