summaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2014-07-12 15:47:06 +0200
committerRiku Voipio <riku.voipio@linaro.org>2014-07-15 16:28:20 +0300
commit451aaf688c709c91a0d511c24624104677cc754e (patch)
treeb5a3510e9ae7ef209204b5e76af674ea55c81766 /linux-user
parent27a07827c4a56b65744c061fff78f7ca76cd934e (diff)
downloadqemu-451aaf688c709c91a0d511c24624104677cc754e.tar.gz
qemu-451aaf688c709c91a0d511c24624104677cc754e.tar.bz2
qemu-451aaf688c709c91a0d511c24624104677cc754e.zip
qemu-user: Impl. setsockopt(SO_BINDTODEVICE)
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/syscall.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 5a272d3d08..dcf13238e5 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;