Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
BroadcastCommunity.qnx.com will be offline from May 31 6:00pm until June 2 12:00AM for upcoming system upgrades. For more information please go to https://community.qnx.com/sf/discussion/do/listPosts/projects.bazaar/discussion.bazaar.topc28418
Forum Topic - mbuf Memory Management in pfil Hook: Page 1 of 2 (2 Items)
   
mbuf Memory Management in pfil Hook  
I've read the Filtering Wiki and the io-net migration guide and despite the note in these references saying there are 
many places on the web with information about mbuf's, I haven't been able to find anything about mbuf memory management 
in hooks. In our case, we have a protocol running above Ethernet. We register a PFIL_IN hook to collect packets off the 
wire. From the filtering wiki, it looks like our hook routine should return a non-zero value if we consume a packet and 
zero if packet processing should continue. It would make sense that we are responsible for freeing an mbuf if we consume
 a packet. Is that true? Similarly, we should not free the mbuf if our input hook returns 0, correct?

On the send side, we allocate an mbuf and call if_output to send the packet. Are we correct in assuming the driver will 
free this outgoing mbuf when it is no longer needed? We currently free the mbuf if if_output returns a non-zero value. 
Is that correct? Thanks.

Mark