linux/net/ipv4
Florian Westphal b9e69e1273 netfilter: xtables: don't hook tables by default
delay hook registration until the table is being requested inside a
namespace.

Historically, a particular table (iptables mangle, ip6tables filter, etc)
was registered on module load.

When netns support was added to iptables only the ip/ip6tables ruleset was
made namespace aware, not the actual hook points.

This means f.e. that when ipt_filter table/module is loaded on a system,
then each namespace on that system has an (empty) iptables filter ruleset.

In other words, if a namespace sends a packet, such skb is 'caught' by
netfilter machinery and fed to hooking points for that table (i.e. INPUT,
FORWARD, etc).

Thanks to Eric Biederman, hooks are no longer global, but per namespace.

This means that we can avoid allocation of empty ruleset in a namespace and
defer hook registration until we need the functionality.

We register a tables hook entry points ONLY in the initial namespace.
When an iptables get/setockopt is issued inside a given namespace, we check
if the table is found in the per-namespace list.

If not, we attempt to find it in the initial namespace, and, if found,
create an empty default table in the requesting namespace and register the
needed hooks.

Hook points are destroyed only once namespace is deleted, there is no
'usage count' (it makes no sense since there is no 'remove table' operation
in xtables api).

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2016-03-02 20:05:24 +01:00
..
netfilter netfilter: xtables: don't hook tables by default 2016-03-02 20:05:24 +01:00
af_inet.c ipv4: Namespacify ip_dynaddr sysctl knob 2016-02-16 20:42:54 -05:00
ah4.c
arp.c ipv4: add option to drop gratuitous ARP packets 2016-02-11 04:27:35 -05:00
cipso_ipv4.c
datagram.c
devinet.c net: l3mdev: prefer VRF master for source address selection 2016-02-26 14:22:26 -05:00
esp4.c
fib_frontend.c
fib_lookup.h
fib_rules.c
fib_semantics.c
fib_trie.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-02-01 15:56:08 -08:00
fou.c net: ip_tunnel: remove 'csum_help' argument to iptunnel_handle_offloads 2016-02-12 05:52:16 -05:00
gre_demux.c
gre_offload.c GSO: Provide software checksum of tunneled UDP fragmentation offload 2016-02-26 14:23:35 -05:00
icmp.c
igmp.c igmp: net: Move igmp namespace init to correct file 2016-02-16 20:42:54 -05:00
inet_connection_sock.c soreuseport: fix merge conflict in tcp bind 2016-02-24 13:38:18 -05:00
inet_diag.c inet: refactor inet[6]_lookup functions to take skb 2016-02-11 03:54:14 -05:00
inet_fragment.c
inet_hashtables.c tcp/dccp: better use of ephemeral ports in connect() 2016-02-12 05:28:32 -05:00
inet_timewait_sock.c
inetpeer.c
ip_forward.c
ip_fragment.c net: Export ip fragment sysctl to unprivileged users 2016-02-16 20:42:54 -05:00
ip_gre.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-02-23 00:09:14 -05:00
ip_input.c ipv4: namespacify ip_early_demux sysctl knob 2016-02-16 20:42:54 -05:00
ip_options.c
ip_output.c ipv4: Namespaceify ip_default_ttl sysctl knob 2016-02-16 20:42:54 -05:00
ip_sockglue.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-02-23 00:09:14 -05:00
ip_tunnel.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-02-23 00:09:14 -05:00
ip_tunnel_core.c iptunnel: scrub packet in iptunnel_pull_header 2016-02-18 14:34:54 -05:00
ip_vti.c
ipcomp.c
ipconfig.c ipv4: ipconfig: avoid unused ic_proto_used symbol 2016-01-29 19:39:09 -08:00
ipip.c iptunnel: scrub packet in iptunnel_pull_header 2016-02-18 14:34:54 -05:00
ipmr.c
Kconfig ipv4: Remove inet_lro library 2016-02-17 16:15:46 -05:00
Makefile ipv4: Remove inet_lro library 2016-02-17 16:15:46 -05:00
netfilter.c
ping.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-02-23 00:09:14 -05:00
proc.c ipv4: Namespaceify ip_default_ttl sysctl knob 2016-02-16 20:42:54 -05:00
protocol.c
raw.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-02-23 00:09:14 -05:00
route.c route: check and remove route cache when we get route 2016-02-18 11:31:36 -05:00
syncookies.c ipv4: Namespaceify tcp syncookies sysctl knob 2016-02-07 14:35:10 -05:00
sysctl_net_ipv4.c ipv4: namespacify ip_early_demux sysctl knob 2016-02-16 20:42:54 -05:00
tcp.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-02-23 00:09:14 -05:00
tcp_bic.c
tcp_cdg.c
tcp_cong.c
tcp_cubic.c
tcp_dctcp.c
tcp_diag.c
tcp_fastopen.c tcp: fastopen: call tcp_fin() if FIN present in SYNACK 2016-02-06 16:49:58 -05:00
tcp_highspeed.c
tcp_htcp.c
tcp_hybla.c
tcp_illinois.c
tcp_input.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-02-23 00:09:14 -05:00
tcp_ipv4.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-02-23 00:09:14 -05:00
tcp_lp.c
tcp_metrics.c ipv4: Namespaceify tcp reordering sysctl knob 2016-02-07 14:35:10 -05:00
tcp_minisocks.c ipv4: Namespaceify tcp syncookies sysctl knob 2016-02-07 14:35:10 -05:00
tcp_offload.c net: Store checksum result for offloaded GSO checksums 2016-02-11 08:55:33 -05:00
tcp_output.c ipv4: Namespaceify tcp_notsent_lowat sysctl knob 2016-02-07 14:36:11 -05:00
tcp_probe.c
tcp_recovery.c
tcp_scalable.c
tcp_timer.c ipv4: Namespaceify tcp_orphan_retries sysctl knob 2016-02-07 14:35:11 -05:00
tcp_vegas.c
tcp_vegas.h
tcp_veno.c
tcp_westwood.c
tcp_yeah.c tcp_yeah: don't set ssthresh below 2 2016-01-11 17:25:16 -05:00
tunnel4.c
udp.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-02-23 00:09:14 -05:00
udp_diag.c
udp_impl.h
udp_offload.c GSO: Provide software checksum of tunneled UDP fragmentation offload 2016-02-26 14:23:35 -05:00
udp_tunnel.c
udplite.c
xfrm4_input.c
xfrm4_mode_beet.c
xfrm4_mode_transport.c
xfrm4_mode_tunnel.c
xfrm4_output.c
xfrm4_policy.c
xfrm4_protocol.c
xfrm4_state.c
xfrm4_tunnel.c