NetBSD Problem Report #3468

Received: (qmail-queue invoked from smtpd); 9 Apr 1997 13:51:03 -0000
Message-Id: <199704091348.QAA19116@awreety.research.nokia.com>
Date: Wed, 9 Apr 1997 16:48:10 +0300 (EEST)
From: jtp@iki.fi
Reply-To: jtp@iki.fi
To: gnats-bugs@gnats.netbsd.org
Subject: ping -n calls gethostbyaddr()
X-Send-Pr-Version: 3.95

>Number:         3468
>Category:       bin
>Synopsis:       ping -n calls gethostbyaddr()
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 09 07:05:01 +0000 1997
>Closed-Date:    Thu Apr 10 20:59:31 +0000 1997
>Last-Modified:  Fri Apr 11 04:00:15 +0000 1997
>Originator:     Jukka Partanen
>Release:        April 7, 1997
>Organization:
	None
>Environment:
System: NetBSD awreety.research.nokia.com 1.2D NetBSD 1.2D (AWREETY) #1: Mon Apr 7 10:03:02 EEST 1997 partanen@awreety.research.nokia.com:/usr/src/current/src/sys/arch/i386/compile/AWREETY i386


>Description:
	Using ping with -n calls gethostbyaddr() resulting in a DNS query 
	which may take a while to timeout. According to ping(8) this should
	not happen.

>How-To-Repeat:
	ping -n 1.2.3.4

>Fix:
--- ping.c.orig	Mon Mar 24 14:16:55 1997
+++ ping.c	Wed Apr  9 16:41:27 1997
@@ -1603,8 +1603,11 @@
     if (inet_aton(name, &sa->sin_addr) != 0) {
 	    if (realname == NULL)
 		return;
-	    hp = gethostbyaddr((char *) &sa->sin_addr, sizeof(sa->sin_addr), 
-		AF_INET);
+	    if ((pingflags & F_NUMERIC) != 0)
+		hp = NULL;
+	    else
+		hp = gethostbyaddr((char *) &sa->sin_addr,
+				   sizeof(sa->sin_addr), AF_INET);
 	    if (hp == NULL)
 		(void) strncpy(realname, name, MAXHOSTNAMELEN);
 	    else


>Release-Note:
>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: mikel
State-Changed-When: Thu Apr 10 20:59:31 1997
State-Changed-Why:
this was fixed by augustss on 19970402.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.