summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Cameron <brian.cameron@sun.com>2007-11-16 18:10:26 +0000
committerBrian Cameron <bcameron@src.gnome.org>2007-11-16 18:10:26 +0000
commitf2ac5b9ea1b3acbb5b21efa14e3d892c0b2bf57b (patch)
tree6256a5697587c834d7cb55df9334b90c2bd097ea
parent5274966f663f11b8e5838d210b4785bdb005d1ab (diff)
downloadgdm-f2ac5b9ea1b3acbb5b21efa14e3d892c0b2bf57b.tar.gz
Add back hinting, with a preference towards IPv6. Patch by Ely Levy
2007-11-16 Brian Cameron <brian.cameron@sun.com> * daemon/misc.c: Add back hinting, with a preference towards IPv6. Patch by Ely Levy <nakeee@gmail.com>. svn path=/branches/gnome-2-20/; revision=5512
-rw-r--r--ChangeLog5
-rw-r--r--daemon/misc.c19
2 files changed, 23 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a1f19b86..0ca219b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-16 Brian Cameron <brian.cameron@sun.com>
+
+ * daemon/misc.c: Add back hinting, with a preference towards
+ IPv6. Patch by Ely Levy <nakeee@gmail.com>.
+
2007-11-14 Brian Cameron <brian.cameron@sun.com>
* Reversing last commit since it broke string freeze.
diff --git a/daemon/misc.c b/daemon/misc.c
index f180a89a..c8d950d6 100644
--- a/daemon/misc.c
+++ b/daemon/misc.c
@@ -899,6 +899,7 @@ gdm_address_peek_local_list (void)
static GList *the_list = NULL;
static time_t last_time = 0;
char hostbuf[BUFSIZ];
+ struct addrinfo hints;
struct addrinfo *result;
struct addrinfo *res;
@@ -919,12 +920,28 @@ gdm_address_peek_local_list (void)
snprintf (hostbuf, BUFSIZ-1, "localhost");
}
- if (getaddrinfo (hostbuf, NULL, NULL, &result) != 0) {
+ memset (&hints, 0, sizeof (hints));
+
+ hints.ai_family = AF_INET;
+
+#ifdef ENABLE_IPV6
+ hints.ai_family = AF_INET6;
+#endif
+
+#ifdef ENABLE_IPV6
+ if (getaddrinfo (hostbuf, NULL, &hints, &result) != 0) {
+ hints.ai_family = AF_INET;
+#endif
+
+ if (getaddrinfo (hostbuf, NULL, &hints, &result) != 0) {
gdm_debug ("%s: Could not get address from hostname!", "gdm_peek_local_address_list");
return NULL;
}
+#ifdef ENABLE_IPV6
+ }
+#endif
for (res = result; res != NULL; res = res->ai_next) {
struct sockaddr_storage *sa;