[CRIU] Re: [PATCH] tcp: restore rcv_wscale in a repair mode

Pavel Emelyanov xemul at parallels.com
Mon Sep 10 09:43:39 EDT 2012


On 09/10/2012 04:03 PM, Andrey Wagin wrote:
> 2012/9/10 Pavel Emelyanov <xemul at parallels.com>:
>> On 09/10/2012 03:54 PM, Andrew Vagin wrote:
>>> rcv_wscale is a symetric parameter with snd_wscale.
>>>
>>> Both this parameters are set on a connection handshake.
>>>
>>> Without this valuea remote window size can't be interpreted correctly,
>>> because a value from a packet should be shifted on rcv_wscale.
>>>
>>> And one more thing is that we should set wscale_ok too.
>>>
>>> This patch doesn't break a back compatibility, a rcv window
>>> will be restored with the same bug (rcv_wscale = 0).
>>>
>>> Signed-off-by: Andrew Vagin <avagin at openvz.org>
>>> ---
>>>  net/ipv4/tcp.c |   20 ++++++++++++++++----
>>>  1 files changed, 16 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
>>> index 2109ff4..70d995c 100644
>>> --- a/net/ipv4/tcp.c
>>> +++ b/net/ipv4/tcp.c
>>> @@ -2325,10 +2325,22 @@ static int tcp_repair_options_est(struct tcp_sock *tp,
>>>                       tp->rx_opt.mss_clamp = opt.opt_val;
>>>                       break;
>>>               case TCPOPT_WINDOW:
>>> -                     if (opt.opt_val > 14)
>>> -                             return -EFBIG;
>>> -
>>> -                     tp->rx_opt.snd_wscale = opt.opt_val;
>>> +                     {
>>> +                             union {
>>> +                                     struct {
>>> +                                             u16 snd_wscale;
>>> +                                             u16 rcv_wscale;
>>> +                                     };
>>> +                                     u32 raw;
>>> +                             } val = { .raw = opt.opt_val };
>>
>> Can we make it with bits shifts and masking?
> 
> Yes, we can. But when I show the variant with bit shifts and masking,
> you did not like it;).
> I know that you compared that variant with a new option for
> rcv_wscale, but I decide to rework it and this one looks better for
> me.

Ack then.


More information about the CRIU mailing list