From: Chuck Lever Date: Mon, 17 Nov 2008 21:13:48 +0000 (-0500) Subject: Introduce rpcbind client utility functions X-Git-Tag: nfs-utils-1-1-5~61 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=commitdiff_plain;h=541bf913ec64dee719b34d2a6850fcfee550e6c0;hp=541bf913ec64dee719b34d2a6850fcfee550e6c0 Introduce rpcbind client utility functions It turns out that at least the mount command and the showmount command need to query a server's rpcbind daemon. They need to query over AF_INET6 as well as AF_INET. libtirpc provides an rpcbind query capability with the rpcb_getaddr(3) interface, but it takes a hostname and netconfig entry rather than a sockaddr and a protocol type, and always uses a lengthy timeout. The former is important to the mount command because it sometimes must operate using a specific port and IP address rather than depending on rpcbind and DNS to convert a [hostname, RPC program, netconfig] tuple to a [socket address, port number, transport protocol] tuple. The rpcb_getaddr(3) API also always uses a privileged port (at least for setuid root executables like mount.nfs), which is not required for an rpcbind query. This can exhaust the local system's reserved port space quickly. This patch provides a reserved-port-friendly AF_INET6-capable rpcbind query C API that can be shared among commands and tools in nfs-utils, and allows a query to a specified socket address and port rather than a hostname. In addition to an rpcbind query interface, this patch also provides a facility to ping the remote RPC service to ensure that it is operating as advertised by rpcbind. It's useful to combine an RPC ping with an rpcbind query because in many cases, components of nfs-utils already ping an RPC service immediately after receiving a successful GETPORT result. There are also a handful of utility routines provided, such as a functions that can map between [sockaddr, port] and a universal address. I've made an attempt to make these new functions build and operate on systems that do not have libtirpc. Signed-off-by: Chuck Lever Signed-off-by: Steve Dickson ---