buglwIP - A Lightweight TCP/IP stack - Bugs: bug #34475, raw_sendto() doesn't rewind...

 
 

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

bug #34475: raw_sendto() doesn't rewind headers in pbuf on return

Submitted by:  Mike Kleshov <kleshov>
Submitted on:  Tue 04 Oct 2011 02:38:17 PM UTC  
 
Category: IPv4Severity: 2 - Minor
Item Group: Change RequestStatus: Wont Fix
Privacy: PublicAssigned to: Simon Goldschmidt <goldsimon>
Open/Closed: ClosedPlanned Release: None
lwIP version: 1.4.0

Tue 04 Oct 2011 04:28:44 PM UTC, comment #1:

I think the behaviour is correct. An application is not allowed to reuse a pbuf after it has been passed to a send function (unless that function returned an error).

The reason is that pbufs can be queued for sending (e.g. DMA-enabled MAC), i.e. another piece of code holds a reference on it. Now if you rewind the headers before the pbuf is actually sent, the headers won't be sent.

Using PBUF_RAW or even PBUF_ROM is not an option here, as that pbufs tot_len, flags or next pointer could get changed if the pbuf is a part of more than one packet. Tis might work for your ethernet driver, but it's not a portable solution.

I think I remember this being documented somewhere (at least for UDP_send). If not, that's the actual bug.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Tue 04 Oct 2011 02:38:17 PM UTC, original submission:

I am using raw_sendto() to ping a remote host. The code is based on the ping application from contrib. When I try to send the same pbuf a second time (retry a ping), wrong data is sent. This happens because the first call to raw_sendto() calls pbuf_header() on the pbuf and never adjust the payload pointer back. I think this is wrong behaviour.
As a workaround, I am allocating the pbuf with the PBUF_RAW option, so raw_sendto() allocates a new pbuf for the header.

Mike Kleshov <kleshov>
Project Member

 

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 kleshov (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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 04 Oct 2011 04:28:44 PM UTCgoldsimonStatusNone=>Wont Fix
      Assigned toNone=>goldsimon
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1