buglwIP - A Lightweight TCP/IP stack - Bugs: bug #51687, tcp_close(): is it OK to return...

 
 

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

bug #51687: tcp_close(): is it OK to return ERR_MEM if TF_CLOSEPEND is set?

Submitter:  Simon Goldschmidt <goldsimon>
Submitted:  Tue 08 Aug 2017 11:50:42 AM UTC
   
 
Category:  TCP Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  git head

Mon 28 Aug 2017 08:00:18 PM UTC, comment #2: 

Fixed by returning ERR_OK instead of ERR_MEM if TF_CLOSEPEND is set:
This is OK here since sending FIN does not guarantee a time frame for actually freeing the pcb, either (it is left in closure states for remote ACK or timeout)

Simon Goldschmidt <goldsimon>
Group administrator
Fri 25 Aug 2017 08:51:03 PM UTC, comment #1: 


> is it OK to return ERR_MEM if TF_CLOSEPEND is set?


Actually, it's not. Up to and including 2.0.1, tcp_close() returning != ERR_OK means the pcb is not gone. Applications like the httpd retry closing in their 'poll' function and are not prepared for the pcb to vanish by tcp_tmr() closing it.

This is a change I have introduced after 2.0.1, so it's OK to change it again.

We can either make tcp_close() return ERR_OK in this case (should be OK since the pcb is not freed anyway from tcp_close(), normally) or let the user app call another function to achieve dalayed closing.
Something like:

if(tcp_close(pcb) != ERR_OK) {
  tcp_close_delayed(pcb);
}


or

tcp_close_force(pcb);


Simon Goldschmidt <goldsimon>
Group administrator
Tue 08 Aug 2017 11:50:42 AM UTC, original submission:  


Simon Goldschmidt <goldsimon>
Group administrator

 

(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 (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-08-28 goldsimon CategoryNone TCP
        Item GroupNone Faulty Behaviour
        StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code