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

Submitter:  Mike Kleshov <kleshov>
Submitted:  Tue 04 Oct 2011 02:38:17 PM UTC
   
 
Category:  IPv4 Severity:  2 - Minor
Item Group:  Change Request Status:  Wont Fix
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned 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>
Group administrator
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>
Group Member

 

(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 (Posted a comment)
  • -email is unavailable- added by kleshov (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-10-04 goldsimon StatusNone Wont Fix
        Assigned toNone goldsimon
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code