summaryrefslogtreecommitdiffstats
path: root/utils/statd
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2010-01-14 12:23:09 -0500
committerSteve Dickson <steved@redhat.com>2010-01-15 14:55:51 -0500
commit18c3a41364836e61ceeb8e615e2b059904c5b65f (patch)
treed5ad64b32eb434d108f542a388b37ca003bff1fc /utils/statd
parent51fdac83e3afd86d0885c6b83123758708da61b1 (diff)
downloadnfs-utils-18c3a41364836e61ceeb8e615e2b059904c5b65f.tar.gz
nfs-utils-18c3a41364836e61ceeb8e615e2b059904c5b65f.tar.xz
nfs-utils-18c3a41364836e61ceeb8e615e2b059904c5b65f.zip
sm-notify: Support IPv6 DNS lookups in smn_lookup
When IPV6_SUPPORTED is enabled and the local system has IPv6 support, request AF_INET6 and AF_INET addresses from the DNS resolver. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'utils/statd')
-rw-r--r--utils/statd/sm-notify.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c
index 259db09..8d90d1f 100644
--- a/utils/statd/sm-notify.c
+++ b/utils/statd/sm-notify.c
@@ -33,6 +33,10 @@
#include "nsm.h"
#include "nfsrpc.h"
+#ifndef HAVE_DECL_AI_ADDRCONFIG
+#define AI_ADDRCONFIG 0
+#endif
+
#define NSM_TIMEOUT 2
#define NSM_MAX_TIMEOUT 120 /* don't make this too big */
@@ -65,19 +69,20 @@ static int record_pid(void);
static struct nsm_host * hosts = NULL;
-static struct addrinfo *smn_lookup(const char *name)
+__attribute_malloc__
+static struct addrinfo *
+smn_lookup(const char *name)
{
- struct addrinfo *ai, hint = {
-#if HAVE_DECL_AI_ADDRCONFIG
+ struct addrinfo *ai = NULL;
+ struct addrinfo hint = {
.ai_flags = AI_ADDRCONFIG,
-#endif /* HAVE_DECL_AI_ADDRCONFIG */
- .ai_family = AF_INET,
- .ai_protocol = IPPROTO_UDP,
+ .ai_family = (nsm_family == AF_INET ? AF_INET: AF_UNSPEC),
+ .ai_protocol = (int)IPPROTO_UDP,
};
int error;
error = getaddrinfo(name, NULL, &hint, &ai);
- if (error) {
+ if (error != 0) {
xlog(D_GENERAL, "getaddrinfo(3): %s", gai_strerror(error));
return NULL;
}