* exit netfilter queue processing
@ 2010-12-06 2:05 Justin Yaple
0 siblings, 0 replies; only message in thread
From: Justin Yaple @ 2010-12-06 2:05 UTC (permalink / raw)
To: netfilter-devel
Hello,
I used the netfilter queue example for processing packets but one
thing that I could not find is how to safely stop everything. I setup
some sig handlers to try and be a little more graceful in terminating
with CTRL+C or when my service is stopped. My problem is that recv()
blocks so if there are no packets in the queue my servicestate might
be changed to STOPPED and there might not be any more packets in the
queue so it will wait indefinitely for recv().
I have been reading Linux System Programming and I think that a
select() around the recv() might do the trick but didnt know if there
was some other way to do this specific to netfilter. Maybe something
that would force recv() to return with a value of rv < 0.
while ((servicestate >= STOPPING) && ((rv = recv(fd, buf, sizeof(buf),
0)) && rv >= 0)) {
/*
* This will execute the callback_function for each ip packet
* that is received into the Netfilter QUEUE.
*/
nfq_handle_packet(h, buf, rv);
}
Thanks.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-12-06 2:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-06 2:05 exit netfilter queue processing Justin Yaple
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).