Skip to contentSkip to conversation

NFQUEUE: packet accumulation in queue, queue overflows

DISCUSSION KdF 2 participants 2 messages Jan 25, 2006 – Jan 30, 2006 netfilter

lore
Share & tools
lore

KdF

author
#0 lore raw

Hi all

After switching to NFQUEUE from ip_queue mechanism in our billing system we've got strange trouble: all works fine, but some packets seem not to leave queue, and after some time queue overflows, and packets get dropped. I increased maximum queue length in kernel during setup, and built new kernel, but even with 16384 entries instead 1024 it doesn't flush, but grows with time.

cat /proc/net/netfilter/nfnetlink_queue

3 1296 1697 2 64 0 0 123739 1

I have an idea that only packets for which verdict NF_DROP is set in our program don't leave queue? Or it is a userspace program perfomance issue? But on tests with simultaneous ping -f from four stations all worked fine, and only 64 bytes is copied to userspace to get ip headers.

NETFILTER and all extensions are built as a part of kernel, not as a module, maybe I should build it as a module? But it seems not to be documented anywhere.

Interfaces from which packets are queued are PPP interfaces, with PPPOE clients attached, is there any issues with it?

We tried kernels from 2.6.14.0 to 2.6.16-rc1, in 2.6.15 - 2.6.16-rc1 packet loss is less, but still persists, and REDIRECT target doesn't work (??????) (see my another post).

If problem in userspace application perfomance, does NETFILTER have a mechanism to flush old packets from queue, if they were not processed by userspace application?

#1 lore raw
Quoted 4 lines · KdF

Hi all

After switching to NFQUEUE from ip_queue mechanism in our billing system

A billing system should probably better use nfnetlink_log (or ULOG) rather than nfnetlink_queue (or ip_queue).

Quoted 5 lines

we've got strange trouble: all works fine, but some packets seem not to leave queue, and after some time queue overflows, and packets get dropped. I increased maximum queue length in kernel during setup, and built new kernel, but even with 16384 entries instead 1024 it doesn't flush, but grows with time.

Others have also reported _single_ stuck packets in a queue, but not the queue itself filling up.

Quoted 9 lines

cat /proc/net/netfilter/nfnetlink_queue

3 1296 1697 2 64 0 0 123739 1

I have an idea that only packets for which verdict NF_DROP is set in our program don't leave queue? Or it is a userspace program perfomance issue? But on tests with simultaneous ping -f from four stations all worked fine, and only 64 bytes is copied to userspace to get ip headers.

I would recommend writing a small 'short-circuit' program for libnetfilter_queue, which just receives packets and issues verdicts (and also counts how many packets have been processed). Then send a defined amount of packets, and see what happens.

Also, make sure you properly check errors with all libnetfilter_queue functions that get called.

By using this short-circuit program, you can be sure that userspace always issues a verdict for every packet it receives.

Quoted 3 lines

If problem in userspace application perfomance, does NETFILTER have a mechanism to flush old packets from queue, if they were not processed by userspace application?

no. you have to return a verdict for every packet you receive in userspace. flushing the queue (by dropping all packets) can only be achieved by closing the queue and re-opening it.

Signature · 5 lines
- Harald Welte <[email protected]>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie