buglwIP - A Lightweight TCP/IP stack - Bugs: bug #44595, netconn_recv does not set last_err...

 
 

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

bug #44595: netconn_recv does not set last_err on CLOSE_WAIT

Submitter:  Ivan Delamer <idelamer>
Submitted:  Fri 20 Mar 2015 08:50:07 PM 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:  git head

Wed 19 Apr 2017 07:18:10 PM UTC, comment #4: 

Should be fixed by now: netconn_recv() doesn't contain that check any more, netconn_recv_data() does the right thing and netconn->last_err has been removed when fixing fatal errors and pending errors.

Simon Goldschmidt <goldsimon>
Group administrator
Wed 12 Apr 2017 10:43:48 AM UTC, comment #3: 

The behaviour of this might have changed. Need to re-check this

Simon Goldschmidt <goldsimon>
Group administrator
Thu 10 Mar 2016 08:22:39 PM UTC, comment #2: 

This cannot be fixed without fixing task #13922 (Remove fatal error handling):

when setting conn->last_err to ERR_CLSD (which is FATAL), we would effectively block writing more data.

I've removed the error so that ERR_CLSD should be returned. Note that calling 'netconn_recv_tcp_pbuf()' is faster for TCP as there is no need for netbufs in the TCP case.

Simon Goldschmidt <goldsimon>
Group administrator
Fri 20 Mar 2015 09:04:33 PM UTC, comment #1: 

The problem of not setting last_err actually got worse with my last cleanup of fixing race conditions in that area. I've decided to prefer fixing race conditions over setting last_err and discussing the arising problems seperately (like here :)

The problematic calls are recv and accept, as these are done in the application thread, not in the tcpip_thread.

The problem is that we have to watch out for race conditions when writing to last_err, expecially when writing an err_t that is marked FATAL. (I have to admit though that I never fully got the FATAL thing...)

Simon Goldschmidt <goldsimon>
Group administrator
Fri 20 Mar 2015 08:50:07 PM UTC, original submission:  

In a half closed netconn (we have received FIN), recvmbox is set to invalid.

If we call netconn_recv, it will return ERR_CONN on one of the first lines:

  LWIP_ERROR("netconn_recv: invalid recvmbox", sys_mbox_valid(&conn->recvmbox), return ERR_CONN;);

This should actually pass, and then netconn_recv_data is called. In there, we check:

    if (!sys_mbox_valid(&conn->recvmbox)) {
      /* This happens when calling this function after receiving FIN */
      return sys_mbox_valid(&conn->acceptmbox) ? ERR_CONN : ERR_CLSD;
    }

But in neither of both cases do we set last_err. So when I call netconn_err(pxNetconn) I still get ERR_OK.

Ivan Delamer <idelamer>
Group Member

 

(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 idelamer (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-04-19 goldsimon StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2017-04-12 goldsimon StatusPostponed In Progress
        Assigned toNone goldsimon
    2016-03-10 goldsimon StatusNone Postponed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code