buglwIP - A Lightweight TCP/IP stack - Bugs: bug #39340, Raw API changed regarding TCP...

 
 

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

bug #39340: Raw API changed regarding TCP connections closing

Submitter:  Bill Auerbach <billauerbach>
Submitted:  Tue 25 Jun 2013 01:18:11 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Invalid
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  1.4.1

Fri 28 Jun 2013 07:11:36 PM UTC, comment #5: 

Closing as invalid :-)

Simon Goldschmidt <goldsimon>
Group administrator
Wed 26 Jun 2013 09:02:20 PM UTC, comment #4: 

This can be closed.

I removed SO_DONTLINGER on the PC and the socket closes normally.  The docs didn't specify what kind of data that it wouldn't linger trying to send and so I didn't realize that it means ACKs as well as application data.

Bill Auerbach <billauerbach>
Tue 25 Jun 2013 08:16:41 PM UTC, comment #3: 

I think the documentation could be clearer in that normal closes use tcp-recv and RST type closes use tcp_err and that both must be implemented to detect connection closes.  What stung me is that I didn't know connections were closing with RST since nothing is different (that I see) from the PC application standpoint.

Might be nice to support a tcp_closed callback (complementing tcp_accept) to signal a close, maybe passing recv_flags.  If tcp_closed is NULL, simply use the current behavior.

Of course I wouldn't have posted had I known the connection was closing using RST or was working normally. :-)

Bill Auerbach <billauerbach>
Tue 25 Jun 2013 06:15:29 PM UTC, comment #2: 

The current API implementation should be that recv(NULL) is called on normal close while err() is called when RST is received or if the connection is closed due to lwIP running out of resources or something like that.

Do you think this is not documented or do you propose to change this implementation?

Aside from this, I think calling both recv(NULL) and err() might confuse applications as there're is no single defined point when to invalidate a connection.

Simon Goldschmidt <goldsimon>
Group administrator
Tue 25 Jun 2013 04:28:47 PM UTC, comment #1: 

Follow up: It turns out that the PC, on these closes, is sending an RST - it is not a normal close (although the code on the PC is doing nothing to terminate the connection unusually). I also have a Telnet connection open and its close does not send the RST.

I still believe the API should be consistent.  Or deprecate it and/or add a callback for 'connection closed' (regardless of the reason).

Bill Auerbach <billauerbach>
Tue 25 Jun 2013 01:18:11 PM UTC, original submission:  

There is a condition in lwIP when a connection is closed by the remote end that the tcp_recv callback is not called with a NULL pbuf pointer to signal the connection was closed.  The documented behavior in rawapi.txt in the 1.4.1 release is that it should.


The current behavior is that the tcp_err callback is called instead of the previous method of calling tcp_recv when recv_flags has TF_RESET set.  This is at line 307 in tcp_in.c.  This could be happening because Win7 is closing connections with TF_RESET set.  I was using XP until a few months ago when the documented behavior is followed.  The remote socket is closed normally.

Is TF_RESET an error?  Even if tcp_err is called, shouldn't tcp_recv still be called with NULL pbuf to keep the notification consistent?

Bill Auerbach <billauerbach>

 

(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 billauerbach (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-06-28 goldsimon StatusNone Invalid
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code