nfs-utils/nfs-utils-1.1.2-connect-UDP.patch

42 lines
1.4 KiB
Diff

From 59f85cc9ab483bea0da743a876bf70f483dd36eb Mon Sep 17 00:00:00 2001
From: Neil Brown <neilb@suse.de>
Date: Mon, 21 Jul 2008 11:12:59 +1000
References: bnc#404170
Subject: [PATCH] Use connected socket when probing portmap with UDP.
This allows us to get errors back promptly, and sometimes avoid
timeout.
---
utils/mount/network.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- nfs-utils-1.1.3.orig/utils/mount/network.c
+++ nfs-utils-1.1.3/utils/mount/network.c
@@ -447,7 +447,7 @@ static unsigned short getport(struct soc
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)
@@ -539,6 +539,7 @@ static int probe_port(clnt_addr_t *serve
}
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;
@@ -547,7 +548,8 @@ static int probe_port(clnt_addr_t *serve
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)