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?

Submitted by:  Ambroz Bizjak <abizjak>
Submitted on:  Mon 25 Sep 2017 07:42:10 PM UTC  
 
Category: TCPSeverity: 3 - Normal
Item Group: Change RequestStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: ClosedPlanned 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>
Project Member
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>
Project 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>

 

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 dziegel (Posted a comment)
  • -unavailable- added by goldsimon (Posted a comment)
  • -unavailable- added by abizjak (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
    Mon 16 Oct 2017 08:02:27 AM UTCdziegelStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1