From: Riku Voipio <riku.voipio@iki.fi>
To: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2 v3] linux-user: handle AF_PACKET sockaddrs in target_to_host_sockaddr
Date: Tue, 15 Jul 2014 16:33:55 +0300 [thread overview]
Message-ID: <20140715133355.GD607@afflict.kos.to> (raw)
In-Reply-To: <1405172827-30693-2-git-send-email-Joakim.Tjernlund@transmode.se>
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 <Joakim.Tjernlund@transmode.se>
> ---
> 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
>
next prev parent reply other threads:[~2014-07-15 13:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-12 13:47 [Qemu-devel] [PATCH 1/2 v3] qemu-user: Impl. setsockopt(SO_BINDTODEVICE) Joakim Tjernlund
2014-07-12 13:47 ` [Qemu-devel] [PATCH 2/2 v3] linux-user: handle AF_PACKET sockaddrs in target_to_host_sockaddr Joakim Tjernlund
2014-07-12 16:32 ` Peter Maydell
2014-07-15 13:33 ` Riku Voipio [this message]
2014-07-12 16:31 ` [Qemu-devel] [PATCH 1/2 v3] qemu-user: Impl. setsockopt(SO_BINDTODEVICE) Peter Maydell
2014-07-15 13:33 ` Riku Voipio
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=20140715133355.GD607@afflict.kos.to \
--to=riku.voipio@iki.fi \
--cc=Joakim.Tjernlund@transmode.se \
--cc=qemu-devel@nongnu.org \
/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).