Commit 6e3cb58fa21727929b4b983522ba3b9b0ba66f9d

Authored by Lionel Landwerlin
Committed by Riku Voipio
1 parent b975b83b

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>
linux-user/syscall.c
... ... @@ -1137,6 +1137,7 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
1137 1137 abi_long ret;
1138 1138 int val;
1139 1139 struct ip_mreqn *ip_mreq;
  1140 + struct ip_mreq_source *ip_mreq_source;
1140 1141  
1141 1142 switch(level) {
1142 1143 case SOL_TCP:
... ... @@ -1186,6 +1187,18 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
1186 1187 ret = get_errno(setsockopt(sockfd, level, optname, ip_mreq, optlen));
1187 1188 break;
1188 1189  
  1190 + case IP_BLOCK_SOURCE:
  1191 + case IP_UNBLOCK_SOURCE:
  1192 + case IP_ADD_SOURCE_MEMBERSHIP:
  1193 + case IP_DROP_SOURCE_MEMBERSHIP:
  1194 + if (optlen != sizeof (struct target_ip_mreq_source))
  1195 + return -TARGET_EINVAL;
  1196 +
  1197 + ip_mreq_source = lock_user(VERIFY_READ, optval_addr, optlen, 1);
  1198 + ret = get_errno(setsockopt(sockfd, level, optname, ip_mreq_source, optlen));
  1199 + unlock_user (ip_mreq_source, optval_addr, 0);
  1200 + break;
  1201 +
1189 1202 default:
1190 1203 goto unimplemented;
1191 1204 }
... ...
linux-user/syscall_defs.h
... ... @@ -126,6 +126,13 @@ struct target_ip_mreqn {
126 126 abi_long imr_ifindex;
127 127 };
128 128  
  129 +struct target_ip_mreq_source {
  130 + /* big endian */
  131 + uint32_t imr_multiaddr;
  132 + uint32_t imr_interface;
  133 + uint32_t imr_sourceaddr;
  134 +};
  135 +
129 136 struct target_timeval {
130 137 abi_long tv_sec;
131 138 abi_long tv_usec;
... ...