Package: iputils-ping
Version: 3:20020927-2
Severity: normal
Tags: patch

Ping assumes gethostbyname returns AF_INET results only, which is no
longer true when the inet6 option is set in /etc/resolv.conf. This makes
ping fail under this configuration.

Gethostbyname2 (which ping6 uses) allows the selection of an address
family. I suggest ping is changed to use it (patch attached.)

-- 
Jeremie Koenig <[EMAIL PROTECTED]>
diff -ru iputils-20020927.orig/ping.c iputils-20020927/ping.c
--- iputils-20020927.orig/ping.c        2002-09-20 17:08:11.000000000 +0200
+++ iputils-20020927/ping.c     2005-04-17 04:06:01.000000000 +0200
@@ -232,7 +232,7 @@
                        if (argc == 1)
                                options |= F_NUMERIC;
                } else {
-                       hp = gethostbyname(target);
+                       hp = gethostbyname2(target, AF_INET);
                        if (!hp) {
                                fprintf(stderr, "ping: unknown host %s\n", 
target);
                                exit(2);

Reply via email to