exit netfilter queue processing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux