static const rpcvers_t default_rpcb_version = PMAPVERS;
#endif /* !HAVE_LIBTIRPC */
+/*
+ * Historical: Map TCP connect timeouts to timeout
+ * error code used by UDP.
+ */
+static void
+nfs_gp_map_tcp_errorcodes(const unsigned short protocol)
+{
+ if (protocol != IPPROTO_TCP)
+ return;
+
+ switch (rpc_createerr.cf_error.re_errno) {
+ case ETIMEDOUT:
+ rpc_createerr.cf_stat = RPC_TIMEDOUT;
+ break;
+ }
+}
+
/*
* There's no easy way to tell how the local system's networking
* and rpcbind is configured (ie. whether we want to use IPv6 or
NULL,
};
rpcprog_t rpcb_prog = nfs_getrpcbyname(RPCBPROG, rpcb_pgmtbl);
+ CLIENT *clnt;
nfs_gp_set_port(sap, nfs_gp_get_rpcb_port(transport));
- return nfs_get_rpcclient(sap, salen, transport, rpcb_prog,
- version, timeout);
+ clnt = nfs_get_rpcclient(sap, salen, transport, rpcb_prog,
+ version, timeout);
+ nfs_gp_map_tcp_errorcodes(transport);
+ return clnt;
}
/*
if (timeout != NULL)
tout = *timeout;
+ nfs_clear_rpc_createerr();
+
memcpy(saddr, sap, (size_t)salen);
client = nfs_get_rpcclient(saddr, salen, protocol,
program, version, &tout);
if (client != NULL) {
result = nfs_gp_ping(client, tout);
+ nfs_gp_map_tcp_errorcodes(protocol);
CLNT_DESTROY(client);
}
unsigned short port = 0;
CLIENT *client;
+ nfs_clear_rpc_createerr();
+
memcpy(saddr, sap, (size_t)salen);
client = nfs_gp_get_rpcbclient(saddr, salen, protocol,
default_rpcb_version, &timeout);
CLIENT *client;
int result = 0;
+ nfs_clear_rpc_createerr();
+
client = nfs_gp_get_rpcbclient(sap, salen, protocol,
default_rpcb_version, &timeout);
if (client != NULL) {
memcpy(saddr, sap, (size_t)salen);
nfs_gp_set_port(saddr, htons(port));
+ nfs_clear_rpc_createerr();
+
client = nfs_get_rpcclient(saddr, salen, protocol,
program, version, &timeout);
if (client != NULL) {
result = nfs_gp_ping(client, timeout);
+ nfs_gp_map_tcp_errorcodes(protocol);
CLNT_DESTROY(client);
}
}
CLIENT *client;
struct timeval timeout = { -1, 0 };
+ nfs_clear_rpc_createerr();
+
client = nfs_gp_get_rpcbclient(sap, salen, 0, RPCBVERS_4, &timeout);
if (client != NULL) {
struct rpcb parms;
#endif /* NFS_GP_LOCAL */
if (port == 0) {
+ nfs_clear_rpc_createerr();
+
if (nfs_gp_loopback_address(lb_addr, &lb_len)) {
port = nfs_getport(lb_addr, lb_len,
program, version, protocol);
if (timeout != NULL)
tout = *timeout;
+ nfs_clear_rpc_createerr();
+
memcpy(saddr, sap, (size_t)salen);
client = nfs_gp_get_rpcbclient(saddr, salen, transport,
RPCBVERS_4, &tout);
__attribute__((unused)) const unsigned short protocol,
__attribute__((unused)) const struct timeval *timeout)
{
+ nfs_clear_rpc_createerr();
+
rpc_createerr.cf_stat = RPC_UNKNOWNADDR;
return 0;
}
if (timeout != NULL)
tout = *timeout;
+ nfs_clear_rpc_createerr();
+
memcpy(saddr, sin, sizeof(address));
client = nfs_gp_get_rpcbclient(saddr, (socklen_t)sizeof(*sin),
transport, PMAPVERS, &tout);