Date: Mon, 26 Nov 2001 01:07:53 -0800 From: "Crist J. Clark" <cristjc@earthlink.net> To: John Smith <anarcat@anarcat.dyndns.org> Cc: Simon Dick <simond@irrelevant.org>, Jim Conner <jconner@enterit.com>, FreeBSD Questions <freebsd-questions@FreeBSD.ORG> Subject: Re: can't do reverse dns with /etc/hosts Message-ID: <20011126010753.E222@gohan.cjclark.org> In-Reply-To: <3BFFF17E.D2E2F7C1@anarcat.dyndns.org>; from anarcat@anarcat.dyndns.org on Sat, Nov 24, 2001 at 02:14:06PM -0500 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>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <hostname> 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 <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <err.h> #include <netdb.h> #include <stdio.h> #include <sysexits.h> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011126010753.E222>