Index | Thread | Search

From:
Alexander Bluhm <bluhm@openbsd.org>
Subject:
Re: netstat(1): get rid of inet_aton
To:
tech <tech@openbsd.org>
Date:
Mon, 12 Aug 2024 00:24:38 +0200

Download raw body.

Thread
  • Theo de Raadt:

    netstat(1): get rid of inet_aton

  • Alexander Bluhm:

    netstat(1): get rid of inet_aton

  • On Sun, Aug 11, 2024 at 06:00:03PM +0200, Florian Obser wrote:
    > localhost is just a weird spelling for 127.0.0.1...
    > 
    > I'm not entirely sure how to tickle this code though.
    > 
    > OK?
    
    OK bluhm@
    
    > diff --git inet.c inet.c
    > index 88d37be055e..a6c0a4b8282 100644
    > --- inet.c
    > +++ inet.c
    > @@ -813,7 +813,6 @@ static char *
    >  getrpcportnam(in_port_t port, int proto)
    >  {
    >  	struct sockaddr_in server_addr;
    > -	struct hostent *hp;
    >  	static struct pmaplist *head;
    >  	int socket = RPC_ANYSOCK;
    >  	struct timeval minutetimeout;
    > @@ -828,11 +827,7 @@ getrpcportnam(in_port_t port, int proto)
    >  		first = 1;
    >  		memset(&server_addr, 0, sizeof server_addr);
    >  		server_addr.sin_family = AF_INET;
    > -		if ((hp = gethostbyname("localhost")) != NULL)
    > -			memmove((caddr_t)&server_addr.sin_addr, hp->h_addr,
    > -			    hp->h_length);
    > -		else
    > -			(void) inet_aton("0.0.0.0", &server_addr.sin_addr);
    > +		(void) inet_pton(AF_INET, "127.0.0.1", &server_addr.sin_addr);
    >  
    >  		minutetimeout.tv_sec = 60;
    >  		minutetimeout.tv_usec = 0;
    > 
    > 
    > -- 
    > In my defence, I have been left unsupervised.
    
    
    
  • Theo de Raadt:

    netstat(1): get rid of inet_aton

  • Alexander Bluhm:

    netstat(1): get rid of inet_aton