Re: [Qemu-devel] [PATCH 1/2] linux-user: add missing UDP and IPv6 setsockopt options

2019-09-07 Thread Laurent Vivier
Le 23/08/2019 à 01:14, Shu-Chun Weng via Qemu-devel a écrit :
> 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 
> ---
>  linux-user/syscall.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 8367cb138d..8dc4255f12 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -49,8 +49,10 @@
>  #include 
>  #include 
>  //#include 
> +#include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -1837,7 +1839,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.  */

Could you also do_getsockopt()?

>  if (optlen < sizeof(uint32_t))
>  return -TARGET_EINVAL;
>  
> @@ -2488,6 +2491,7 @@ static abi_long do_getsockopt(int sockfd, int level, 
> int optname,
>  case IPV6_RECVDSTOPTS:
>  case IPV6_2292DSTOPTS:
>  case IPV6_TCLASS:
> +case IPV6_ADDR_PREFERENCES:

Could update do_setsockopt() too?

>  #ifdef IPV6_RECVPATHMTU
>  case IPV6_RECVPATHMTU:
>  #endif
> 

Thanks,
Laurent



[Qemu-devel] [PATCH 1/2] linux-user: add missing UDP and IPv6 setsockopt options

2019-08-22 Thread Shu-Chun Weng via Qemu-devel
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 
---
 linux-user/syscall.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 8367cb138d..8dc4255f12 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -49,8 +49,10 @@
 #include 
 #include 
 //#include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1837,7 +1839,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;
 
@@ -2488,6 +2491,7 @@ static abi_long do_getsockopt(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
-- 
2.23.0.187.g17f5b7556c-goog