summaryrefslogtreecommitdiffstats
path: root/support/nfs/rpc_socket.c
Commit message (Collapse)AuthorAgeFilesLines
* pdate addres for Free Software FoundationNeilBrown2011-08-291-2/+2
| | | | | | | | | | | | License texts contain multiple address for FSF, some wrong. So update them and replace COPYING file with http://www.gnu.org/licenses/gpl-2.0.txt which has a few changes to preamble and commentary. Also remove extra COPYING file from utils/statd/ Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
* Use authunix_create() instead of authsys_create() to fix regression.Steve Dickson2010-03-081-1/+1
| | | | | | | | | | | | | Commit 409b8 introduced a regression when the --disable-tirpc configuration flag is set. The authsys_create() interface, which was introduced, does not exist in the legacy glibc library. Since the authsys_create() interface is a redefined of the authunix_create() interface, which is defined in glibc, using authunix_create() resolves the regression, Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: add and use nfs_authsys_createJeff Layton2010-03-011-0/+21
| | | | | | | | | | | | | | | | | | The current mount, umount and showmount code uses authunix_create_default to get an auth handle. The one provided by glibc returned a truncated list of groups when there were more than 16 groups. libtirpc however currently does an abort() in this case, which causes the program to crash and dump core. nfs-utils just uses these auth handles for the MNT protocol, so the group list doesn't make a lot of difference here. Add a new function that creates an auth handle with a supplemental gids list that consists only of the primary gid. Have nfs-utils use that function anywhere that it currently uses authunix_create_default. Also, have the caller properly check for a NULL return from that function. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Collect socket address helpers into one locationChuck Lever2010-01-151-47/+8
| | | | | | | | | | | | | Introduce generic helpers for managing socket addresses. These are general enough that they are useful for pretty much any component of nfs-utils. We also include the definition of nfs_sockaddr here, so it can be shared. See: https://bugzilla.redhat.com/show_bug.cgi?id=448743 Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
* support: Introduce sockaddr helpers to get and set IP port numbersChuck Lever2009-07-141-18/+45
| | | | | | | | | | Introduce address family-agnostic functions that get and set IP port numbers in socket addresses. We can already replace a few similar functions in the mount command, and a few more will come up with statd and sm-notify. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* getport: Clear shared error fields before trying rpcbind queriesChuck Lever2009-07-141-0/+4
| | | | | | | | | Some RPC errors set fields in rpc_createerr.cf_error in addition to cf_stat. Be sure to clear _all_ error fields in rpc_createerr each time through the rpcbind API. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* support: Set proper retransmit timeout for datagram transportsChuck Lever2009-07-141-1/+3
| | | | | | | | | Instead of setting the total timeout and the retransmit timeout to the same value for datagram transports, use a 1 second retransmit timeout, so we actually get a retransmit or two before failing. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* support: Don't return RPC_UNKNOWNHOST from rpc_socket.cChuck Lever2009-07-141-2/+2
| | | | | | | | | | RPC_UNKNOWNHOST means a hostname isn't known -- basically it's EAI_NONAME from getaddrinfo(3). Since the functions in rpc_socket.c don't take a hostname argument, RPC_UNKNOWNHOST is not an appropriate return code from these functions. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* support: Use HAVE_LIBTIRPC to switch in bindresvport_sa(3t)Chuck Lever2009-07-141-3/+3
| | | | | | | | | | | commit 383a026d99624c88c0e802103ef4c4865db8eb71, which fixed an earlier commit, is still not quite correct. bindresvport_sa(3t) is available whenever libtirpc is linked. There's no need to use IPV6_SUPPORTED here. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Fix IPv6 support in support/nfs/rpc_socket.cChuck Lever2009-05-181-7/+5
| | | | | | | | | | | Use the correct #ifdef variable to enable IPv6 support for privileged RPC clients. Without this fix, unmounting an IPv6 NFSv2/v3 server fails. Introduced by commit 8c94296bc84f3a204f2061c0391a1d2350e4f37e. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* support: Provide an API for creating a privileged RPC clientChuck Lever2009-04-181-7/+133
| | | | | | | | | | | | | | We needed to guarantee that some RPC programs, such as PMAP, got an unprivileged port, to prevent exhausting the local privileged port space sending RPC requests that don't need such privileges. nfs_get_rpcclient() provides that feature. However, some RPC programs, such as MNT and UMNT, require a privileged port. So, let's provide an additional API for this that also supports IPv6 and setting a destination port. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Include legacy or TI-RPC headers, not bothChuck Lever2009-03-161-43/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Data type incompatibilities between the legacy RPC headers and the TI-RPC headers mean we can't use libtirpc with code that was compiled against the legacy RPC headers. The definition of rpcprog_t for example is "unsigned long" in the legacy library, but it's "uint32_t" for TI-RPC. On 32-bit systems, these types happen to have the same width, but on 64-bit systems they don't, making more complex data structures that use these types in fields ABI incompatible. Adopt a new strategy to deal with this issue. When --enable-tirpc is set, append "-I/usr/include/tirpc" to the compilation steps. This should cause the compiler to grab the tirpc/ headers instead of the legacy headers. Now, for TI-RPC builds, the TI-RPC legacy functions and the TI-RPC headers will be used. On legacy systems, the legacy headers and legacy glibc RPC implementation will be used. A new ./configure option is introduced to allow system integrators to use TI-RPC headers in some other location than /usr/include/tirpc. /usr/include/tirpc remains the default setting for this new option. The gssd implementation presents a few challenges, but it turns out the gssglue library is similar to the auth_gss pieces of TI-RPC. To avoid similar header incompatibility issues, gssd now uses libtirpc instead of libgssglue if --enable-tirpc is specified. There may be other issues to tackle with gssd, but for now, we just make sure it builds with --enable-tirpc. Note also: svc_getcaller() is a macro in both cases that points to a sockaddr field in the svc_req structure. The legacy version points to a sockaddr_in type field, but the TI-RPC version points to a sockaddr_in6 type field. rpc.mountd unconditionally casts the result of svc_getcaller() to a sockaddr_in *. This should be OK for TI-RPC as well, since rpc.mountd still uses legacy RPC calls (provided by glibc, or emulated by TI-RPC) to set up its listeners, and therefore rpc.mountd callers will always be from AF_INET addresses for now. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: replace function-specific switches with HAVE_LIBTIRPCChuck Lever2009-03-161-25/+25
| | | | | | | | | | | | | Instead of switching in TI-RPC-specific logic with a function-specific switch like HAVE_CLNT_VG_CREATE, let's use the more generic HAVE_LIBTIRPC macro everywhere. This simplifies ./configure (always a good thing), and makes it more clear in the source code exactly what the extra conditionally compiled code is for. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* nfs-utils: Replace getservbyname(3)Chuck Lever2009-03-051-46/+0
| | | | | | | | | The getservbyname(3) function is not re-entrant, and anyway, the man page says it is obsolete. Replace it with a call to getaddrinfo(3). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
* Add AF_INET6-capable API to acquire an RPC CLIENT *Chuck Lever2008-11-171-0/+528
Provide a simple interface that any component of nfs-utils can use to acquire an RPC CLIENT *. This is an AF_INET6-enabled API, and can also handle PF_LOCAL sockets if libtirpc is present on the system. When libtirpc is not available, legacy RPC services will be used instead, and an attempt to connect to an AF_INET6 address will fail. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>