[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] [bug #26027] Chaining netbufs
From: |
Hans-Erik Floryd |
Subject: |
[lwip-devel] [bug #26027] Chaining netbufs |
Date: |
Fri, 27 Mar 2009 13:48:58 +0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7 |
URL:
<http://savannah.nongnu.org/bugs/?26027>
Summary: Chaining netbufs
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: hefloryd
Submitted on: Fri 27 Mar 2009 13:48:56 GMT
Category: None
Severity: 3 - Normal
Item Group: Faulty Behaviour
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Planned Release:
lwIP version: 1.3.0
_______________________________________________________
Details:
When trying to chain two netbufs (identifier and payload) together,
netbuf_chain calls memp_free on the tail. It is unclear if/how the pbuf
associated with the tail can then be reclaimed. Test case:
identifier = netbuf_new();
payload = netbuf_new();
netbuf_ref (identifier, pId, pIdSize);
netbuf_ref (payload, pData, pDataSize);
netbuf_chain (identifier, payload);
netconn_sendto (conn, identifier, &addr, port);
netbuf_delete (payload);
netbuf_delete (identifier);
netbuf_chain calls memp_free on the tail (i.e. payload), so when
netbuf_delete(payload) is called, payload is no longer valid. On the other
hand, if netbuf_delete(payload) is not called, a pbuf is lost because the
reference count on the payload data is two, so netbuf_delete(identifier) will
not free the data.
Is it correct for netbuf_chain to free the tail netbuf? If that one line is
removed the code above works fine.
address@hidden suggested this in the lwip-users mailing list:
"[...] from reading the code, netbuf_chain should either call netbuf_delete,
use pbuf_cat instead of pbuf_chain or don't call memp_free. Which is right I
don't know."
_______________________________________________________
Reply to this item at:
<http://savannah.nongnu.org/bugs/?26027>
_______________________________________________
Message sent via/by Savannah
http://savannah.nongnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-devel] [bug #26027] Chaining netbufs,
Hans-Erik Floryd <=