linux-user: add missing UDP get/setsockopt option
SOL_UDP manipulate options at UDP level. All six options currently defined in linux source include/uapi/linux/udp.h take integer values. Signed-off-by: Shu-Chun Weng <scw@google.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20201218193213.3566856-3-scw@google.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
2bb963ff6b
commit
fe51b0a597
|
@ -7,6 +7,7 @@
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
|
#include <netinet/udp.h>
|
||||||
#include <linux/if_packet.h>
|
#include <linux/if_packet.h>
|
||||||
#include <linux/netlink.h>
|
#include <linux/netlink.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
|
@ -2644,6 +2645,11 @@ static void do_print_sockopt(const char *name, abi_long arg1)
|
||||||
print_raw_param(TARGET_ABI_FMT_ld, optname, 0);
|
print_raw_param(TARGET_ABI_FMT_ld, optname, 0);
|
||||||
print_pointer(optval, 0);
|
print_pointer(optval, 0);
|
||||||
break;
|
break;
|
||||||
|
case SOL_UDP:
|
||||||
|
qemu_log("SOL_UDP,");
|
||||||
|
print_raw_param(TARGET_ABI_FMT_ld, optname, 0);
|
||||||
|
print_pointer(optval, 0);
|
||||||
|
break;
|
||||||
case SOL_IP:
|
case SOL_IP:
|
||||||
qemu_log("SOL_IP,");
|
qemu_log("SOL_IP,");
|
||||||
print_raw_param(TARGET_ABI_FMT_ld, optname, 0);
|
print_raw_param(TARGET_ABI_FMT_ld, optname, 0);
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
//#include <sys/user.h>
|
//#include <sys/user.h>
|
||||||
#include <netinet/ip.h>
|
#include <netinet/ip.h>
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
|
#include <netinet/udp.h>
|
||||||
#include <linux/wireless.h>
|
#include <linux/wireless.h>
|
||||||
#include <linux/icmp.h>
|
#include <linux/icmp.h>
|
||||||
#include <linux/icmpv6.h>
|
#include <linux/icmpv6.h>
|
||||||
|
@ -2184,7 +2185,8 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
|
||||||
|
|
||||||
switch(level) {
|
switch(level) {
|
||||||
case SOL_TCP:
|
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))
|
if (optlen < sizeof(uint32_t))
|
||||||
return -TARGET_EINVAL;
|
return -TARGET_EINVAL;
|
||||||
|
|
||||||
|
@ -2832,7 +2834,8 @@ get_timeout:
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SOL_TCP:
|
case SOL_TCP:
|
||||||
/* TCP options all take an 'int' value. */
|
case SOL_UDP:
|
||||||
|
/* TCP and UDP options all take an 'int' value. */
|
||||||
int_case:
|
int_case:
|
||||||
if (get_user_u32(len, optlen))
|
if (get_user_u32(len, optlen))
|
||||||
return -TARGET_EFAULT;
|
return -TARGET_EFAULT;
|
||||||
|
|
Loading…
Reference in a new issue