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

Submitted by:  Bill Auerbach <billauerbach>
Submitted on:  Tue 25 Jun 2013 01:18:11 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: Faulty BehaviourStatus: Invalid
Privacy: PublicAssigned to: None
Open/Closed: ClosedPlanned Release: None
lwIP version: 1.4.1

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

Closing as invalid :-)

Simon Goldschmidt <goldsimon>
Project 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>
Project 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>

 

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 goldsimon (Posted a comment)
  • -unavailable- added by billauerbach (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 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 28 Jun 2013 07:11:36 PM UTCgoldsimonStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1