* client. Otherwise returns NULL, and rpc_createerr.cf_stat is set to
* reflect the error.
*/
-static CLIENT *nfs_gp_get_rpcbclient(const struct sockaddr *sap,
+static CLIENT *nfs_gp_get_rpcbclient(struct sockaddr *sap,
const socklen_t salen,
const unsigned short transport,
const rpcvers_t version,
"sunrpc",
NULL,
};
- struct sockaddr_storage address;
- struct sockaddr *saddr = (struct sockaddr *)&address;
rpcprog_t rpcb_prog = nfs_getrpcbyname(RPCBPROG, rpcb_pgmtbl);
- memcpy(saddr, sap, (size_t)salen);
- nfs_gp_set_port(saddr, nfs_gp_get_rpcb_port(transport));
-
- return nfs_get_rpcclient(saddr, salen, transport, rpcb_prog,
+ nfs_gp_set_port(sap, nfs_gp_get_rpcb_port(transport));
+ return nfs_get_rpcclient(sap, salen, transport, rpcb_prog,
version, timeout);
}
}
/**
- * nfs_rcp_ping - Determine if RPC service is responding to requests
+ * nfs_rpc_ping - Determine if RPC service is responding to requests
* @sap: pointer to address of server to query (port is already filled in)
* @salen: length of server address
* @program: requested RPC program number
const rpcprog_t program, const rpcvers_t version,
const unsigned short protocol, const struct timeval *timeout)
{
+ struct sockaddr_storage address;
+ struct sockaddr *saddr = (struct sockaddr *)&address;
CLIENT *client;
struct timeval tout = { -1, 0 };
int result = 0;
if (timeout != NULL)
tout = *timeout;
- client = nfs_get_rpcclient(sap, salen, protocol, program, version, &tout);
+ 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);
CLNT_DESTROY(client);
const rpcvers_t version,
const unsigned short protocol)
{
+ struct sockaddr_storage address;
+ struct sockaddr *saddr = (struct sockaddr *)&address;
struct timeval timeout = { -1, 0 };
unsigned short port = 0;
CLIENT *client;
- client = nfs_gp_get_rpcbclient(sap, salen, protocol,
+ memcpy(saddr, sap, (size_t)salen);
+ client = nfs_gp_get_rpcbclient(saddr, salen, protocol,
default_rpcb_version, &timeout);
if (client != NULL) {
- port = nfs_gp_getport(client, sap, salen, program,
+ port = nfs_gp_getport(client, saddr, salen, program,
version, protocol, timeout);
CLNT_DESTROY(client);
}
const unsigned short protocol,
const struct timeval *timeout)
{
+ struct sockaddr_storage address;
+ struct sockaddr *saddr = (struct sockaddr *)&address;
CLIENT *client;
struct rpcb parms;
struct timeval tout = { -1, 0 };
if (timeout != NULL)
tout = *timeout;
- client = nfs_gp_get_rpcbclient(sap, salen, transport, RPCBVERS_4, &tout);
+ memcpy(saddr, sap, (size_t)salen);
+ client = nfs_gp_get_rpcbclient(saddr, salen, transport,
+ RPCBVERS_4, &tout);
if (client != NULL) {
if (nfs_gp_init_rpcb_parms(addr, addrlen, program, version,
protocol, &parms) != 0) {
const unsigned long protocol,
const struct timeval *timeout)
{
+ struct sockaddr_in address;
+ struct sockaddr *saddr = (struct sockaddr *)&address;
CLIENT *client;
struct pmap parms = {
.pm_prog = program,
if (timeout != NULL)
tout = *timeout;
- client = nfs_gp_get_rpcbclient((struct sockaddr *)sin,
- (socklen_t)sizeof(*sin),
+ memcpy(saddr, sin, sizeof(address));
+ client = nfs_gp_get_rpcbclient(saddr, (socklen_t)sizeof(*sin),
transport, PMAPVERS, &tout);
if (client != NULL) {
port = nfs_gp_pmap_getport(client, &parms, tout);