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

Pavel Emelyanov xemul at parallels.com
Wed Jan 23 10:26:41 EST 2013


> 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;


More information about the CRIU mailing list