Skip to contentSkip to conversation

Fetching multiple packets from the queue?

DISCUSSION Justin Yaple 1 participant 1 message Apr 16, 2010 netfilter

lore
Share & tools
lore
#0 lore raw

Hello,

Iv been trying to figure out how to fetch multiple packets from the queue, and am not clear where, or what buffer I need to copy before fetching the next packet from the queue.

Should I copy the contents of the buf[] each time I run recv(), or should I make a copy from the callback function? The callback function its only passed a couple of pointers so I am not sure what data I should copy. From the callback I could copy the packet using nfq_get_payload() to a new buffer, and save the id, and *hq. Those are the only parameters required to use nfq_set_verdict(), but I would lose the ability to use the other functions like nfq_get_packet_hw(), and the rest.

Should I just make copies of that data I need from the callback, and then get the next packet?

Thank you.