• Florian Westphal's avatar
    netfilter: bridge: register hooks only when bridge interface is added · 5f6c253e
    Florian Westphal authored
    This moves bridge hooks to a register-when-needed scheme.
    
    We use a device notifier to register the 'call-iptables' netfilter hooks
    only once a bridge gets added.
    
    This means that if the initial namespace uses a bridge, newly created
    network namespaces no longer get the PRE_ROUTING ipt_sabotage hook.
    
    It will registered in that network namespace once a bridge is created
    within that namespace.
    
    A few modules still use global hooks:
    
    - conntrack
    - bridge PF_BRIDGE hooks
    - IPVS
    - CLUSTER match (deprecated)
    - SYNPROXY
    
    As long as these modules are not loaded/used, a new network namespace has
    empty hook list and NF_HOOK() will boil down to single list_empty test even
    if initial namespace does stateless packet filtering.
    Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
    Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
    5f6c253e
br_netfilter_hooks.c 28.7 KB