buglwIP - A Lightweight TCP/IP stack - Bugs: bug #26657, DNS, if host name is...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #26657: DNS, if host name is "localhost", result is error.

Submitter:  hanhui <hanhui03>
Submitted:  Sun 24 May 2009 12:14:38 PM UTC
   
 
Category:  sockets/netconn Severity:  3 - Normal
Item Group:  Change Request Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  1.3.0

Sun 23 Aug 2009 01:55:49 PM UTC, comment #3: 

Fixed lwip_getaddrinfo() and dns_gethostbyname().

Simon Goldschmidt <goldsimon>
Group administrator
Sun 23 Aug 2009 01:47:57 PM UTC, comment #2: 

Seems like hanhui is correct:

Excerpt from gethostbyaddr description of opengroup:
"The addr argument of gethostbyaddr() shall be an in_addr structure when type is AF_INET. It contains a binary format (that is, not null-terminated) address in network byte order. The gethostbyaddr() function is not guaranteed to return addresses of address families other than AF_INET, even when such addresses exist in the database."

And after all, the addresses we return from real lookups are also in network byte order. This also has to be adjusted in dns_gethostbyname().

Simon Goldschmidt <goldsimon>
Group administrator
Tue 02 Jun 2009 11:04:44 AM UTC, comment #1: 

Are you sure?  I'd be surprised if we were supposed to return addresses in network byte order.

Kieran Mansley <kieranm>
Group Member
Sun 24 May 2009 12:14:38 PM UTC, original submission:  


---------------CODE----------------------

#if LWIP_HAVE_LOOPIF
  if (strcmp(hostname,"localhost")==0) {
    addr->addr = INADDR_LOOPBACK;
    return ERR_OK;
  }
#endif /* LWIP_HAVE_LOOPIF */

  if (nodename != NULL) {
    /* service location specified, try to resolve */
    err = netconn_gethostbyname(nodename, &addr);
    if (err != ERR_OK) {
      return EAI_FAIL;
    }
  } else {
    /* service location specified, use loopback address */
    addr.addr = INADDR_LOOPBACK;
  }
-----------------------------------------

addr->addr = INADDR_LOOPBACK;

should be

addr->addr = htonl(INADDR_LOOPBACK);



hanhui <hanhui03>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by kieranm (Posted a comment)
  • -email is unavailable- added by hanhui03 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-08-23 goldsimon StatusNeed Info Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
    2009-06-25 kieranm StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code