Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:GA
autofs
0004-autofs-5.1.3-add-port-parameter-to-rpc_pin...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0004-autofs-5.1.3-add-port-parameter-to-rpc_ping.patch of Package autofs
From d1a6ab25f34ab6436057ba82e6ad65d6addd5936 Mon Sep 17 00:00:00 2001 From: Ian Kent <raven@themaw.net> Date: Tue, 20 Jun 2017 11:12:38 +0800 Subject: [PATCH] autofs-5.1.3 - add port parameter to rpc_ping() Commit 4914be96 introduced an NFS ping probe to check availability on fallback from bind mount failure but failed to take into account the case where the port option had been given to avoid bind mounting. Change rpc_ping() and __rpc_ping() to take a port parameter and don't contact the portmapper or rpcbind if it is valid. Signed-off-by: Ian Kent <raven@themaw.net> --- include/rpc_subs.h | 2 +- lib/rpc_subs.c | 45 ++++++++++++++++++++++++++++----------------- modules/mount_nfs.c | 2 +- 3 files changed, 30 insertions(+), 19 deletions(-) --- a/include/rpc_subs.h +++ b/include/rpc_subs.h @@ -69,7 +69,7 @@ void rpc_destroy_tcp_client(struct conn_ int rpc_portmap_getclient(struct conn_info *, const char *, struct sockaddr *, size_t, int, unsigned int); int rpc_portmap_getport(struct conn_info *, struct pmap *, unsigned short *); int rpc_ping_proto(struct conn_info *); -int rpc_ping(const char *, long, long, unsigned int); +int rpc_ping(const char *, int, long, long, unsigned int); double monotonic_elapsed(struct timespec, struct timespec); int rpc_time(const char *, unsigned int, unsigned int, long, long, unsigned int, double *); const char *get_addr_string(struct sockaddr *, char *, socklen_t); --- a/lib/rpc_subs.c +++ b/lib/rpc_subs.c @@ -1001,12 +1001,11 @@ int rpc_ping_proto(struct conn_info *inf } static int __rpc_ping(const char *host, - unsigned long version, int proto, + unsigned long version, int proto, int port, long seconds, long micros, unsigned int option) { int status; struct conn_info info; - struct pmap parms; info.proto = proto; info.host = host; @@ -1023,32 +1022,41 @@ static int __rpc_ping(const char *host, status = RPC_PING_FAIL; - parms.pm_prog = NFS_PROGRAM; - parms.pm_vers = version; - parms.pm_prot = info.proto; - parms.pm_port = 0; - - status = rpc_portmap_getport(&info, &parms, &info.port); - if (status < 0) - return status; + + if (port > 0) + info.port = port; + else { + struct pmap parms; + + parms.pm_prog = NFS_PROGRAM; + parms.pm_vers = version; + parms.pm_prot = info.proto; + parms.pm_port = 0; + status = rpc_portmap_getport(&info, &parms, &info.port); + if (status < 0) + return status; + } status = rpc_ping_proto(&info); return status; } -int rpc_ping(const char *host, long seconds, long micros, unsigned int option) +int rpc_ping(const char *host, int port, + long seconds, long micros, unsigned int option) { unsigned long vers4 = NFS4_VERSION; unsigned long vers3 = NFS3_VERSION; unsigned long vers2 = NFS2_VERSION; int status; - status = __rpc_ping(host, vers2, IPPROTO_UDP, seconds, micros, option); + status = __rpc_ping(host, vers2, + IPPROTO_UDP, port, seconds, micros, option); if (status > 0) return RPC_PING_V2 | RPC_PING_UDP; - status = __rpc_ping(host, vers3, IPPROTO_UDP, seconds, micros, option); + status = __rpc_ping(host, vers3, + IPPROTO_UDP, port, seconds, micros, option); if (status > 0) return RPC_PING_V3 | RPC_PING_UDP; @@ -1058,15 +1066,18 @@ int rpc_ping(const char *host, long seco return RPC_PING_V4 | RPC_PING_UDP; */ - status = __rpc_ping(host, vers2, IPPROTO_TCP, seconds, micros, option); + status = __rpc_ping(host, vers2, + IPPROTO_TCP, port, seconds, micros, option); if (status > 0) return RPC_PING_V2 | RPC_PING_TCP; - status = __rpc_ping(host, vers3, IPPROTO_TCP, seconds, micros, option); + status = __rpc_ping(host, vers3, port, + IPPROTO_TCP, seconds, micros, option); if (status > 0) return RPC_PING_V3 | RPC_PING_TCP; - status = __rpc_ping(host, vers4, IPPROTO_TCP, seconds, micros, option); + status = __rpc_ping(host, vers4, + IPPROTO_TCP, port, seconds, micros, option); if (status > 0) return RPC_PING_V4 | RPC_PING_TCP; @@ -1095,7 +1106,7 @@ int rpc_time(const char *host, unsigned long vers = ping_vers; clock_gettime(CLOCK_MONOTONIC, &start); - status = __rpc_ping(host, vers, proto, seconds, micros, option); + status = __rpc_ping(host, vers, proto, 0, seconds, micros, option); clock_gettime(CLOCK_MONOTONIC, &end); if (status == RPC_PING_FAIL || status < 0) --- a/modules/mount_nfs.c +++ b/modules/mount_nfs.c @@ -358,7 +358,7 @@ dont_probe: char *host = this->name ? this->name : "localhost"; int ret; - ret = rpc_ping(host, 2, 0, RPC_CLOSE_DEFAULT); + ret = rpc_ping(host, port, 2, 0, RPC_CLOSE_DEFAULT); if (ret <= 0) goto next; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor