]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit - net/netfilter/xt_socket.c
netfilter: defrag: only register defrag functionality if needed
authorFlorian Westphal <fw@strlen.de>
Tue, 15 Nov 2016 20:36:45 +0000 (21:36 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 6 Dec 2016 20:42:00 +0000 (21:42 +0100)
commit834184b1f3a4635efbdfdae5fb437f109f6605fa
tree6ea25a837123c698a7feead4ee5e2d0f2e74cda4
parent481fa3734769b67f00ed09a42f2a6a8cbd00b869
netfilter: defrag: only register defrag functionality if needed

nf_defrag modules for ipv4 and ipv6 export an empty stub function.
Any module that needs the defragmentation hooks registered simply 'calls'
this empty function to create a phony module dependency -- modprobe will
then load the defrag module too.

This extends netfilter ipv4/ipv6 defragmentation modules to delay the hook
registration until the functionality is requested within a network namespace
instead of module load time for all namespaces.

Hooks are only un-registered on module unload or when a namespace that used
such defrag functionality exits.

We have to use struct net for this as the register hooks can be called
before netns initialization here from the ipv4/ipv6 conntrack module
init path.

There is no unregister functionality support, defrag will always be
active once it was requested inside a net namespace.

The reason is that defrag has impact on nft and iptables rulesets
(without defrag we might see framents).

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/ipv4/nf_defrag_ipv4.h
include/net/netfilter/ipv6/nf_defrag_ipv6.h
include/net/netns/netfilter.h
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
net/ipv4/netfilter/nf_defrag_ipv4.c
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
net/ipv6/netfilter/nf_defrag_ipv6_hooks.c
net/netfilter/xt_TPROXY.c
net/netfilter/xt_socket.c