Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp65416pxj; Wed, 16 Jun 2021 20:27:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaCkdPqW37eCXEsH1hC4z9a685SIrz/vBSOt6TICD33f4vBCjwazD3SF7kwpZjIaqajh+K X-Received: by 2002:a6b:a10:: with SMTP id z16mr2025854ioi.70.1623900423297; Wed, 16 Jun 2021 20:27:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623900423; cv=none; d=google.com; s=arc-20160816; b=sAiBrJ1TVDkbmIrQ/QcAixNvjNd/pKaxUptkeNrHD91eVFvKInQ2Ffj7/TIJk62Dag aPrRZ8qB0K8k20rV3Ejw87wBnNABTBig55T3lAqSUlaCd6NcDfOnpFhk8+WPYO2U05pJ wp1zA6Uz8GmTf5XJJv+Idsw1Jlvro4mB2je7RrOunyBY0qXcpr4x3K5Fxs/cpjXHEM+7 uT86JbEx+qvC88cjTqtsdewtafAH16G5qaupEXalNrR3AadCfErAilkl3for7HZG+xIv uOs/JQdFbvA5ET45gvI7aHJqRLgxu+nso4IWj8ek2gmbvcG3KHTIxGt0jEkr98ARJp+j DB5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature:dkim-signature:dkim-signature; bh=G/u+npGHGdMykAyB5FariH9LFC+E8SZzfyRXvtrdqrA=; b=zT7orZWd61x7V/bYhk96c7bj1CCwmXOrnzRyeGXXrbdvmcD+byOSx1mh8zpftVhNeD fNeT3dJJxmV02h2BIuEiP480ZJciO5xO7y/29CgFuJ0eKBjBlMEPgVYxbSEeXliazXBL /ozH3+kKTNdfBDtNvcvmywM+oE9farqpZ9aLqI0Q6JtZZ/m/46opEbpyLLn3c2tZfFeZ ji2kDf8Rvp6Uwrgb1DL5tEld5C8jo8W7Un1DYj/FAgaOGKFU2M5wZP7iKpZ203Y2nNnV /pDn5bR9Kwch4ESRNbBqQ+pX246GeaPWSr4GIZlCBdqV3SEjepmlIjDonuhd7xiSFW6o aS4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=zLz1USMO; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=zLz1USMO; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=XrSmFgQ4; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i1si4369841iov.7.2021.06.16.20.26.44; Wed, 16 Jun 2021 20:27:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@suse.de header.s=susede2_rsa header.b=zLz1USMO; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=zLz1USMO; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=XrSmFgQ4; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230272AbhFQD1M (ORCPT + 99 others); Wed, 16 Jun 2021 23:27:12 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:34694 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230334AbhFQD0b (ORCPT ); Wed, 16 Jun 2021 23:26:31 -0400 Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id DDE8521A9E; Thu, 17 Jun 2021 03:24:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1623900263; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G/u+npGHGdMykAyB5FariH9LFC+E8SZzfyRXvtrdqrA=; b=zLz1USMOEP2zCuuMwN7qubRP7iwOKuHk1X7TCUCCUDaIFlF5NtlObV62P+zuAhs5rgAonQ ziqEVSn3SPNCDGzm2Q5XCflz+pZzNZMT6lSlU16NQlMibaLWZwwOnf+R04o1CijDJTX7Mo alDfPGHG2utH3uVitYsvAdLEK9YBXJ4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1623900263; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G/u+npGHGdMykAyB5FariH9LFC+E8SZzfyRXvtrdqrA=; b=XrSmFgQ4jfeT4FKzWpnXIUf3LYKu81QzFDABEYhgQWexryZvgKr5OpUDeo/oRXRMD+bK2W JpyBnEFtobatrGAg== Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 91668118DD; Thu, 17 Jun 2021 03:24:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1623900263; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G/u+npGHGdMykAyB5FariH9LFC+E8SZzfyRXvtrdqrA=; b=zLz1USMOEP2zCuuMwN7qubRP7iwOKuHk1X7TCUCCUDaIFlF5NtlObV62P+zuAhs5rgAonQ ziqEVSn3SPNCDGzm2Q5XCflz+pZzNZMT6lSlU16NQlMibaLWZwwOnf+R04o1CijDJTX7Mo alDfPGHG2utH3uVitYsvAdLEK9YBXJ4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1623900263; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G/u+npGHGdMykAyB5FariH9LFC+E8SZzfyRXvtrdqrA=; b=XrSmFgQ4jfeT4FKzWpnXIUf3LYKu81QzFDABEYhgQWexryZvgKr5OpUDeo/oRXRMD+bK2W JpyBnEFtobatrGAg== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id R5GQEGbAymCsJAAALh3uQQ (envelope-from ); Thu, 17 Jun 2021 03:24:22 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: "Trond Myklebust" , "Anna Schumaker" Cc: linux-nfs@vger.kernel.org Subject: Re: [PATCH] SUNRPC: prevent port reuse on transports which don't request it. In-reply-to: <162371991856.23575.16102887900102220450@noble.neil.brown.name> References: <162371991856.23575.16102887900102220450@noble.neil.brown.name> Date: Thu, 17 Jun 2021 13:24:19 +1000 Message-id: <162390025921.29912.9620777152373832527@noble.neil.brown.name> Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, 15 Jun 2021, someone wrote: > If an RPC client is created without RPC_CLNT_CREATE_REUSEPORT, it should > not reuse the source port when a TCP connection is re-established. > This is currently implemented by preventing the source port being > recorded after a successful connection (the call to xs_set_srcport()). >=20 > However the source port is also recorded after a successful bind in xs_bind= (). > This may not be needed at all and certainly is not wanted when > RPC_CLNT_CREATE_REUSEPORT wasn't requested. >=20 > So avoid that assignment when xprt.reuseport is not set. >=20 > With this change, NFSv4.1 and later mounts use a different port number on > each connection. This is helpful with some firewalls which don't cope > well with port reuse. >=20 > Signed-off-by: NeilBrown I guess this should have Fixes: e6237b6feb37 ("NFSv4.1: Don't rebind to the same source port when reco= nnecting to the server") NeilBrown > --- > net/sunrpc/xprtsock.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c > index 316d04945587..3228b7a1836a 100644 > --- a/net/sunrpc/xprtsock.c > +++ b/net/sunrpc/xprtsock.c > @@ -1689,7 +1689,8 @@ static int xs_bind(struct sock_xprt *transport, struc= t socket *sock) > err =3D kernel_bind(sock, (struct sockaddr *)&myaddr, > transport->xprt.addrlen); > if (err =3D=3D 0) { > - transport->srcport =3D port; > + if (transport->xprt.reuseport) > + transport->srcport =3D port; > break; > } > last =3D port; > --=20 > 2.31.1 >=20 >=20