Skip to content

Commit 0168e8b

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nat: merge ipv4/ipv6 masquerade code into main nat module
Instead of using extra modules for these, turn the config options into an implicit dependency that adds masq feature to the protocol specific nf_nat module. before: text data bss dec hex filename 2001 860 4 2865 b31 net/ipv4/netfilter/nf_nat_masquerade_ipv4.ko 5579 780 2 6361 18d9 net/ipv4/netfilter/nf_nat_ipv4.ko 2860 836 8 3704 e78 net/ipv6/netfilter/nf_nat_masquerade_ipv6.ko 6648 780 2 7430 1d06 net/ipv6/netfilter/nf_nat_ipv6.ko after: text data bss dec hex filename 7245 872 8 8125 1fbd net/ipv4/netfilter/nf_nat_ipv4.ko 9165 848 12 10025 2729 net/ipv6/netfilter/nf_nat_ipv6.ko Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent e5a10bb commit 0168e8b

6 files changed

Lines changed: 4 additions & 20 deletions

File tree

‎net/ipv4/netfilter/Kconfig‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,7 @@ config NFT_CHAIN_NAT_IPV4
129129
source and destination ports.
130130

131131
config NF_NAT_MASQUERADE_IPV4
132-
tristate "IPv4 masquerade support"
133-
help
134-
This is the kernel functionality to provide NAT in the masquerade
135-
flavour (automatic source address selection).
132+
bool
136133

137134
config NFT_MASQ_IPV4
138135
tristate "IPv4 masquerading support for nf_tables"

‎net/ipv4/netfilter/Makefile‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ nf_conntrack_ipv4-y := nf_conntrack_l3proto_ipv4.o nf_conntrack_proto_icmp.o
1010
obj-$(CONFIG_NF_CONNTRACK_IPV4) += nf_conntrack_ipv4.o
1111

1212
nf_nat_ipv4-y := nf_nat_l3proto_ipv4.o nf_nat_proto_icmp.o
13+
nf_nat_ipv4-$(CONFIG_NF_NAT_MASQUERADE_IPV4) += nf_nat_masquerade_ipv4.o
1314
obj-$(CONFIG_NF_NAT_IPV4) += nf_nat_ipv4.o
1415

1516
# defrag
@@ -32,9 +33,6 @@ nf_nat_snmp_basic-y := nf_nat_snmp_basic.asn1.o nf_nat_snmp_basic_main.o
3233
$(obj)/nf_nat_snmp_basic_main.o: $(obj)/nf_nat_snmp_basic.asn1.h
3334
obj-$(CONFIG_NF_NAT_SNMP_BASIC) += nf_nat_snmp_basic.o
3435

35-
obj-$(CONFIG_NF_NAT_MASQUERADE_IPV4) += nf_nat_masquerade_ipv4.o
36-
37-
3836
# NAT protocols (nf_nat)
3937
obj-$(CONFIG_NF_NAT_PROTO_GRE) += nf_nat_proto_gre.o
4038

‎net/ipv4/netfilter/nf_nat_masquerade_ipv4.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88

99
#include <linux/types.h>
10-
#include <linux/module.h>
1110
#include <linux/atomic.h>
1211
#include <linux/inetdevice.h>
1312
#include <linux/ip.h>
@@ -157,6 +156,3 @@ void nf_nat_masquerade_ipv4_unregister_notifier(void)
157156
unregister_inetaddr_notifier(&masq_inet_notifier);
158157
}
159158
EXPORT_SYMBOL_GPL(nf_nat_masquerade_ipv4_unregister_notifier);
160-
161-
MODULE_LICENSE("GPL");
162-
MODULE_AUTHOR("Rusty Russell <rusty@rustcorp.com.au>");

‎net/ipv6/netfilter/Kconfig‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,7 @@ config NF_NAT_IPV6
136136
if NF_NAT_IPV6
137137

138138
config NF_NAT_MASQUERADE_IPV6
139-
tristate "IPv6 masquerade support"
140-
help
141-
This is the kernel functionality to provide NAT in the masquerade
142-
flavour (automatic source address selection) for IPv6.
139+
bool
143140

144141
endif # NF_NAT_IPV6
145142

‎net/ipv6/netfilter/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ nf_conntrack_ipv6-y := nf_conntrack_l3proto_ipv6.o nf_conntrack_proto_icmpv6.o
1818
obj-$(CONFIG_NF_CONNTRACK_IPV6) += nf_conntrack_ipv6.o
1919

2020
nf_nat_ipv6-y := nf_nat_l3proto_ipv6.o nf_nat_proto_icmpv6.o
21+
nf_nat_ipv6-$(CONFIG_NF_NAT_MASQUERADE_IPV6) += nf_nat_masquerade_ipv6.o
2122
obj-$(CONFIG_NF_NAT_IPV6) += nf_nat_ipv6.o
22-
obj-$(CONFIG_NF_NAT_MASQUERADE_IPV6) += nf_nat_masquerade_ipv6.o
2323

2424
# defrag
2525
nf_defrag_ipv6-y := nf_defrag_ipv6_hooks.o nf_conntrack_reasm.o

‎net/ipv6/netfilter/nf_nat_masquerade_ipv6.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
*/
1111

1212
#include <linux/kernel.h>
13-
#include <linux/module.h>
1413
#include <linux/atomic.h>
1514
#include <linux/netdevice.h>
1615
#include <linux/ipv6.h>
@@ -186,6 +185,3 @@ void nf_nat_masquerade_ipv6_unregister_notifier(void)
186185
unregister_netdevice_notifier(&masq_dev_notifier);
187186
}
188187
EXPORT_SYMBOL_GPL(nf_nat_masquerade_ipv6_unregister_notifier);
189-
190-
MODULE_LICENSE("GPL");
191-
MODULE_AUTHOR("Patrick McHardy <kaber@trash.net>");

0 commit comments

Comments
 (0)