buglwIP - A Lightweight TCP/IP stack - Bugs: bug #38121, error in connect() with O_NONBLOCK

 
 

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

bug #38121: error in connect() with O_NONBLOCK

Submitter:  hanhui <hanhui03>
Submitted:  Sun 20 Jan 2013 06:12:00 AM UTC
   
 
Category:  sockets/netconn Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  CVS Head

Thu 19 Mar 2015 08:21:48 PM UTC, comment #2: 

Fixed with bug #37676, thanks for reporting.

Simon Goldschmidt <goldsimon>
Group administrator
Tue 09 Dec 2014 08:29:11 PM UTC, comment #1: 

Looking at this, there might be more problems like this one. A clean solution would be to set conn->err when the error arises (i.e. in the api_msg.c functions, not in the api_lib.c functions - but that would include tcpip_apimsg() in tcpip.c, too).

Simon Goldschmidt <goldsimon>
Group administrator
Sun 20 Jan 2013 06:12:00 AM UTC, original submission:  

The socket is non-blocking and the connection can not be completed immediately. It is possible to select() for completion by selecting the  socket  for  writing.  After select indicates writability, use getsockopt() to read the SO_ERROR option at level SOL_SOCKET to determine whether connect completed successfully  (SO_ERROR is zero) or unsuccessfully (SO_ERROR is not zero).

Lwip in normal conditions does the same way, but if the server responds very quickly, for example, the server is 127.0.0.1, in this case, Lwip will get errors.

Because netconn_connect() call lwip_netconn_do_connect() in tcpip thread, then lwip_netconn_do_connect() will set [msg->err = ERR_INPROGRESS;], so netconn_connect() will use NETCONN_SET_SAFE_ERR() set netconn error, and return is to user. If server responds very quickly, and completed the connection operation between call lwip_netconn_do_connect() and NETCONN_SET_SAFE_ERR() in netconn_connect() function, use getsockopt() to read the SO_ERROR will get ERR_INPROGRESS value not zero in a already connected socket.

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 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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-03-19 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code