Skip to content

Commit

Permalink
netfilter: nf_tables: build-in filter chain type
Browse files Browse the repository at this point in the history
One module per supported filter chain family type takes too much memory
for very little code - too much modularization - place all chain filter
definitions in one single file.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Pablo Neira Ayuso committed Mar 30, 2018
1 parent cc07eeb commit 02c7b25
Show file tree
Hide file tree
Showing 17 changed files with 414 additions and 509 deletions.
3 changes: 3 additions & 0 deletions include/net/netfilter/nf_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -1345,4 +1345,7 @@ struct nft_trans_flowtable {
#define nft_trans_flowtable(trans) \
(((struct nft_trans_flowtable *)trans->data)->flowtable)

int __init nft_chain_filter_init(void);
void __exit nft_chain_filter_fini(void);

#endif /* _NET_NF_TABLES_H */
2 changes: 1 addition & 1 deletion net/bridge/netfilter/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
menuconfig NF_TABLES_BRIDGE
depends on BRIDGE && NETFILTER && NF_TABLES
select NETFILTER_FAMILY_BRIDGE
tristate "Ethernet Bridge nf_tables support"
bool "Ethernet Bridge nf_tables support"

if NF_TABLES_BRIDGE

Expand Down
1 change: 0 additions & 1 deletion net/bridge/netfilter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Makefile for the netfilter modules for Link Layer filtering on a bridge.
#

obj-$(CONFIG_NF_TABLES_BRIDGE) += nf_tables_bridge.o
obj-$(CONFIG_NFT_BRIDGE_META) += nft_meta_bridge.o
obj-$(CONFIG_NFT_BRIDGE_REJECT) += nft_reject_bridge.o

Expand Down
81 changes: 0 additions & 81 deletions net/bridge/netfilter/nf_tables_bridge.c

This file was deleted.

4 changes: 2 additions & 2 deletions net/ipv4/netfilter/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ config NF_SOCKET_IPV4
if NF_TABLES

config NF_TABLES_IPV4
tristate "IPv4 nf_tables support"
bool "IPv4 nf_tables support"
help
This option enables the IPv4 support for nf_tables.

Expand Down Expand Up @@ -71,7 +71,7 @@ config NFT_FIB_IPV4
endif # NF_TABLES_IPV4

config NF_TABLES_ARP
tristate "ARP nf_tables support"
bool "ARP nf_tables support"
select NETFILTER_FAMILY_ARP
help
This option enables the ARP support for nf_tables.
Expand Down
2 changes: 0 additions & 2 deletions net/ipv4/netfilter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ obj-$(CONFIG_NF_NAT_MASQUERADE_IPV4) += nf_nat_masquerade_ipv4.o
# NAT protocols (nf_nat)
obj-$(CONFIG_NF_NAT_PROTO_GRE) += nf_nat_proto_gre.o

obj-$(CONFIG_NF_TABLES_IPV4) += nf_tables_ipv4.o
obj-$(CONFIG_NFT_CHAIN_ROUTE_IPV4) += nft_chain_route_ipv4.o
obj-$(CONFIG_NFT_CHAIN_NAT_IPV4) += nft_chain_nat_ipv4.o
obj-$(CONFIG_NFT_REJECT_IPV4) += nft_reject_ipv4.o
obj-$(CONFIG_NFT_FIB_IPV4) += nft_fib_ipv4.o
obj-$(CONFIG_NFT_MASQ_IPV4) += nft_masq_ipv4.o
obj-$(CONFIG_NFT_REDIR_IPV4) += nft_redir_ipv4.o
obj-$(CONFIG_NFT_DUP_IPV4) += nft_dup_ipv4.o
obj-$(CONFIG_NF_TABLES_ARP) += nf_tables_arp.o

# flow table support
obj-$(CONFIG_NF_FLOW_TABLE_IPV4) += nf_flow_table_ipv4.o
Expand Down
60 changes: 0 additions & 60 deletions net/ipv4/netfilter/nf_tables_arp.c

This file was deleted.

69 changes: 0 additions & 69 deletions net/ipv4/netfilter/nf_tables_ipv4.c

This file was deleted.

2 changes: 1 addition & 1 deletion net/ipv6/netfilter/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ config NF_SOCKET_IPV6
if NF_TABLES

config NF_TABLES_IPV6
tristate "IPv6 nf_tables support"
bool "IPv6 nf_tables support"
help
This option enables the IPv6 support for nf_tables.

Expand Down
1 change: 0 additions & 1 deletion net/ipv6/netfilter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ obj-$(CONFIG_NF_REJECT_IPV6) += nf_reject_ipv6.o
obj-$(CONFIG_NF_DUP_IPV6) += nf_dup_ipv6.o

# nf_tables
obj-$(CONFIG_NF_TABLES_IPV6) += nf_tables_ipv6.o
obj-$(CONFIG_NFT_CHAIN_ROUTE_IPV6) += nft_chain_route_ipv6.o
obj-$(CONFIG_NFT_CHAIN_NAT_IPV6) += nft_chain_nat_ipv6.o
obj-$(CONFIG_NFT_REJECT_IPV6) += nft_reject_ipv6.o
Expand Down
67 changes: 0 additions & 67 deletions net/ipv6/netfilter/nf_tables_ipv6.c

This file was deleted.

4 changes: 2 additions & 2 deletions net/netfilter/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -465,12 +465,12 @@ config NF_TABLES_INET
depends on IPV6
select NF_TABLES_IPV4
select NF_TABLES_IPV6
tristate "Netfilter nf_tables mixed IPv4/IPv6 tables support"
bool "Netfilter nf_tables mixed IPv4/IPv6 tables support"
help
This option enables support for a mixed IPv4/IPv6 "inet" table.

config NF_TABLES_NETDEV
tristate "Netfilter nf_tables netdev tables support"
bool "Netfilter nf_tables netdev tables support"
help
This option enables support for the "netdev" table.

Expand Down
9 changes: 4 additions & 5 deletions net/netfilter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,12 @@ obj-$(CONFIG_NETFILTER_CONNCOUNT) += nf_conncount.o
obj-$(CONFIG_NF_DUP_NETDEV) += nf_dup_netdev.o

# nf_tables
nf_tables-objs := nf_tables_core.o nf_tables_api.o nf_tables_trace.o \
nft_immediate.o nft_cmp.o nft_range.o nft_bitwise.o \
nft_byteorder.o nft_payload.o nft_lookup.o nft_dynset.o
nf_tables-objs := nf_tables_core.o nf_tables_api.o nft_chain_filter.o \
nf_tables_trace.o nft_immediate.o nft_cmp.o nft_range.o \
nft_bitwise.o nft_byteorder.o nft_payload.o nft_lookup.o \
nft_dynset.o

obj-$(CONFIG_NF_TABLES) += nf_tables.o
obj-$(CONFIG_NF_TABLES_INET) += nf_tables_inet.o
obj-$(CONFIG_NF_TABLES_NETDEV) += nf_tables_netdev.o
obj-$(CONFIG_NFT_COMPAT) += nft_compat.o
obj-$(CONFIG_NFT_EXTHDR) += nft_exthdr.o
obj-$(CONFIG_NFT_META) += nft_meta.o
Expand Down
Loading

0 comments on commit 02c7b25

Please sign in to comment.