qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Riku Voipio <riku.voipio@iki.fi>
To: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2 v3] qemu-user: Impl. setsockopt(SO_BINDTODEVICE)
Date: Tue, 15 Jul 2014 16:33:14 +0300	[thread overview]
Message-ID: <20140715133314.GC607@afflict.kos.to> (raw)
In-Reply-To: <1405172827-30693-1-git-send-email-Joakim.Tjernlund@transmode.se>

On Sat, Jul 12, 2014 at 03:47:06PM +0200, Joakim Tjernlund wrote:
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>

Thanks, applied to linux-user tree,
Riku

> ---
>  linux-user/syscall.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 57c1664..3ef046a 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -1497,6 +1497,25 @@ set_timeout:
>                  unlock_user_struct(tfprog, optval_addr, 1);
>                  return ret;
>          }
> +	case TARGET_SO_BINDTODEVICE:
> +	{
> +		char *dev_ifname, *addr_ifname;
> +
> +		if (optlen > IFNAMSIZ - 1) {
> +		    optlen = IFNAMSIZ - 1;
> +		}
> +		dev_ifname = lock_user(VERIFY_READ, optval_addr, optlen, 1);
> +		if (!dev_ifname) {
> +		    return -TARGET_EFAULT;
> +		}
> +		optname = SO_BINDTODEVICE;
> +		addr_ifname = alloca(IFNAMSIZ);
> +		memcpy(addr_ifname, dev_ifname, optlen);
> +		addr_ifname[optlen] = 0;
> +		ret = get_errno(setsockopt(sockfd, level, optname, addr_ifname, optlen));
> +		unlock_user (dev_ifname, optval_addr, 0);
> +		return ret;
> +	}
>              /* Options with 'int' argument.  */
>          case TARGET_SO_DEBUG:
>  		optname = SO_DEBUG;
> -- 
> 1.8.5.5
> 

      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
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 [this message]

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=20140715133314.GC607@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).