buglwIP - A Lightweight TCP/IP stack - Bugs: bug #52113, recv callback: To free or not to...

 
 

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

bug #52113: recv callback: To free or not to free pbuf when returning ERR_ABRT?

Submitter:  Ambroz Bizjak <abizjak>
Submitted:  Mon 25 Sep 2017 07:42:10 PM UTC
   
 
Category:  TCP Severity:  3 - Normal
Item Group:  Change Request Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Planned Release:  None
lwIP version:  git head

Mon 16 Oct 2017 08:02:27 AM UTC, comment #2: 

Fixed the docs as you suggested. Thank you!

Dirk Ziegelmeier <dziegel>
Group administrator
Mon 25 Sep 2017 07:46:22 PM UTC, comment #1: 

This is indeed unclear. I guess noone ever really thought about this unclarity. However, given the applications around, I guess your solution is correct: most applications returning ERR_ABRT will call tcp_close() after evaluating the pbuf and then fall back to aborting, eventually. (I'm not sure if this is really needed any more though)

Simon Goldschmidt <goldsimon>
Group administrator
Mon 25 Sep 2017 07:42:10 PM UTC, original submission:  

After a quick look at the code around the invocation of the TCP recv callback, I have come to believe one must free the pbuf if returning ERR_ABRT.

However, according to rawapi.txt one should not free it or at least it is very unclear:

"If there are no errors and the callback function is to return
ERR_OK, then it must free the pbuf. Otherwise, it must not free the pbuf so that lwIP core code can store it."

The unclear part being "If there are no errors and the callback function is to return ERR_OK" - is this a logical conjunction (which leaves "errors" open to interpretation) or just a weird way to say "if the callback function returns ERR_OK"?

I think it should say: "If the callback function returns ERR_OK or ERR_ABRT it must have freed the pbuf, otherwise it must not have freed it."

Ambroz Bizjak <abizjak>

 

(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 dziegel (Posted a comment)
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by abizjak (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
    2017-10-16 dziegel StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code