- improve hostname lookup error logging.

This commit is contained in:
Ian Kent 2018-03-06 18:19:32 +08:00
parent 166b24f13e
commit 10f0ff8b5d
2 changed files with 117 additions and 1 deletions

View File

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

View File

@ -8,7 +8,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.1.4
Release: 13%{?dist}
Release: 14%{?dist}
Epoch: 1
License: GPLv2+
Group: System Environment/Daemons
@ -33,6 +33,7 @@ Patch17: autofs-5.1.4-add-mount_fedfs_c.patch
Patch18: autofs-5.1.4-add-fedfs-map-nfs4_c.patch
Patch19: autofs-5.1.4-add-conditional-inclusion-of-fedfs-binaries.patch
Patch20: autofs-5.1.4-add-an-example-fedfs-master-map-entry-to-the-installed-master-map.patch
Patch21: autofs-5.1.4-improve-hostname-lookup-error-logging.patch
%if %{with_systemd}
BuildRequires: systemd-units
@ -112,6 +113,7 @@ echo %{version}-%{release} > .version
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%build
LDFLAGS=-Wl,-z,now
@ -206,6 +208,9 @@ fi
%dir /etc/auto.master.d
%changelog
* Tue Mar 06 2018 Ian Kent <ikent@redhat.com> - 1:5.1.4-14
- improve hostname lookup error logging.
* Tue Mar 06 2018 Ian Kent <ikent@redhat.com> - 1:5.1.4-13
- fix install permissions of auto.net and auto.smb.
- update change log.