|
|
9ddfc2 |
autofs-5.1.3 - add port parameter to rpc_ping()
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
From: Ian Kent <raven@themaw.net>
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
Commit 4914be96 introduced an NFS ping probe to check availability on
|
|
|
9ddfc2 |
fallback from bind mount failure but failed to take into account the
|
|
|
9ddfc2 |
case where the port option had been given to avoid bind mounting.
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
Change rpc_ping() and __rpc_ping() to take a port parameter and don't
|
|
|
9ddfc2 |
contact the portmapper or rpcbind if it is valid.
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
9ddfc2 |
---
|
|
|
9ddfc2 |
CHANGELOG | 1 +
|
|
|
9ddfc2 |
include/rpc_subs.h | 2 +-
|
|
|
9ddfc2 |
lib/rpc_subs.c | 43 +++++++++++++++++++++++++++----------------
|
|
|
9ddfc2 |
modules/mount_nfs.c | 2 +-
|
|
|
9ddfc2 |
4 files changed, 30 insertions(+), 18 deletions(-)
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
--- autofs-5.0.7.orig/CHANGELOG
|
|
|
9ddfc2 |
+++ autofs-5.0.7/CHANGELOG
|
|
|
9ddfc2 |
@@ -304,6 +304,7 @@
|
|
|
9ddfc2 |
- fix update_negative_cache() map source usage.
|
|
|
9ddfc2 |
- mark removed cache entry negative.
|
|
|
9ddfc2 |
- remove some redundant rpc library code.
|
|
|
9ddfc2 |
+- add port parameter to rpc_ping().
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
25/07/2012 autofs-5.0.7
|
|
|
9ddfc2 |
=======================
|
|
|
9ddfc2 |
--- autofs-5.0.7.orig/include/rpc_subs.h
|
|
|
9ddfc2 |
+++ autofs-5.0.7/include/rpc_subs.h
|
|
|
9ddfc2 |
@@ -69,7 +69,7 @@ void rpc_destroy_tcp_client(struct conn_
|
|
|
9ddfc2 |
int rpc_portmap_getclient(struct conn_info *, const char *, struct sockaddr *, size_t, int, unsigned int);
|
|
|
9ddfc2 |
int rpc_portmap_getport(struct conn_info *, struct pmap *, unsigned short *);
|
|
|
9ddfc2 |
int rpc_ping_proto(struct conn_info *);
|
|
|
9ddfc2 |
-int rpc_ping(const char *, long, long, unsigned int);
|
|
|
9ddfc2 |
+int rpc_ping(const char *, int, long, long, unsigned int);
|
|
|
9ddfc2 |
double elapsed(struct timeval, struct timeval);
|
|
|
9ddfc2 |
const char *get_addr_string(struct sockaddr *, char *, socklen_t);
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
--- autofs-5.0.7.orig/lib/rpc_subs.c
|
|
|
9ddfc2 |
+++ autofs-5.0.7/lib/rpc_subs.c
|
|
|
9ddfc2 |
@@ -1010,12 +1010,11 @@ int rpc_ping_proto(struct conn_info *inf
|
|
|
9ddfc2 |
}
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
static int __rpc_ping(const char *host,
|
|
|
9ddfc2 |
- unsigned long version, int proto,
|
|
|
9ddfc2 |
+ unsigned long version, int proto, int port,
|
|
|
9ddfc2 |
long seconds, long micros, unsigned int option)
|
|
|
9ddfc2 |
{
|
|
|
9ddfc2 |
int status;
|
|
|
9ddfc2 |
struct conn_info info;
|
|
|
9ddfc2 |
- struct pmap parms;
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
info.proto = proto;
|
|
|
9ddfc2 |
info.host = host;
|
|
|
9ddfc2 |
@@ -1032,32 +1031,41 @@ static int __rpc_ping(const char *host,
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
status = RPC_PING_FAIL;
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
- parms.pm_prog = NFS_PROGRAM;
|
|
|
9ddfc2 |
- parms.pm_vers = version;
|
|
|
9ddfc2 |
- parms.pm_prot = info.proto;
|
|
|
9ddfc2 |
- parms.pm_port = 0;
|
|
|
9ddfc2 |
-
|
|
|
9ddfc2 |
- status = rpc_portmap_getport(&info, &parms, &info.port);
|
|
|
9ddfc2 |
- if (status < 0)
|
|
|
9ddfc2 |
- return status;
|
|
|
9ddfc2 |
+
|
|
|
9ddfc2 |
+ if (port > 0)
|
|
|
9ddfc2 |
+ info.port = port;
|
|
|
9ddfc2 |
+ else {
|
|
|
9ddfc2 |
+ struct pmap parms;
|
|
|
9ddfc2 |
+
|
|
|
9ddfc2 |
+ parms.pm_prog = NFS_PROGRAM;
|
|
|
9ddfc2 |
+ parms.pm_vers = version;
|
|
|
9ddfc2 |
+ parms.pm_prot = info.proto;
|
|
|
9ddfc2 |
+ parms.pm_port = 0;
|
|
|
9ddfc2 |
+ status = rpc_portmap_getport(&info, &parms, &info.port);
|
|
|
9ddfc2 |
+ if (status < 0)
|
|
|
9ddfc2 |
+ return status;
|
|
|
9ddfc2 |
+ }
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
status = rpc_ping_proto(&info;;
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
return status;
|
|
|
9ddfc2 |
}
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
-int rpc_ping(const char *host, long seconds, long micros, unsigned int option)
|
|
|
9ddfc2 |
+int rpc_ping(const char *host, int port,
|
|
|
9ddfc2 |
+ long seconds, long micros, unsigned int option)
|
|
|
9ddfc2 |
{
|
|
|
9ddfc2 |
unsigned long vers4 = NFS4_VERSION;
|
|
|
9ddfc2 |
unsigned long vers3 = NFS3_VERSION;
|
|
|
9ddfc2 |
unsigned long vers2 = NFS2_VERSION;
|
|
|
9ddfc2 |
int status;
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
- status = __rpc_ping(host, vers2, IPPROTO_UDP, seconds, micros, option);
|
|
|
9ddfc2 |
+ status = __rpc_ping(host, vers2,
|
|
|
9ddfc2 |
+ IPPROTO_UDP, port, seconds, micros, option);
|
|
|
9ddfc2 |
if (status > 0)
|
|
|
9ddfc2 |
return RPC_PING_V2 | RPC_PING_UDP;
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
- status = __rpc_ping(host, vers3, IPPROTO_UDP, seconds, micros, option);
|
|
|
9ddfc2 |
+ status = __rpc_ping(host, vers3,
|
|
|
9ddfc2 |
+ IPPROTO_UDP, port, seconds, micros, option);
|
|
|
9ddfc2 |
if (status > 0)
|
|
|
9ddfc2 |
return RPC_PING_V3 | RPC_PING_UDP;
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
@@ -1067,15 +1075,18 @@ int rpc_ping(const char *host, long seco
|
|
|
9ddfc2 |
return RPC_PING_V4 | RPC_PING_UDP;
|
|
|
9ddfc2 |
*/
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
- status = __rpc_ping(host, vers2, IPPROTO_TCP, seconds, micros, option);
|
|
|
9ddfc2 |
+ status = __rpc_ping(host, vers2,
|
|
|
9ddfc2 |
+ IPPROTO_TCP, port, seconds, micros, option);
|
|
|
9ddfc2 |
if (status > 0)
|
|
|
9ddfc2 |
return RPC_PING_V2 | RPC_PING_TCP;
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
- status = __rpc_ping(host, vers3, IPPROTO_TCP, seconds, micros, option);
|
|
|
9ddfc2 |
+ status = __rpc_ping(host, vers3, port,
|
|
|
9ddfc2 |
+ IPPROTO_TCP, seconds, micros, option);
|
|
|
9ddfc2 |
if (status > 0)
|
|
|
9ddfc2 |
return RPC_PING_V3 | RPC_PING_TCP;
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
- status = __rpc_ping(host, vers4, IPPROTO_TCP, seconds, micros, option);
|
|
|
9ddfc2 |
+ status = __rpc_ping(host, vers4,
|
|
|
9ddfc2 |
+ IPPROTO_TCP, port, seconds, micros, option);
|
|
|
9ddfc2 |
if (status > 0)
|
|
|
9ddfc2 |
return RPC_PING_V4 | RPC_PING_TCP;
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
--- autofs-5.0.7.orig/modules/mount_nfs.c
|
|
|
9ddfc2 |
+++ autofs-5.0.7/modules/mount_nfs.c
|
|
|
9ddfc2 |
@@ -358,7 +358,7 @@ dont_probe:
|
|
|
9ddfc2 |
char *host = this->name ? this->name : "localhost";
|
|
|
9ddfc2 |
int ret;
|
|
|
9ddfc2 |
|
|
|
9ddfc2 |
- ret = rpc_ping(host, 2, 0, RPC_CLOSE_DEFAULT);
|
|
|
9ddfc2 |
+ ret = rpc_ping(host, port, 2, 0, RPC_CLOSE_DEFAULT);
|
|
|
9ddfc2 |
if (ret <= 0)
|
|
|
9ddfc2 |
goto next;
|
|
|
9ddfc2 |
}
|