[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/6] linux-user: add missing UDP and IPv6 get/setsockopt options
From: |
Shu-Chun Weng |
Subject: |
[PATCH 2/6] linux-user: add missing UDP and IPv6 get/setsockopt options |
Date: |
Wed, 22 Jul 2020 17:19:11 -0700 |
UDP: SOL_UDP manipulate options at UDP level. All six options currently
defined in linux source include/uapi/linux/udp.h take integer values.
IPv6: IPV6_ADDR_PREFERENCES (RFC5014: Source address selection) was not
supported.
Signed-off-by: Shu-Chun Weng <scw@google.com>
---
linux-user/syscall.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f97337b0b4..a53db446d4 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -51,8 +51,10 @@
#include <sys/sysinfo.h>
#include <sys/signalfd.h>
//#include <sys/user.h>
+#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
+#include <netinet/udp.h>
#include <linux/wireless.h>
#include <linux/icmp.h>
#include <linux/icmpv6.h>
@@ -1945,7 +1947,8 @@ static abi_long do_setsockopt(int sockfd, int level, int
optname,
switch(level) {
case SOL_TCP:
- /* TCP options all take an 'int' value. */
+ case SOL_UDP:
+ /* TCP and UDP options all take an 'int' value. */
if (optlen < sizeof(uint32_t))
return -TARGET_EINVAL;
@@ -2031,6 +2034,7 @@ static abi_long do_setsockopt(int sockfd, int level, int
optname,
case IPV6_RECVDSTOPTS:
case IPV6_2292DSTOPTS:
case IPV6_TCLASS:
+ case IPV6_ADDR_PREFERENCES:
#ifdef IPV6_RECVPATHMTU
case IPV6_RECVPATHMTU:
#endif
@@ -2593,7 +2597,8 @@ get_timeout:
}
break;
case SOL_TCP:
- /* TCP options all take an 'int' value. */
+ case SOL_UDP:
+ /* TCP and UDP options all take an 'int' value. */
int_case:
if (get_user_u32(len, optlen))
return -TARGET_EFAULT;
@@ -2684,6 +2689,7 @@ get_timeout:
case IPV6_RECVDSTOPTS:
case IPV6_2292DSTOPTS:
case IPV6_TCLASS:
+ case IPV6_ADDR_PREFERENCES:
#ifdef IPV6_RECVPATHMTU
case IPV6_RECVPATHMTU:
#endif
--
2.28.0.rc0.105.gf9edc3c819-goog
- [PATCH 0/6] fcntl, sockopt, and ioctl options, Shu-Chun Weng, 2020/07/22
- [PATCH 1/6] linux-user: Support F_ADD_SEALS and F_GET_SEALS fcntls, Shu-Chun Weng, 2020/07/22
- [PATCH 2/6] linux-user: add missing UDP and IPv6 get/setsockopt options,
Shu-Chun Weng <=
- [PATCH 4/6] linux-user: setsockopt() SO_TIMESTAMPNS and SO_TIMESTAMPING, Shu-Chun Weng, 2020/07/22
- [PATCH 3/6] linux-user: Update SO_TIMESTAMP to SO_TIMESTAMP_OLD/NEW, Shu-Chun Weng, 2020/07/22
- [PATCH 5/6] thunk: supports flexible arrays, Shu-Chun Weng, 2020/07/22
- [PATCH 6/6] linux-user: Add support for SIOCETHTOOL ioctl, Shu-Chun Weng, 2020/07/22