qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/2 v2] qemu-user: Impl. setsockopt(SO_BINDTODEVICE)
@ 2014-07-12  9:46 Joakim Tjernlund
  2014-07-12  9:46 ` [Qemu-devel] [PATCH 2/2 v2] linux-user: impl. sockaddr_ll Joakim Tjernlund
  2014-07-12 10:53 ` [Qemu-devel] [PATCH 1/2 v2] qemu-user: Impl. setsockopt(SO_BINDTODEVICE) Peter Maydell
  0 siblings, 2 replies; 4+ messages in thread
From: Joakim Tjernlund @ 2014-07-12  9:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Joakim Tjernlund

---
 linux-user/syscall.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 57c1664..5a07d9c 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;
+
+		dev_ifname = lock_user(VERIFY_READ, optval_addr, optlen, 1);
+		if (!dev_ifname) {
+			return -TARGET_EFAULT;
+		}
+		if (optlen > IFNAMSIZ - 1) {
+			optlen = IFNAMSIZ - 1;
+		}
+		optname = SO_BINDTODEVICE;
+		addr_ifname = alloca(IFNAMSIZ);
+		memcpy(addr_ifname, dev_ifname, IFNAMSIZ);
+		addr_ifname[IFNAMSIZ - 1] = 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-12 10:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-12  9:46 [Qemu-devel] [PATCH 1/2 v2] qemu-user: Impl. setsockopt(SO_BINDTODEVICE) Joakim Tjernlund
2014-07-12  9:46 ` [Qemu-devel] [PATCH 2/2 v2] linux-user: impl. sockaddr_ll Joakim Tjernlund
2014-07-12 10:56   ` Peter Maydell
2014-07-12 10:53 ` [Qemu-devel] [PATCH 1/2 v2] qemu-user: Impl. setsockopt(SO_BINDTODEVICE) Peter Maydell

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).