Skip to content
Commit b8eace7d authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman
Browse files

SUNRPC: prevent port reuse on transports which don't request it.



[ Upstream commit bc1c56e9 ]

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: default avatarNeilBrown <neilb@suse.de>
Fixes: e6237b6f ("NFSv4.1: Don't rebind to the same source port when reconnecting to the server")
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 5577eece
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment