From owner-freebsd-stable Sat Jul 1 14:31:16 2000 Delivered-To: freebsd-stable@freebsd.org Received: from freeway.dcfinc.com (cx74889-a.phnx3.az.home.com [24.1.193.157]) by hub.freebsd.org (Postfix) with ESMTP id AB04C37BCFE for ; Sat, 1 Jul 2000 14:31:07 -0700 (PDT) (envelope-from chad@freeway.dcfinc.com) Received: (from chad@localhost) by freeway.dcfinc.com (8.8.8/8.8.8) id OAA14850; Sat, 1 Jul 2000 14:31:01 -0700 (MST) (envelope-from chad) From: "Chad R. Larson" Message-Id: <200007012131.OAA14850@freeway.dcfinc.com> Subject: Re: [Fwd: telnet/tcp problems in 4.0-RELEASE] In-Reply-To: <001101bfe330$b138faa0$0101a8c0@rf.org> from Mark Ibell at "Jul 1, 0 07:47:15 pm" To: marki@paradise.net.nz (Mark Ibell) Date: Sat, 1 Jul 2000 14:31:00 -0700 (MST) Cc: freebsd-stable@FreeBSD.ORG Reply-To: chad@DCFinc.com X-Mailer: ELM [version 2.4ME+ PL40 (25)] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=ELM962487060-14798-0_ Content-Transfer-Encoding: 7bit Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --ELM962487060-14798-0_ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit As I recall, Mark Ibell wrote: > The problem appears to be related to the absence of a domain extension. > For example, on the machine in question (mars.econz.co.nz): > > # ftp localhost > [pauses for 75 seconds] > > # ftp localhost.econz.co.nz > [connects straight away] If you compile the attached program, and use it to lookup "localhost", what do you get? -crl -- Chad R. Larson (CRL15) 602-953-1392 Brother, can you paradigm? chad@dcfinc.com chad@larsons.org larson1@home.net DCF, Inc. - 14623 North 49th Place, Scottsdale, Arizona 85254-2207 --ELM962487060-14798-0_ Content-Type: application/x-shar Content-Disposition: attachment; filename=gethost.shar Content-Description: gethostbyname(3) command line wrapper Content-Transfer-Encoding: 7bit # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # gethost.c # Makefile # echo x - gethost.c sed 's/^X//' >gethost.c << 'END-of-gethost.c' X/* $Id: gethost.c,v 1.1 2000/05/17 04:52:06 chad Exp $*/ X X/* X * Print the "hostent" information for every host whose name is X * specified on the command line. X */ X X#include X#include X#include /* for struct hostent */ X#include /* for AF_INET */ X#include /* for struct in_addr */ X#include /* for inet_ntoa() */ X X#define FALSE 0 X#define TRUE ~FALSE X Xmain(argc, argv) Xint argc; Xchar **argv; X{ X register char *ptr; X register struct hostent *hostptr; X int tcp_flag = FALSE; /* stream or dgram ? */ X X if (argc < 2) { X printf("Usage: %s hostname [...]\n", argv[0]); X exit(1); X } X X if (argc > 2) { /* use virtual circuit if more than one query */ X tcp_flag = TRUE; X sethostent(TRUE); X } X X while (--argc > 0) { X ptr = *++argv; X if ( (hostptr = gethostbyname(ptr)) == NULL) { X printf("gethostbyname error for host %s: ", ptr); X err_ret(h_errno); X continue; X } X printf("\nOfficial host name: %s\n", hostptr->h_name); X X /* go through the list of aliases */ X while ( (ptr = *(hostptr->h_aliases)) != NULL) { X printf(" alias: %s\n", ptr); X hostptr->h_aliases++; X } X X switch (hostptr->h_addrtype) { X case AF_INET: X pr_inet(hostptr->h_addr_list, hostptr->h_length); X break; X X default: X printf("unknown address type"); X break; X } X } X if (tcp_flag) X endhostent(); X} X X/* X * Go through a list of Internet addresses, X * printing each one in dotted-decimal notation. X */ X Xpr_inet(listptr, length) Xchar **listptr; Xint length; X{ X struct in_addr *ptr; X X while ( (ptr = (struct in_addr *) *listptr++) != NULL) X printf(" Internet address: %s\n", inet_ntoa(*ptr)); X} X X/* X * Display hostent error code X */ X Xerr_ret(err) Xint err; X{ X switch (err) { X case HOST_NOT_FOUND: X printf("Authoritative Answer Host not found\n"); X break; X case TRY_AGAIN: X printf("Non-Authoritive Host not found, or server fail\n"); X break; X case NO_RECOVERY: X printf("Non recoverable errors, FORMERR, REFUSED, NOTIMP\n"); X break; X case NO_DATA: X printf("Valid name, no data record of requested type\n"); X default: X printf("Unknown error code %d\n", err); X break; X } X} END-of-gethost.c echo x - Makefile sed 's/^X//' >Makefile << 'END-of-Makefile' X# Makefile for the host name lookup program X# $Id: Makefile,v 1.1 2000/05/17 04:52:06 chad Exp $ X XBINDIR = /usr/local/bin X Xgethost: gethost.o X $(CC) $(CFLAGS) gethost.o -o gethost X Xinstall: gethost X install -C -s gethost $(BINDIR) X X.c.o: X $(CC) $(CFLAGS) -c $< END-of-Makefile exit --ELM962487060-14798-0_-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message