diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/clnt.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index e1553cf2a68f..0d9b5275fac3 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -234,6 +234,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
234 | { | 234 | { |
235 | struct rpc_xprt *xprt; | 235 | struct rpc_xprt *xprt; |
236 | struct rpc_clnt *clnt; | 236 | struct rpc_clnt *clnt; |
237 | char servername[20]; | ||
237 | 238 | ||
238 | xprt = xprt_create_transport(args->protocol, args->address, | 239 | xprt = xprt_create_transport(args->protocol, args->address, |
239 | args->addrsize, args->timeout); | 240 | args->addrsize, args->timeout); |
@@ -241,6 +242,18 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) | |||
241 | return (struct rpc_clnt *)xprt; | 242 | return (struct rpc_clnt *)xprt; |
242 | 243 | ||
243 | /* | 244 | /* |
245 | * If the caller chooses not to specify a hostname, whip | ||
246 | * up a string representation of the passed-in address. | ||
247 | */ | ||
248 | if (args->servername == NULL) { | ||
249 | struct sockaddr_in *addr = | ||
250 | (struct sockaddr_in *) &args->address; | ||
251 | snprintf(servername, sizeof(servername), NIPQUAD_FMT, | ||
252 | NIPQUAD(addr->sin_addr.s_addr)); | ||
253 | args->servername = servername; | ||
254 | } | ||
255 | |||
256 | /* | ||
244 | * By default, kernel RPC client connects from a reserved port. | 257 | * By default, kernel RPC client connects from a reserved port. |
245 | * CAP_NET_BIND_SERVICE will not be set for unprivileged requesters, | 258 | * CAP_NET_BIND_SERVICE will not be set for unprivileged requesters, |
246 | * but it is always enabled for rpciod, which handles the connect | 259 | * but it is always enabled for rpciod, which handles the connect |