lwIP - 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: |
Simon Goldschmidt <goldsimon> |
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.
|
Mike Kleshov <kleshov> |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
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 | Status | None | Wont Fix | |
Assigned to | None | goldsimon | |||
Open/Closed | Open | Closed |
Powered by Savane 3.13-caa5.
Corresponding source code
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.