• Eric Dumazet's avatar
    netfilter: nfnetlink_queue: assert monotonic packet ids · 5863702a
    Eric Dumazet authored
    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: default avatarEric 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: default avatarPatrick McHardy <kaber@trash.net>
    5863702a
nfnetlink_queue.c 21.9 KB