]> git.karo-electronics.de Git - karo-tx-linux.git/commit
netfilter: bridge: register hooks only when bridge interface is added
authorFlorian Westphal <fw@strlen.de>
Thu, 25 Feb 2016 09:08:37 +0000 (10:08 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 2 Mar 2016 19:05:25 +0000 (20:05 +0100)
commit5f6c253ebe93b02dece01c6f58447f16b29f6dd3
tree0e9391675ac24d5108d65b844bd54c9a3cb2fe4b
parentb9e69e127397187b70c813a4397cce7afb5e8cb1
netfilter: bridge: register hooks only when bridge interface is added

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: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/bridge/br_netfilter_hooks.c