From: Laurent Vivier <laurent@vivier.eu>
To: Shu-Chun Weng <scw@google.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 2/8] linux-user: add missing UDP get/setsockopt option
Date: Tue, 11 Aug 2020 16:21:53 +0200 [thread overview]
Message-ID: <d21e0d92-3d59-a83d-4ac3-7a1e68109b2e@vivier.eu> (raw)
In-Reply-To: <71ad91e4ee9f41f439086d8f9de60501ad304859.1597129029.git.scw@google.com>
Le 11/08/2020 à 09:09, Shu-Chun Weng a écrit :
> 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>
> ---
> v1 -> v2:
> Split out SOL_UDP into own patch.
> Updated do_print_sockopt().
>
> linux-user/strace.c | 6 ++++++
> linux-user/syscall.c | 7 +++++--
> 2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/linux-user/strace.c b/linux-user/strace.c
> index 4fff24b880..854b54a2ad 100644
> --- a/linux-user/strace.c
> +++ b/linux-user/strace.c
> @@ -7,6 +7,7 @@
> #include <sys/mount.h>
> #include <arpa/inet.h>
> #include <netinet/tcp.h>
> +#include <netinet/udp.h>
> #include <linux/if_packet.h>
> #include <linux/netlink.h>
> #include <sched.h>
> @@ -2190,6 +2191,11 @@ static void do_print_sockopt(const char *name, abi_long arg1)
> print_raw_param(TARGET_ABI_FMT_ld, optname, 0);
> print_pointer(optval, 0);
> 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:
> qemu_log("SOL_IP,");
> print_raw_param(TARGET_ABI_FMT_ld, optname, 0);
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 5645862798..177eec5201 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -53,6 +53,7 @@
> //#include <sys/user.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>
> @@ -1938,7 +1939,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;
>
> @@ -2586,7 +2588,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;
>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
I'm wondering if the int_case of getsockopt() manages correctly the
length: length can be between 0 and sizeof(int), but the int_case only
uses a put_user_u32() or a put_user_u8(). Do we need the put_user_u16()?
Thanks,
Laurent
next prev parent reply other threads:[~2020-08-11 14:22 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-11 7:09 [PATCH v2 0/8] fcntl, sockopt, and ioctl options Shu-Chun Weng
2020-08-11 7:09 ` [PATCH v2 1/8] linux-user: Support F_ADD_SEALS and F_GET_SEALS fcntls Shu-Chun Weng
2020-08-11 14:09 ` Laurent Vivier
2020-08-11 7:09 ` [PATCH v2 2/8] linux-user: add missing UDP get/setsockopt option Shu-Chun Weng
2020-08-11 14:21 ` Laurent Vivier [this message]
2020-08-11 20:04 ` Shu-Chun Weng
2020-08-11 7:09 ` [PATCH v2 3/8] linux-user: add missing IPv6 " Shu-Chun Weng
2020-08-11 7:09 ` [PATCH v2 4/8] linux-user: Add IPv6 options to do_print_sockopt() Shu-Chun Weng
2020-09-17 7:26 ` Shu-Chun Weng
2020-09-29 23:29 ` Laurent Vivier
2020-12-18 3:58 ` Shu-Chun Weng
2020-08-11 7:09 ` [PATCH v2 5/8] linux-user: Update SO_TIMESTAMP to SO_TIMESTAMP_OLD/NEW Shu-Chun Weng
2020-09-17 7:29 ` Shu-Chun Weng
2020-12-18 4:01 ` Shu-Chun Weng
2020-08-11 7:09 ` [PATCH v2 6/8] linux-user: setsockopt() SO_TIMESTAMPNS and SO_TIMESTAMPING Shu-Chun Weng
2020-12-18 4:02 ` Shu-Chun Weng
2020-08-11 7:09 ` [PATCH v2 7/8] thunk: supports flexible arrays Shu-Chun Weng
2020-08-11 21:39 ` Shu-Chun Weng
2020-12-18 4:03 ` Shu-Chun Weng
2020-08-11 7:09 ` [PATCH v2 8/8] linux-user: Add support for SIOCETHTOOL ioctl Shu-Chun Weng
2020-12-18 4:03 ` Shu-Chun Weng
2020-12-18 8:24 ` [PATCH v2 0/8] fcntl, sockopt, and ioctl options Laurent Vivier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d21e0d92-3d59-a83d-4ac3-7a1e68109b2e@vivier.eu \
--to=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=scw@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).