Date: Sat, 1 Jul 2000 14:31:00 -0700 (MST) From: "Chad R. Larson" <chad@DCFinc.com> To: marki@paradise.net.nz (Mark Ibell) Cc: freebsd-stable@FreeBSD.ORG Subject: Re: [Fwd: telnet/tcp problems in 4.0-RELEASE] Message-ID: <200007012131.OAA14850@freeway.dcfinc.com> In-Reply-To: <001101bfe330$b138faa0$0101a8c0@rf.org> from Mark Ibell at "Jul 1, 0 07:47:15 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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
[-- Attachment #2 --]
# 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 <stdio.h>
X#include <sys/types.h>
X#include <netdb.h> /* for struct hostent */
X#include <sys/socket.h> /* for AF_INET */
X#include <netinet/in.h> /* for struct in_addr */
X#include <arpa/inet.h> /* 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200007012131.OAA14850>
