Mark Dowdy(deleted)
|
mbuf Memory Management in pfil Hook
|
Mark Dowdy(deleted)
11/15/2010 6:57 PM
post74738
|
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
|
|
|