Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 Aug 2000 10:47:43 -0400 (EDT)
From:      Alexander Anderson <cactoss@galima.2y.net>
To:        freebsd-hackers@freebsd.org
Subject:   Re: localhost cannot be resolved
Message-ID:  <200008121447.KAA03691@galima.2y.net>
In-Reply-To: <8n2v5k$kjv$1@FreeBSD.csie.NCTU.edu.tw>
References:  <8n2v5k$kjv$1@FreeBSD.csie.NCTU.edu.tw>

next in thread | previous in thread | raw e-mail | index | archive | help
> Which version of FreeBSD are you using?

4.0-RELEASE

> > telnet localhost
> cactoss> localhost: No address associated with hostname
> > echo $?
> cactoss> 1
> 
> It seems getaddrinfo(3) was failed.
> What's curious.  Rlogin, rsh and ftp call getaddrinfo(3), too.  Why is
> it only telnet and fetchmail?

I tried to look at the sources for telnet. In file commands.c:2292, there's
an assignment of variable "family". I couldn't understand where the variable
is coming from. Still, I wrote a simple program to see under what
circumstances getaddrinfo fails for localhost. It doesn't seem to fail at
all?!..

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>

int main( int argc, char** argv ) {
  struct addrinfo hints, *res;
  int status;
  
  if ( argc != 2 ) {
    fprintf( stderr, "usage: %s hostname\n", argv[0] );
    exit(2);
  }
  
  memset( &hints, 0, sizeof(hints) );
  /*hints.ai_flags = AI_NUMERICHOST;*/
  /*hints.ai_flags = AI_PASSIVE;*/
  hints.ai_flags = AI_CANONNAME;
  /*hints.ai_family = PF_UNSPEC;*/
  hints.ai_family = AF_INET6;
  hints.ai_socktype = SOCK_STREAM;

  status = getaddrinfo( argv[1], "telnet", &hints, &res );
  if ( status == 0 ) {
    printf( "success\n" );
  } else {
    fprintf( stderr, "%s\n", gai_strerror( status ) );
  }
  
  return 0;
}

[skipped]

> You don't have SMTP/IPv6 listen.  This should be OK.
> So, SMTP connection to ::1 was fail.  Then, SMTP connection to
> 127.0.0.1 was tried.
> It seems IDENT query was made in correspondings to SMTP connection to
> 127.0.0.1.  I think you have SMTP/IPv4 listen.

Yes, sendmail is listening on port 25. I can telnet 127.0.0.1 25.

Could you please take a look at `ifconfig lo0`:

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x6 
	inet6 ::1 prefixlen 128 
	inet 127.0.0.1 netmask 0xff000000 

Does it look okay?

[skipped]

> I think libtool has no relation with this problem.  It may rely on
> firewall rule.

My firewall is open. I decided that I'd only block certain ports:

# ipfw show
00100  560   33466 allow ip from any to any via lo0
00200    0       0 deny ip from any to 127.0.0.0/8
00300   21     924 allow tcp from any to any 25 via tun0 setup
00400   57    2524 allow tcp from any to any 80 via tun0 setup
00500   10     424 deny tcp from any to any 1-1024 in recv tun0
00600   68    2860 deny tcp from any 1-1024 to any out xmit tun0
00700    0       0 deny tcp from any to any 6000-6063 in recv tun0
00800    0       0 deny tcp from any 6000-6063 to any out xmit tun0
00900    0       0 deny tcp from any to any 3306 in recv tun0
01000    0       0 deny tcp from any 3306 to any out xmit tun0
65000 4982 1773612 allow ip from any to any
65535    0       0 deny ip from any to any

I also tried flushing all the rules and allowing all traffic to see whether
the firewall was the cause of my problem. I didn't change anything, so I
doubt it is the firewall.

One question. Firewall rules apply to both IPv4 and IPv6, right? There
shouldn't be separate rules to IPv6, should there?

Thanks!


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008121447.KAA03691>