summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2016-04-20 17:07:53 -0400
committerRay Strode <rstrode@redhat.com>2017-03-03 15:28:50 -0500
commit0f9f574626b61b78ba27a7ba61dabbbf0e38415d (patch)
tree50cbe6827afd6a4c231d8dba32b822322aa9d749 /common
parent5c9e120594839b0597bc7bb8d06be7ba1076c0d8 (diff)
downloadgdm-0f9f574626b61b78ba27a7ba61dabbbf0e38415d.tar.gz
common: limit potentially expensive name lookups
Right now we're doing name look ups when we don't have to. These name look ups can cause lengthy timeouts in misconfigured environments. This commit reduces the name looks used by GDM to make it more resiliant to failure. Ported from RHEL 6 to RHEL 7 by Ashish Shah <ashishks@redhat.com> https://bugzilla.gnome.org/show_bug.cgi?id=779499
Diffstat (limited to 'common')
-rw-r--r--common/gdm-address.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/common/gdm-address.c b/common/gdm-address.c
index 34480380..a8b73e28 100644
--- a/common/gdm-address.c
+++ b/common/gdm-address.c
@@ -220,14 +220,13 @@ address_family_str (GdmAddress *address)
static void
_gdm_address_debug (GdmAddress *address,
- const char *hostname,
const char *host,
const char *port)
{
- g_debug ("Address family:%d (%s) hostname:%s host:%s port:%s local:%d loopback:%d",
+ g_debug ("Address family:%d (%s) host:%s port:%s local:%d loopback:%d",
+
address->ss->ss_family,
address_family_str (address) ? address_family_str (address) : "(null)",
- hostname ? hostname : "(null)",
host ? host : "(null)",
port ? port : "(null)",
gdm_address_is_local (address),
@@ -237,13 +236,14 @@ _gdm_address_debug (GdmAddress *address,
void
gdm_address_debug (GdmAddress *address)
{
- char *hostname;
- char *host;
- char *port;
+ char *hostname = NULL;
+ char *host = NULL;
+ char *port = NULL;
- gdm_address_get_hostname (address, &hostname);
gdm_address_get_numeric_info (address, &host, &port);
+ _gdm_address_debug (address, host, port);
+
g_free (hostname);
g_free (host);
g_free (port);
@@ -277,7 +277,8 @@ gdm_address_get_hostname (GdmAddress *address,
err_msg = gai_strerror (res);
g_warning ("Unable to lookup hostname: %s",
err_msg ? err_msg : "(null)");
- _gdm_address_debug (address, NULL, NULL, NULL);
+ _gdm_address_debug (address, NULL, NULL);
+
}
/* try numeric? */
@@ -318,7 +319,7 @@ gdm_address_get_numeric_info (GdmAddress *address,
err_msg = gai_strerror (res);
g_warning ("Unable to lookup numeric info: %s",
err_msg ? err_msg : "(null)");
- _gdm_address_debug (address, NULL, NULL, NULL);
+ _gdm_address_debug (address, NULL, NULL);
} else {
ret = TRUE;
}
@@ -404,8 +405,6 @@ add_local_siocgifconf (GList **list)
address = gdm_address_new_from_sockaddr ((struct sockaddr *)&ifreq.ifr_addr,
sizeof (struct sockaddr));
- gdm_address_debug (address);
-
*list = g_list_append (*list, address);
}
}
@@ -437,7 +436,8 @@ add_local_addrinfo (GList **list)
memset (&hints, 0, sizeof (hints));
hints.ai_family = AF_UNSPEC;
- hints.ai_flags = AI_CANONNAME;
+ hints.ai_flags = AI_CANONNAME | AI_NUMERICHOST;
+
g_debug ("GdmAddress: looking up hostname: %s", hostbuf);
result = NULL;