From owner-freebsd-questions Mon Nov 26 10:21:20 2001 Delivered-To: freebsd-questions@freebsd.org Received: from gull.prod.itd.earthlink.net (gull.mail.pas.earthlink.net [207.217.120.84]) by hub.freebsd.org (Postfix) with ESMTP id C5A9637B41E for ; Mon, 26 Nov 2001 10:20:49 -0800 (PST) Received: from user-38lc2nf.dialup.mindspring.com ([209.86.10.239] helo=gohan.cjclark.org) by gull.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 168QN4-0002Py-00; Mon, 26 Nov 2001 10:20:48 -0800 Received: (from cjc@localhost) by gohan.cjclark.org (8.11.6/8.11.1) id fAQ97rl00488; Mon, 26 Nov 2001 01:07:53 -0800 (PST) (envelope-from cjc) Date: Mon, 26 Nov 2001 01:07:53 -0800 From: "Crist J. Clark" To: John Smith Cc: Simon Dick , Jim Conner , FreeBSD Questions Subject: Re: can't do reverse dns with /etc/hosts Message-ID: <20011126010753.E222@gohan.cjclark.org> Reply-To: cjclark@alum.mit.edu References: <5.1.0.14.0.20011123164749.0245ec60@mail.enterit.com> <20011114173647.D66694@blossom.cjclark.org> <20011115012039.GA61093@shall.anarcat.dyndns.org> <20011114173647.D66694@blossom.cjclark.org> <5.1.0.14.0.20011123164749.0245ec60@mail.enterit.com> <5.1.0.14.0.20011123172728.02c61518@mail.enterit.com> <20011124103734.GB386@irrelevant.org> <3BFFF17E.D2E2F7C1@anarcat.dyndns.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="7JfCtLOvnd9MIVvH" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3BFFF17E.D2E2F7C1@anarcat.dyndns.org>; from anarcat@anarcat.dyndns.org on Sat, Nov 24, 2001 at 02:14:06PM -0500 X-URL: http://people.freebsd.org/~cjc/ Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, Nov 24, 2001 at 02:14:06PM -0500, John Smith wrote: > > > Simon Dick wrote: > > > > I guess my method of just using ping and seeing what IP it tries > > to ping won't be suitable for this? :) > > no because I want to test reverse DNS. That does not make any sense. You want to test reverse-DNS without using DNS? ITYM, "I want to test address-to-hostname translation using /etc/hosts." I couldn't sleep so I wrote a quick program. -- Crist J. Clark cjclark@alum.mit.edu --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="iplookup.c" /* * Copyright (c) 2001 Crist J. Clark * $Id: iplookup.c,v 1.2 2001/11/26 09:07:02 cjc Exp $ */ #include #include #include #include #include #include #include #include int main(int argc, char *argv[]) { struct hostent *h; struct in_addr a; int i, j; for (i = 1; i < argc; i++) { if (inet_aton(argv[i], &a) == 0) errx(EX_USAGE, "could not parse IP address: %s", argv[i]); if ((h = gethostbyaddr((char *)&a, sizeof a, AF_INET)) == NULL) errx(EX_OSERR, "address, %s, failed: %s", argv[i], hstrerror(h_errno)); printf("%s\n", h->h_name); for (j = 0; h->h_aliases[j] != NULL; j++) printf("\t%s\n", h->h_aliases[j]); } return 0; } --7JfCtLOvnd9MIVvH-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message