|
From: | Ed Sutter |
Subject: | Re: [lwip-users] p->payload == iphdr failed... |
Date: | Fri, 07 Nov 2008 07:33:22 -0500 |
User-agent: | Thunderbird 2.0.0.17 (Windows/20080914) |
Jonathan Larmour wrote:
Ed Sutter wrote:To be more efficient, I changed this by using PBUF_REF and setting the payload pointer to the packet buffer... .... len = mon_recvenetpkt((char *)ipacket,sizeof(ipacket)); if (len) { p = pbuf_alloc(PBUF_RAW, len, PBUF_REF); if (p) { p->payload = ipacket; ethernet_input(p, mynetifp); .... This new code works ok with incoming expected packets. The original code doesn't cause the assertion error above. Is the "new" code above incorrect?What frees ipacket's memory? Is there any chance that memory can be reused before the pbuf is freed? You may also need to consider the alignment of ipacket.
Jonathan, Thanks for the response. The underlying driver releases the buffer. This is coordinated with details outside the scope of this problem. It is the same packet buffer used in the working method that uses PBUF_POOL for allocation. Alignment is good as well. As soon as I go back to using the PBUF_POOL allocation method, everything works fine. Any other thoughts? Ed
[Prev in Thread] | Current Thread | [Next in Thread] |