X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils%2Fmount%2Fnetwork.c;h=2db694d2541bb1a8acfe8d3956bbc14d1de8a84f;hb=8f1abb8ab1f7afcb9c2c0c094255d7e438b57b09;hp=75354a7a62f044b2fec594beeb9a0c57ccddc1ec;hpb=8508942e7244017325690e2d0c17429fa0cb9873;p=nfs-utils.git diff --git a/utils/mount/network.c b/utils/mount/network.c index 75354a7..2db694d 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -48,6 +48,24 @@ #include "mount_constants.h" #include "network.h" +/* + * 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) #define MOUNT_TIMEOUT (30) @@ -447,7 +465,7 @@ static unsigned short getport(struct sockaddr_in *saddr, bind_saddr = *saddr; bind_saddr.sin_port = htons(PMAPPORT); - socket = get_socket(&bind_saddr, proto, PMAP_TIMEOUT, FALSE, FALSE); + socket = get_socket(&bind_saddr, proto, PMAP_TIMEOUT, FALSE, TRUE); if (socket == RPC_ANYSOCK) { if (proto == IPPROTO_TCP && rpc_createerr.cf_error.re_errno == ETIMEDOUT) @@ -536,6 +554,7 @@ static int probe_port(clnt_addr_t *server, const unsigned long *versions, } if (rpc_createerr.cf_stat != RPC_PROGNOTREGISTERED && rpc_createerr.cf_stat != RPC_TIMEDOUT && + rpc_createerr.cf_stat != RPC_CANTRECV && rpc_createerr.cf_stat != RPC_PROGVERSMISMATCH) goto out_bad; @@ -544,7 +563,8 @@ static int probe_port(clnt_addr_t *server, const unsigned long *versions, continue; p_prot = protos; } - if (rpc_createerr.cf_stat == RPC_TIMEDOUT) + if (rpc_createerr.cf_stat == RPC_TIMEDOUT || + rpc_createerr.cf_stat == RPC_CANTRECV) goto out_bad; if (vers || !*++p_vers)