]> git.baikalelectronics.ru Git - kernel.git/commit
SUNRPC: prevent port reuse on transports which don't request it.
authorNeilBrown <neilb@suse.de>
Tue, 15 Jun 2021 01:18:38 +0000 (11:18 +1000)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 21 Jun 2021 16:06:16 +0000 (12:06 -0400)
commitb294bf5737aae7350510a1d8b942f7db3eabe234
tree489d8d1a2267007ccc852f7a3d20912ffebf3214
parent43e93509f2c5c16a6aa5320c36437a9727989e0f
SUNRPC: prevent port reuse on transports which don't request it.

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()).

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.

So avoid that assignment when xprt.reuseport is not set.

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.

Signed-off-by: NeilBrown <neilb@suse.de>
Fixes: f72d31a87778 ("NFSv4.1: Don't rebind to the same source port when reconnecting to the server")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
net/sunrpc/xprtsock.c