summary refs log tree commit diff stats
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorLionel Landwerlin <lionel.landwerlin@openwide.fr>2009-04-25 23:31:18 +0200
committerRiku Voipio <riku.voipio@nokia.com>2009-06-16 16:56:29 +0300
commit6e3cb58fa21727929b4b983522ba3b9b0ba66f9d (patch)
tree3424d0ad1dedd22935048d1357608dd720440043 /linux-user/syscall.c
parentb975b83becfc0d17b490e64a40f5c9c3e69f574f (diff)
downloadfocaccia-qemu-6e3cb58fa21727929b4b983522ba3b9b0ba66f9d.tar.gz
focaccia-qemu-6e3cb58fa21727929b4b983522ba3b9b0ba66f9d.zip
linux-user: Added IP_(UN)BLOCK_SOURCE/IP_(ADD|DROP)_SOURCE_MEMBERSHIP flags to setsockopt
linux-user: Added IP_(UN)BLOCK_SOURCE/IP_(ADD|DROP)_SOURCE_MEMBERSHIP flags to setsockopt

Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 76481261b1..674942cdf4 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1137,6 +1137,7 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
     abi_long ret;
     int val;
     struct ip_mreqn *ip_mreq;
+    struct ip_mreq_source *ip_mreq_source;
 
     switch(level) {
     case SOL_TCP:
@@ -1186,6 +1187,18 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
             ret = get_errno(setsockopt(sockfd, level, optname, ip_mreq, optlen));
             break;
 
+        case IP_BLOCK_SOURCE:
+        case IP_UNBLOCK_SOURCE:
+        case IP_ADD_SOURCE_MEMBERSHIP:
+        case IP_DROP_SOURCE_MEMBERSHIP:
+            if (optlen != sizeof (struct target_ip_mreq_source))
+                return -TARGET_EINVAL;
+
+            ip_mreq_source = lock_user(VERIFY_READ, optval_addr, optlen, 1);
+            ret = get_errno(setsockopt(sockfd, level, optname, ip_mreq_source, optlen));
+            unlock_user (ip_mreq_source, optval_addr, 0);
+            break;
+
         default:
             goto unimplemented;
         }