netfilter: nfnetlink_queue: assert monotonic packet ids
authorEric Dumazet <eric.dumazet@gmail.com>
Tue, 19 Jul 2011 09:44:17 +0000 (11:44 +0200)
committerPatrick McHardy <kaber@trash.net>
Tue, 19 Jul 2011 09:44:17 +0000 (11:44 +0200)
commit5863702a3421b0d2a63a473cf96afeb9fe09070d
treed462b775b7702a4ae44ec50ec28a2217d5ab2338
parent84a797dd0b9f7130357b70577fcbda8e638c71a7
netfilter: nfnetlink_queue: assert monotonic packet ids

Packet identifier is currently setup in nfqnl_build_packet_message(),
using one atomic_inc_return().

Problem is that since several cpus might concurrently call
nfqnl_enqueue_packet() for the same queue, we can deliver packets to
consumer in non monotonic way (packet N+1 being delivered after packet
N)

This patch moves the packet id setup from nfqnl_build_packet_message()
to nfqnl_enqueue_packet() to guarantee correct delivery order.

This also removes one atomic operation.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Florian Westphal <fw@strlen.de>
CC: Pablo Neira Ayuso <pablo@netfilter.org>
CC: Eric Leblond <eric@regit.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
net/netfilter/nfnetlink_queue.c