Skip to content
  • Pablo Neira Ayuso's avatar
    netfilter: fix nf_queue handling · 7034b566
    Pablo Neira Ayuso authored
    nf_queue handling is broken since e3b37f11 ("netfilter: replace
    list_head with single linked list") for two reasons:
    
    1) If the bypass flag is set on, there are no userspace listeners and
       we still have more hook entries to iterate over, then jump to the
       next hook. Otherwise accept the packet. On nf_reinject() path, the
       okfn() needs to be invoked.
    
    2) We should not re-enter the same hook on packet reinjection. If the
       packet is accepted, we have to skip the current hook from where the
       packet was enqueued, otherwise the packets gets enqueued over and
       over again.
    
    This restores the previous list_for_each_entry_continue() behaviour
    happening from nf_iterate() that was dealing with these two cases.
    This patch introduces a new nf_queue() wrapper function so this fix
    becomes simpler.
    
    Fixes: e3b37f11
    
     ("netfilter: replace list_head with single linked list")
    Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
    7034b566