Re: [PATCH 2/2] tcp: add ability to set a timestamp offset (v2)

From: Pavel Emelyanov
Date: Wed Jan 23 2013 - 10:26:28 EST



> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 086ceda..23f93d4 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -2704,6 +2704,10 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
> else
> err = -EINVAL;
> break;
> + case TCP_TIMESTAMP:
> + tp->tsoffset = 0;
> + tp->tsoffset = val - tcp_time_stamp(tp);

I believe we should check that the socket state is TCP_CLOSE.
Otherwise tcp_time_stamp() readers might be surprised while
reading the value.

> + break;
> default:
> err = -ENOPROTOOPT;
> break;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/