Blame SOURCES/autofs-5.1.4-improve-hostname-lookup-error-logging.patch

d5dcad
autofs-5.1.4 - improve hostname lookup error logging
d5dcad
d5dcad
From: Ian Kent <raven@themaw.net>
d5dcad
d5dcad
There's not enough information in name lookup log messages
d5dcad
to determine if the failed lookup is in fact a problem or
d5dcad
is expected.
d5dcad
d5dcad
Signed-off-by: Ian Kent <raven@themaw.net>
d5dcad
---
d5dcad
 CHANGELOG            |    1 +
d5dcad
 lib/parse_subs.c     |    3 ++-
d5dcad
 lib/rpc_subs.c       |    3 ++-
d5dcad
 modules/dclist.c     |    4 +++-
d5dcad
 modules/parse_amd.c  |    9 ++++++---
d5dcad
 modules/replicated.c |    5 +++--
d5dcad
 6 files changed, 17 insertions(+), 8 deletions(-)
d5dcad
d5dcad
diff --git a/CHANGELOG b/CHANGELOG
d5dcad
index f771a433..596590a8 100644
d5dcad
--- a/CHANGELOG
d5dcad
+++ b/CHANGELOG
d5dcad
@@ -19,6 +19,7 @@ xx/xx/2018 autofs-5.1.5
d5dcad
 - add fedfs-map-nfs4.c.
d5dcad
 - add conditional inclusion of fedfs binaries.
d5dcad
 - add an example fedfs master map entry to the installed master map.
d5dcad
+- improve hostname lookup error logging.
d5dcad
 
d5dcad
 19/12/2017 autofs-5.1.4
d5dcad
 - fix spec file url.
d5dcad
diff --git a/lib/parse_subs.c b/lib/parse_subs.c
d5dcad
index db784a58..841e81fd 100644
d5dcad
--- a/lib/parse_subs.c
d5dcad
+++ b/lib/parse_subs.c
d5dcad
@@ -476,7 +476,8 @@ unsigned int get_network_proximity(const char *name)
d5dcad
 
d5dcad
 	ret = getaddrinfo(name_or_num, NULL, &hints, &ni);
d5dcad
 	if (ret) {
d5dcad
-		logerr("getaddrinfo: %s", gai_strerror(ret));
d5dcad
+		logerr("hostname lookup for %s failed: %s",
d5dcad
+		       name_or_num, gai_strerror(ret));
d5dcad
 		return PROXIMITY_ERROR;
d5dcad
 	}
d5dcad
 
d5dcad
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
d5dcad
index 60ede9f8..cc83e84d 100644
d5dcad
--- a/lib/rpc_subs.c
d5dcad
+++ b/lib/rpc_subs.c
d5dcad
@@ -693,7 +693,8 @@ static int create_client(struct conn_info *info, CLIENT **client)
d5dcad
 	ret = getaddrinfo(info->host, NULL, &hints, &ai;;
d5dcad
 	if (ret) {
d5dcad
 		error(LOGOPT_ANY,
d5dcad
-		      "hostname lookup failed: %s", gai_strerror(ret));
d5dcad
+		      "hostname lookup for %s failed: %s",
d5dcad
+		      info->host, gai_strerror(ret));
d5dcad
 		goto out_close;
d5dcad
 	}
d5dcad
 
d5dcad
diff --git a/modules/dclist.c b/modules/dclist.c
d5dcad
index 4daa199b..ba32134d 100644
d5dcad
--- a/modules/dclist.c
d5dcad
+++ b/modules/dclist.c
d5dcad
@@ -357,7 +357,9 @@ static char *getdnsdomainname(unsigned int logopt)
d5dcad
 
d5dcad
 	ret = getaddrinfo(name, NULL, &hints, &ni);
d5dcad
 	if (ret) {
d5dcad
-		error(logopt, "hostname lookup failed: %s", gai_strerror(ret));
d5dcad
+		error(logopt,
d5dcad
+		      "hostname lookup for %s failed: %s",
d5dcad
+		      name, gai_strerror(ret));
d5dcad
 		return NULL;
d5dcad
 	}
d5dcad
 
d5dcad
diff --git a/modules/parse_amd.c b/modules/parse_amd.c
d5dcad
index e7debc56..9543ced3 100644
d5dcad
--- a/modules/parse_amd.c
d5dcad
+++ b/modules/parse_amd.c
d5dcad
@@ -260,7 +260,8 @@ static int match_my_name(unsigned int logopt, const char *name, struct substvar
d5dcad
 	ret = getaddrinfo(v->val, NULL, &hints, &cni);
d5dcad
 	if (ret) {
d5dcad
 		error(logopt, MODPREFIX
d5dcad
-		      "hostname lookup failed: %s\n", gai_strerror(ret));
d5dcad
+		      "hostname lookup for %s failed: %s\n",
d5dcad
+		      v->val, gai_strerror(ret));
d5dcad
 		goto out;
d5dcad
 	}
d5dcad
 
d5dcad
@@ -270,7 +271,8 @@ static int match_my_name(unsigned int logopt, const char *name, struct substvar
d5dcad
 	ret = getaddrinfo(name, NULL, &hints, &ni);
d5dcad
 	if (ret) {
d5dcad
 		error(logopt, MODPREFIX
d5dcad
-		      "hostname lookup failed: %s\n", gai_strerror(ret));
d5dcad
+		      "hostname lookup for %s failed: %s\n",
d5dcad
+		      name, gai_strerror(ret));
d5dcad
 		freeaddrinfo(cni);
d5dcad
 		goto out;
d5dcad
 	}
d5dcad
@@ -678,7 +680,8 @@ static char *normalize_hostname(unsigned int logopt, const char *host,
d5dcad
 		ret = getaddrinfo(host, NULL, &hints, &ni);
d5dcad
 		if (ret) {
d5dcad
 			error(logopt, MODPREFIX
d5dcad
-			      "hostname lookup failed: %s", gai_strerror(ret));
d5dcad
+			      "hostname lookup for %s failed: %s",
d5dcad
+			      host, gai_strerror(ret));
d5dcad
 			return NULL;
d5dcad
 		}
d5dcad
 		name = strdup(ni->ai_canonname);
d5dcad
diff --git a/modules/replicated.c b/modules/replicated.c
d5dcad
index f7b83236..740270ec 100644
d5dcad
--- a/modules/replicated.c
d5dcad
+++ b/modules/replicated.c
d5dcad
@@ -1007,8 +1007,9 @@ try_name:
d5dcad
 
d5dcad
 	ret = getaddrinfo(name, NULL, &hints, &ni);
d5dcad
 	if (ret) {
d5dcad
-		error(LOGOPT_ANY, "hostname lookup failed: %s",
d5dcad
-		      gai_strerror(ret));
d5dcad
+		error(LOGOPT_ANY,
d5dcad
+		      "hostname lookup for %s failed: %s",
d5dcad
+		      name, gai_strerror(ret));
d5dcad
 		free(name);
d5dcad
 		return 0;
d5dcad
 	}