linux/net/ipv4/netfilter
Florian Westphal fdacd57c79 netfilter: x_tables: never register tables by default
For historical reasons x_tables still register tables by default in the
initial namespace.
Only newly created net namespaces add the hook on demand.

This means that the init_net always pays hook cost, even if no filtering
rules are added (e.g. only used inside a single netns).

Note that the hooks are added even when 'iptables -L' is called.
This is because there is no way to tell 'iptables -A' and 'iptables -L'
apart at kernel level.

The only solution would be to register the table, but delay hook
registration until the first rule gets added (or policy gets changed).

That however means that counters are not hooked either, so 'iptables -L'
would always show 0-counters even when traffic is flowing which might be
unexpected.

This keeps table and hook registration consistent with what is already done
in non-init netns: first iptables(-save) invocation registers both table
and hooks.

This applies the same solution adopted for ebtables.
All tables register a template that contains the l3 family, the name
and a constructor function that is called when the initial table has to
be added.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
2021-08-09 10:22:01 +02:00
..
arp_tables.c netfilter: arptables: use pernet ops struct during unregister 2021-05-03 23:04:01 +02:00
arpt_mangle.c
arptable_filter.c netfilter: x_tables: never register tables by default 2021-08-09 10:22:01 +02:00
ip_tables.c netfilter: allow to turn off xtables compat layer 2021-04-26 18:16:56 +02:00
ipt_ah.c
ipt_CLUSTERIP.c netfilter: ipt_CLUSTERIP: use clusterip_net to store pernet warning 2021-08-01 12:00:50 +02:00
ipt_ECN.c
ipt_REJECT.c netfilter: use actual socket sk for REJECT action 2020-12-01 14:33:55 +01:00
ipt_rpfilter.c netfilter: rpfilter: mask ecn bits before fib lookup 2021-01-19 13:54:30 -08:00
ipt_SYNPROXY.c netfilter: Add MODULE_DESCRIPTION entries to kernel modules 2020-06-25 00:50:31 +02:00
iptable_filter.c netfilter: x_tables: never register tables by default 2021-08-09 10:22:01 +02:00
iptable_mangle.c netfilter: x_tables: never register tables by default 2021-08-09 10:22:01 +02:00
iptable_nat.c netfilter: x_tables: never register tables by default 2021-08-09 10:22:01 +02:00
iptable_raw.c netfilter: x_tables: never register tables by default 2021-08-09 10:22:01 +02:00
iptable_security.c netfilter: x_tables: never register tables by default 2021-08-09 10:22:01 +02:00
Kconfig netfilter: nf_log_arp: merge with nf_log_syslog 2021-03-31 00:37:27 +02:00
Makefile netfilter: nf_log_arp: merge with nf_log_syslog 2021-03-31 00:37:27 +02:00
nf_defrag_ipv4.c netfilter: disable defrag once its no longer needed 2021-04-26 03:20:07 +02:00
nf_dup_ipv4.c netfilter: drop bridge nf reset from nf_reset 2019-10-01 18:42:15 +02:00
nf_flow_table_ipv4.c netfilter: Add MODULE_DESCRIPTION entries to kernel modules 2020-06-25 00:50:31 +02:00
nf_nat_h323.c netfilter: nf_conntrack_sip: fix expectation clash 2019-07-16 13:16:59 +02:00
nf_nat_pptp.c netfilter: delete repeated words 2020-08-28 20:11:38 +02:00
nf_nat_snmp_basic.asn1
nf_nat_snmp_basic_main.c
nf_reject_ipv4.c netfilter: use actual socket sk for REJECT action 2020-12-01 14:33:55 +01:00
nf_socket_ipv4.c treewide: Remove uninitialized_var() usage 2020-07-16 12:35:15 -07:00
nf_tproxy_ipv4.c
nft_dup_ipv4.c netfilter: nftables: add nft_parse_register_load() and use it 2021-01-27 22:53:29 +01:00
nft_fib_ipv4.c netfilter: Add MODULE_DESCRIPTION entries to kernel modules 2020-06-25 00:50:31 +02:00
nft_reject_ipv4.c netfilter: nf_tables: add and use nft_sk helper 2021-05-29 01:04:53 +02:00