Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3116271pxb; Mon, 9 Nov 2020 03:04:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxv4+fpNC8FnlmFvbuU7KNBejSXEtrywqVgamxUpmHwz61fL8bNuMtGsQ5sG4fHfWe+Umbc X-Received: by 2002:a05:6402:31b6:: with SMTP id dj22mr15306153edb.348.1604919892980; Mon, 09 Nov 2020 03:04:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604919892; cv=none; d=google.com; s=arc-20160816; b=QOTCDucXHPyt/EjjKfBVKHdC37l8tf9BBnwCeFnQFTzu+TWJZc7fdrp35T/rdMRc/R HQ7c5+JnqdKbEMHExLkZYYEdWdVkVVtz7XqLmWDe+JrDQVKCKszoERnaPF+JQMRFVkkK pqRE89QwhP+TsaoHYs+PlNGiE0GmqVuBXQIrR5GoejCwZ4jyUOSrSyHBPUGfdSD0Ga5v zCGn890rE3/VaIUCuqLogxrpd6B7HJ29ioCQGZz94UsvfYxKfgkaU5iQHgb7ui83S7sO ogP3tk4Qxzq6mQAluNY2yiaPGru8H7A7jzf2FQ83sl8Su+Ot8r9cDOLaOVxhfo7KivPj a/BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=46EkZmI/ZGOaVTRH8d812wliPaOk2GZewbl0v0F4Eyo=; b=QlAuEBeDGpxTzA8tXIaTXAFMi5WrjRdqoQkmNnEkvHi8XmpOWVEWr3r+jMHYHU5fIN Gl/SLIfXphQPsCjr4UZM4huMfcqOCzT2GOGWlJfhgiGJ90nnRF0OnvCFjKYDNTYnP9OW /KdEc2I4laAwP9xId2R8znmB4e3bchDA47M5vLhQ73/Pbz/gXdy/Bag9WiyqcYMA1L4B Y0WcHpMsyL5BX+ctXbsncugFXXEIfJiDuCtiTT3b1wx/STaejHcSephMXI0iGm/gKKud CMCt82BkS1LRXfyvfoiFcF0OAhMP/m5MIzVvUj9SnJDwK6mwPPxqm1t2TyiRH6SPOije bDzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YIOg4E4P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t5si6757514ejx.583.2020.11.09.03.04.29; Mon, 09 Nov 2020 03:04:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YIOg4E4P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727826AbgKILCk (ORCPT + 99 others); Mon, 9 Nov 2020 06:02:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727930AbgKILCj (ORCPT ); Mon, 9 Nov 2020 06:02:39 -0500 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8C8FC0613D4 for ; Mon, 9 Nov 2020 03:02:39 -0800 (PST) Received: by mail-io1-xd42.google.com with SMTP id s10so9347065ioe.1 for ; Mon, 09 Nov 2020 03:02:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=46EkZmI/ZGOaVTRH8d812wliPaOk2GZewbl0v0F4Eyo=; b=YIOg4E4PN687iFY1IuJPotp2yw76l3Skp0u+NRw5/BGL3JjF2TllHuh++huJdAg3SC Nk7CwqYtWrD9EoGoMWh55KwVe/Rsb+4wPyd8MhWNllaSujmAcQsVAqID4C0NSJENKKss jqLxHoV7Q3K++ma7xC68GMjwd5CyvmORJ+ZN7r3SN66Bl8pmA9ibxSsncXIY0Y5Hmqb9 Rd8aocrZMsrd87MhpaaqZVeuFnIOlWJft+6bcxwJvWAWTZJ88tCpgQ9KArRUkHgyj1om apufD9WlyaqPCSz6fYjQNvsAs7TdVg5ZhrW4HGOeljICcf17FCYRL43I4TrgVskhG23X vNVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=46EkZmI/ZGOaVTRH8d812wliPaOk2GZewbl0v0F4Eyo=; b=o9DhOW8Jt/dTEaQHX29n8J0dJIt5p9p/fuMuN6HC4Wm9j4yQIeY16lcbzEnFVoN+zg hoVRY5/lbZk24TNm1v8F8/Ydfw16yBouSeXbeXJ0lc0CZ5K/ATEpodwYcD4aUEH8Ko72 FqW7s/YyvJj2NCU7rK9FdisZgq71MmC7bPsLG2TixqGskgS0NzuSMAbKrYD9Dv6wGfML gS9pF0noQoEkDU229quz0Z0MUd6vOKvRMehK3/l5vnQlYfqeolg0UIxC2K5mbQsvcV1R iSTMcEVqhKqg3JKLrRtfv7NU+2h6xnwxJDqHH3goGCuDqI+fvxXm+cl2Qtf6Y4FbnNlz YkzA== X-Gm-Message-State: AOAM533lK8SlRjw9T7zMFJj11EyT3GWMQf4zpohWcnVkx7VE9QUlvmhL +wUIBws032NeRXDjk1JB/uYMznmg9fg6j/zXzsx0MQ== X-Received: by 2002:a5e:980e:: with SMTP id s14mr9648251ioj.195.1604919758865; Mon, 09 Nov 2020 03:02:38 -0800 (PST) MIME-Version: 1.0 References: <1604913614-19432-1-git-send-email-wenan.mao@linux.alibaba.com> <1604914417-24578-1-git-send-email-wenan.mao@linux.alibaba.com> <3b92167c-201c-e85d-822d-06f0c9ac508c@linux.alibaba.com> In-Reply-To: <3b92167c-201c-e85d-822d-06f0c9ac508c@linux.alibaba.com> From: Eric Dumazet Date: Mon, 9 Nov 2020 12:02:27 +0100 Message-ID: Subject: Re: [PATCH net v2] net: Update window_clamp if SOCK_RCVBUF is set To: Mao Wenan Cc: David Miller , Alexey Kuznetsov , Hideaki YOSHIFUJI , Jakub Kicinski , netdev , LKML , kernel-janitors@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 9, 2020 at 11:12 AM Mao Wenan wro= te: > > > > =E5=9C=A8 2020/11/9 =E4=B8=8B=E5=8D=885:56, Eric Dumazet =E5=86=99=E9=81= =93: > > On Mon, Nov 9, 2020 at 10:33 AM Mao Wenan = wrote: > >> > >> When net.ipv4.tcp_syncookies=3D1 and syn flood is happened, > >> cookie_v4_check or cookie_v6_check tries to redo what > >> tcp_v4_send_synack or tcp_v6_send_synack did, > >> rsk_window_clamp will be changed if SOCK_RCVBUF is set, > >> which will make rcv_wscale is different, the client > >> still operates with initial window scale and can overshot > >> granted window, the client use the initial scale but local > >> server use new scale to advertise window value, and session > >> work abnormally. > > > > What is not working exactly ? > > > > Sending a 'big wscale' should not really matter, unless perhaps there > > is a buggy stack at the remote end ? > 1)in tcp_v4_send_synack, if SO_RCVBUF is set and > tcp_full_space(sk)=3D65535, pass req->rsk_window_clamp=3D65535 to > tcp_select_initial_window, rcv_wscale will be zero, and send to client, > the client consider wscale is 0; > 2)when ack is back from client, if there is no this patch, > req->rsk_window_clamp is 0, and pass to tcp_select_initial_window, > wscale will be 7, this new rcv_wscale is no way to advertise to client. > 3)if server send rcv_wind to client with window=3D63, it consider the rea= l > window is 63*2^7=3D8064, but client consider the server window is only > 63*2^0=3D63, it can't send big packet to server, and the send-q of client > is full. > I see, please change your patches so that tcp_full_space() is used _once_ listener sk_rcvbuf can change under us. I really have no idea how window can be set to 63, so please send us the packetdrill test once you have it.