From: Chuck Lever Date: Wed, 13 Oct 2010 15:22:07 +0000 (-0400) Subject: libnfs.a: Allow multiple RPC listeners to share listener port number X-Git-Tag: nfs-utils-1-2-4-rc1~15 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=commitdiff_plain;h=656028f9925f5817c5a37565d27159973db84ec3;hp=656028f9925f5817c5a37565d27159973db84ec3 libnfs.a: Allow multiple RPC listeners to share listener port number 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 Signed-off-by: Steve Dickson ---