[gnome-nettool/gnome-2-32] portability fix for systems that configure an ipv6 address by default, but use the ipv4 address for
- From: GermÃn Poà CaamaÃo <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-nettool/gnome-2-32] portability fix for systems that configure an ipv6 address by default, but use the ipv4 address for
- Date: Wed, 13 Jul 2011 08:49:58 +0000 (UTC)
commit 6b0d34532009301d2962961c75daec1abe51623a
Author: Jasper Lievisse Adriaanse <jasper humppa nl>
Date: Thu May 19 18:45:05 2011 +0200
portability fix for systems that configure an ipv6 address by default, but use the ipv4 address for actual traffic.
tweak decision logic for deciding if we should use the ipv4 or ipv6 tools.
it would default to ipv6 as most interfaces have an unused ipv6 address, while
actually using the ipv4 address. this fixes ping/traceroute functionality when
using hostnames instead of ip addresses.
Signed-off-by: GermÃn PÃo-CaamaÃo <gpoo gnome org>
src/nettool.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/nettool.c b/src/nettool.c
index 753e1b2..cd7a37a 100644
--- a/src/nettool.c
+++ b/src/nettool.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <netinet/in.h>
#include <signal.h>
#include <errno.h>
#include <sys/wait.h>
@@ -137,21 +138,21 @@ netinfo_get_ip_version (Netinfo * netinfo)
(GTK_BIN (netinfo->host)))));
if (strlen (ip) > 0) {
- host = gethostbyname2 (ip, AF_INET6);
+ host = gethostbyname2 (ip, AF_INET);
if (host == NULL) {
- host = gethostbyname2 (ip, AF_INET);
+ host = gethostbyname2 (ip, AF_INET6);
if (host == NULL)
return -1;
else {
g_free (ip);
- return IPV4;
+ return IPV6;
}
return -1;
}
else {
g_free (ip);
- return IPV6;
+ return IPV4;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]