]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
libnfs.a: Allow multiple RPC listeners to share listener port number
authorChuck Lever <chuck.lever@oracle.com>
Wed, 13 Oct 2010 15:22:07 +0000 (11:22 -0400)
committerSteve Dickson <steved@redhat.com>
Thu, 14 Oct 2010 14:26:58 +0000 (10:26 -0400)
Normally, when "-p" is not specified on the mountd command line, the
TI-RPC library chooses random port numbers for each listener.  If a
port number _is_ specified on the command line, all the listeners
will get the same port number, so SO_REUSEADDR needs to be set on
each socket.

Thus we can't let TI-RPC create the listener sockets for us in this
case; we must create them ourselves and then set SO_REUSEADDR (and
other socket options) by hand.

Different versions of the same RPC program have to share the same
listener and SVCXPRT, so we have to cache xprts we create, and re-use
them when additional requests for registration come from the
application.

Though it doesn't look like it, this fix was "copied" from the legacy
rpc_init() function.  It's more complicated for TI-RPC, of course,
since a TI-RPC application can set up listeners with a nearly
arbitrary number of address families and socket types, not just the
two listeners that legacy RPC applications can set up (one for AF_INET
UDP and one for AF_INET TCP).

See:
  https://bugzilla.linux-nfs.org/show_bug.cgi?id=190

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>

No differences found