Hi Laurent,

Can you please take a look at the updated patch? Should I add braces for
code-style?

Thanks,

Tom


On Fri, Dec 14, 2018 at 4:43 PM <tom.des...@gmail.com> wrote:

> From: Tom Deseyn <tom.des...@gmail.com>
>
> Thank you for reviewing Laurant.
> Sorry for missing history, I'm not used to sending patches via mail.
> I got an email about code style. For now, I'm sticking to the style
> that is used in the function.
>
> v2: default to unimplemented
> v3: match kernel behavior
>
> Signed-off-by: Tom Deseyn <tom.des...@gmail.com>
> ---
>  linux-user/syscall.c | 36 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 280137da8c..f103437f26 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -2352,6 +2352,42 @@ static abi_long do_getsockopt(int sockfd, int
> level, int optname,
>              break;
>          }
>          break;
> +    case SOL_IPV6:
> +        switch (optname) {
> +        case IPV6_MTU_DISCOVER:
> +        case IPV6_MTU:
> +        case IPV6_V6ONLY:
> +        case IPV6_RECVPKTINFO:
> +        case IPV6_UNICAST_HOPS:
> +        case IPV6_MULTICAST_HOPS:
> +        case IPV6_MULTICAST_LOOP:
> +        case IPV6_RECVERR:
> +        case IPV6_RECVHOPLIMIT:
> +        case IPV6_2292HOPLIMIT:
> +        case IPV6_CHECKSUM: {
> +            void* target_addr;
> +            if (get_user_u32(len, optlen))
> +                return -TARGET_EFAULT;
> +            if (len < 0)
> +                return -TARGET_EINVAL;
> +            lv = sizeof(val);
> +            ret = get_errno(getsockopt(sockfd, level, optname, &val,
> &lv));
> +            if (ret < 0)
> +                return ret;
> +            if (lv < len)
> +                len = lv;
> +            if (put_user_u32(len, optlen))
> +                return -TARGET_EFAULT;
> +            target_addr = lock_user(VERIFY_WRITE, optval_addr, len, 0);
> +            tswap32s((uint32_t*)&val);
> +            memcpy(target_addr, &val, len);
> +            unlock_user(target_addr, optval_addr, len);
> +            break;
> +        }
> +        default:
> +            goto unimplemented;
> +        }
> +        break;
>      default:
>      unimplemented:
>          gemu_log("getsockopt level=%d optname=%d not yet supported\n",
> --
> 2.19.2
>
>

Reply via email to