qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Laurent Vivier <laurent@vivier.eu>
Cc: Riku Voipio <riku.voipio@iki.fi>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v2 4/4] linux-user: manage bind with a socket of SOCK_PACKET type.
Date: Wed, 28 Oct 2015 19:20:49 +0000	[thread overview]
Message-ID: <CAFEAcA8DfSKxp4y5HSqc_xZm9UQGV1SE+sy+DXVSHhtFaXi5mw@mail.gmail.com> (raw)
In-Reply-To: <1446059583-16340-5-git-send-email-laurent@vivier.eu>

On 28 October 2015 at 19:13, Laurent Vivier <laurent@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 <laurent@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.maydell@linaro.org>

thanks
-- PMM

  reply	other threads:[~2015-10-28 19:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-28 19:12 [Qemu-devel] [PATCH v2 0/4] linux-user: manage SOCK_PACKET socket type Laurent Vivier
2015-10-28 19:13 ` [Qemu-devel] [PATCH v2 1/4] linux-user: SOCK_PACKET uses network endian to encode protocol in socket() Laurent Vivier
2015-10-28 19:14   ` Peter Maydell
2015-10-28 19:13 ` [Qemu-devel] [PATCH v2 2/4] linux-user: rename TargetFdFunc to TargetFdDataFunc, and structure fields accordingly Laurent Vivier
2015-10-28 19:15   ` Peter Maydell
2015-10-28 19:13 ` [Qemu-devel] [PATCH v2 3/4] linux-user: add a function hook to translate sockaddr Laurent Vivier
2015-10-28 19:18   ` Peter Maydell
2015-10-28 19:13 ` [Qemu-devel] [PATCH v2 4/4] linux-user: manage bind with a socket of SOCK_PACKET type Laurent Vivier
2015-10-28 19:20   ` Peter Maydell [this message]
2015-10-28 19:25     ` Laurent Vivier
2015-10-28 20:09       ` Peter Maydell
2015-10-28 19:21 ` [Qemu-devel] [PATCH v2 0/4] linux-user: manage SOCK_PACKET socket type Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFEAcA8DfSKxp4y5HSqc_xZm9UQGV1SE+sy+DXVSHhtFaXi5mw@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).