buglwIP - A Lightweight TCP/IP stack - Bugs: bug #28968, some request & DNS bug

 
 

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

bug #28968: some request & DNS bug

Submitted by:  hanhui <hanhui03>
Submitted on:  Mon 22 Feb 2010 08:27:36 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Change RequestStatus: Fixed
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: CVS Head

Mon 22 Feb 2010 11:16:15 PM UTC, comment #4:

Mac OS X (derived from BSD Unix, and certified as standard Unix) appears to be the same as Linux.

If you use setsockopt() to enable SO_RCVTIMEO, and insufficient data is received, then recv() will return after the timeout period. If no data was received, recv() returns -1 and errno is set to EAGAIN (EWOULDBLOCK is #defined as EAGAIN). If some data was received (but not enough to satisfy the length parameter) then a reduced count is returned but no error is reported.

The ETIMEDOUT error means that the connection has timed out (hence is unusable), so it is a fatal error.

Regarding the Windows API: in a somewhat old copy of MSDN, I can't see mention of any mechanism for a timeout on recv(), and there is no SO_RCVTIMEO, so Windows doesn't have a defined error code for that situation (unless one has been added since 2001).

David Empson <dempson>
Mon 22 Feb 2010 07:45:44 PM UTC, comment #3:

The documentation for setsockopt also says EWOULDBLOCK/EAGAIN:
http://opengroup.org/onlinepubs/009695399/functions/setsockopt.html

And BTW, on linux, EWOULDBLOCK is #defined to EAGAIN.

Jeff Barber <jeffbabar>
Mon 22 Feb 2010 07:10:05 PM UTC, comment #2:

> 1: sockets.c <line 129> should be ETIMEDOUT
> posix standard explained that EWOULDBLOCK is for the O_NONBLOCK > flag "time out", ETIMEOUT is the real time out.
> you can see it in
> http://www.opengroup.org/onlinepubs/009695399/functions/recv.html


I just checked that under win32 and linux, and it seems we are not the only ones having problems with that spec being not too clear here:
- windows returns ETIMEDOUT
- linux returns EAGAIN

Since windows doesn't really follow that spec, anyway (see SOCKET vs. int), I'd rather do it like linux (which is also what I read from the spec) - however, I don't know about other unixes.

BTW: It's not ETIMEOUT but ETIMEDOUT (note the missing 'D'), I think that makes a slight difference in the meaning of the constant, too.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Mon 22 Feb 2010 08:45:53 AM UTC, comment #1:

Fixed the dns bug, thanks for reporting. That's the problem with having too many configuration options: you always risk not compiling parts of the stack after making changes...

I'm not convinced about the socket return value though: As I read it, ETIMEOUT is a timeout that is returned when
a) connect() fails (no response after x retransmissions) or
b) send() times out
In both cases, the connection is dead afterwards.

Since we only use ERR_TIMEOUT with LWIP_SO_RCVTIMEO when accept() or recv() times out, EWOULDBLOCK seems like the better error to me (although the specification doesn't mention which is the correct value since it doesn't mention recv- or accept-timeout).

PS: The summary is not very informative :-)

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Mon 22 Feb 2010 08:27:36 AM UTC, original submission:

DNS BUG:

dns.c <line 433> should be : ip_addr_copy(entry->addr, *addr);

REQUESTS:

1: sockets.c <line 129> should be ETIMEDOUT

posix standard explained that EWOULDBLOCK is for the O_NONBLOCK flag "time out", ETIMEOUT is the real time out.

you can see it in

http://www.opengroup.org/onlinepubs/009695399/functions/recv.html

(IEEE Std 1003.1, 2004 Edition)

hanhui <hanhui03>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dempson (Posted a comment)
  • -unavailable- added by jeffbabar (Posted a comment)
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by hanhui03 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 22 Feb 2010 08:45:53 AM UTCgoldsimonStatusNone=>Fixed
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1