X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmount%2Fnetwork.c;h=00237699e185c0e152f203c65595381a7e39cd41;hp=d8e6e103c762d0eea573f4dd4bd0b46d007173ea;hb=2d173a587a7dbee81ffaf246d044f384fb6487c8;hpb=abb44f59bd004112a217011a2560dd7c7f94b5a2 diff --git a/utils/mount/network.c b/utils/mount/network.c index d8e6e10..0023769 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -48,16 +48,23 @@ #include "mount_constants.h" #include "network.h" -#ifdef HAVE_RPCSVC_NFS_PROT_H -#include -#else -#include -#define nfsstat nfs_stat -#endif - -#ifndef NFS_PORT -#define NFS_PORT 2049 -#endif +/* + * Earlier versions of glibc's /usr/include/netdb.h exclude these + * definitions because it was thought they were not part of a stable + * POSIX standard. However, they are defined by RFC 2553 and 3493 + * and in POSIX 1003.1-2001, so these definitions were added in later + * versions of netdb.h. + */ +#ifndef AI_V4MAPPED +#define AI_V4MAPPED 0x0008 /* IPv4-mapped addresses are acceptable. */ +#endif /* AI_V4MAPPED */ +#ifndef AI_ALL +#define AI_ALL 0x0010 /* Return both IPv4 and IPv6 addresses. */ +#endif /* AI_ALL */ +#ifndef AI_ADDRCONFIG +#define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose \ + returned address type. */ +#endif /* AI_ADDRCONFIG */ #define PMAP_TIMEOUT (10) #define CONNECT_TIMEOUT (20) @@ -543,11 +550,10 @@ static int probe_port(clnt_addr_t *server, const unsigned long *versions, } if (clnt_ping(saddr, prog, *p_vers, *p_prot, NULL)) goto out_ok; - if (rpc_createerr.cf_stat == RPC_TIMEDOUT) - goto out_bad; } } if (rpc_createerr.cf_stat != RPC_PROGNOTREGISTERED && + rpc_createerr.cf_stat != RPC_TIMEDOUT && rpc_createerr.cf_stat != RPC_PROGVERSMISMATCH) goto out_bad; @@ -556,6 +562,9 @@ static int probe_port(clnt_addr_t *server, const unsigned long *versions, continue; p_prot = protos; } + if (rpc_createerr.cf_stat == RPC_TIMEDOUT) + goto out_bad; + if (vers || !*++p_vers) break; }