diff options
author | Florian Westphal <fw@strlen.de> | 2019-03-29 16:16:31 -0400 |
---|---|---|
committer | Steffen Klassert <steffen.klassert@secunet.com> | 2019-04-08 03:15:17 -0400 |
commit | 4c145dce26013763490df88f2473714f5bc7857d (patch) | |
tree | 4c04664251930847a954536f24e0a5f9bcb08768 /net/ipv6 | |
parent | 733a5fac2f15b55b9059230d098ed04341d2d884 (diff) |
xfrm: make xfrm modes builtin
after previous changes, xfrm_mode contains no function pointers anymore
and all modules defining such struct contain no code except an init/exit
functions to register the xfrm_mode struct with the xfrm core.
Just place the xfrm modes core and remove the modules,
the run-time xfrm_mode register/unregister functionality is removed.
Before:
text data bss dec filename
7523 200 2364 10087 net/xfrm/xfrm_input.o
40003 628 440 41071 net/xfrm/xfrm_state.o
15730338 6937080 4046908 26714326 vmlinux
7389 200 2364 9953 net/xfrm/xfrm_input.o
40574 656 440 41670 net/xfrm/xfrm_state.o
15730084 6937068 4046908 26714060 vmlinux
The xfrm*_mode_{transport,tunnel,beet} modules are gone.
v2: replace CONFIG_INET6_XFRM_MODE_* IS_ENABLED guards with CONFIG_IPV6
ones rather than removing them.
Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/Kconfig | 35 | ||||
-rw-r--r-- | net/ipv6/Makefile | 4 | ||||
-rw-r--r-- | net/ipv6/ip6_vti.c | 2 | ||||
-rw-r--r-- | net/ipv6/xfrm6_mode_beet.c | 42 | ||||
-rw-r--r-- | net/ipv6/xfrm6_mode_ro.c | 55 | ||||
-rw-r--r-- | net/ipv6/xfrm6_mode_transport.c | 37 | ||||
-rw-r--r-- | net/ipv6/xfrm6_mode_tunnel.c | 45 |
7 files changed, 2 insertions, 218 deletions
diff --git a/net/ipv6/Kconfig b/net/ipv6/Kconfig index 613282c65a10..cd915e332c98 100644 --- a/net/ipv6/Kconfig +++ b/net/ipv6/Kconfig | |||
@@ -135,44 +135,11 @@ config INET6_TUNNEL | |||
135 | tristate | 135 | tristate |
136 | default n | 136 | default n |
137 | 137 | ||
138 | config INET6_XFRM_MODE_TRANSPORT | ||
139 | tristate "IPv6: IPsec transport mode" | ||
140 | default IPV6 | ||
141 | select XFRM | ||
142 | ---help--- | ||
143 | Support for IPsec transport mode. | ||
144 | |||
145 | If unsure, say Y. | ||
146 | |||
147 | config INET6_XFRM_MODE_TUNNEL | ||
148 | tristate "IPv6: IPsec tunnel mode" | ||
149 | default IPV6 | ||
150 | select XFRM | ||
151 | ---help--- | ||
152 | Support for IPsec tunnel mode. | ||
153 | |||
154 | If unsure, say Y. | ||
155 | |||
156 | config INET6_XFRM_MODE_BEET | ||
157 | tristate "IPv6: IPsec BEET mode" | ||
158 | default IPV6 | ||
159 | select XFRM | ||
160 | ---help--- | ||
161 | Support for IPsec BEET mode. | ||
162 | |||
163 | If unsure, say Y. | ||
164 | |||
165 | config INET6_XFRM_MODE_ROUTEOPTIMIZATION | ||
166 | tristate "IPv6: MIPv6 route optimization mode" | ||
167 | select XFRM | ||
168 | ---help--- | ||
169 | Support for MIPv6 route optimization mode. | ||
170 | |||
171 | config IPV6_VTI | 138 | config IPV6_VTI |
172 | tristate "Virtual (secure) IPv6: tunneling" | 139 | tristate "Virtual (secure) IPv6: tunneling" |
173 | select IPV6_TUNNEL | 140 | select IPV6_TUNNEL |
174 | select NET_IP_TUNNEL | 141 | select NET_IP_TUNNEL |
175 | depends on INET6_XFRM_MODE_TUNNEL | 142 | select XFRM |
176 | ---help--- | 143 | ---help--- |
177 | Tunneling means encapsulating data of one protocol type within | 144 | Tunneling means encapsulating data of one protocol type within |
178 | another protocol and sending it over a channel that understands the | 145 | another protocol and sending it over a channel that understands the |
diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile index e0026fa1261b..8ccf35514015 100644 --- a/net/ipv6/Makefile +++ b/net/ipv6/Makefile | |||
@@ -35,10 +35,6 @@ obj-$(CONFIG_INET6_ESP_OFFLOAD) += esp6_offload.o | |||
35 | obj-$(CONFIG_INET6_IPCOMP) += ipcomp6.o | 35 | obj-$(CONFIG_INET6_IPCOMP) += ipcomp6.o |
36 | obj-$(CONFIG_INET6_XFRM_TUNNEL) += xfrm6_tunnel.o | 36 | obj-$(CONFIG_INET6_XFRM_TUNNEL) += xfrm6_tunnel.o |
37 | obj-$(CONFIG_INET6_TUNNEL) += tunnel6.o | 37 | obj-$(CONFIG_INET6_TUNNEL) += tunnel6.o |
38 | obj-$(CONFIG_INET6_XFRM_MODE_TRANSPORT) += xfrm6_mode_transport.o | ||
39 | obj-$(CONFIG_INET6_XFRM_MODE_TUNNEL) += xfrm6_mode_tunnel.o | ||
40 | obj-$(CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION) += xfrm6_mode_ro.o | ||
41 | obj-$(CONFIG_INET6_XFRM_MODE_BEET) += xfrm6_mode_beet.o | ||
42 | obj-$(CONFIG_IPV6_MIP6) += mip6.o | 38 | obj-$(CONFIG_IPV6_MIP6) += mip6.o |
43 | obj-$(CONFIG_IPV6_ILA) += ila/ | 39 | obj-$(CONFIG_IPV6_ILA) += ila/ |
44 | obj-$(CONFIG_NETFILTER) += netfilter/ | 40 | obj-$(CONFIG_NETFILTER) += netfilter/ |
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index 369803c581b7..71ec5e60cf8f 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c | |||
@@ -342,7 +342,7 @@ static int vti6_rcv_cb(struct sk_buff *skb, int err) | |||
342 | struct net_device *dev; | 342 | struct net_device *dev; |
343 | struct pcpu_sw_netstats *tstats; | 343 | struct pcpu_sw_netstats *tstats; |
344 | struct xfrm_state *x; | 344 | struct xfrm_state *x; |
345 | struct xfrm_mode *inner_mode; | 345 | const struct xfrm_mode *inner_mode; |
346 | struct ip6_tnl *t = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6; | 346 | struct ip6_tnl *t = XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6; |
347 | u32 orig_mark = skb->mark; | 347 | u32 orig_mark = skb->mark; |
348 | int ret; | 348 | int ret; |
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c deleted file mode 100644 index 1c4a76bdd889..000000000000 --- a/net/ipv6/xfrm6_mode_beet.c +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /* | ||
2 | * xfrm6_mode_beet.c - BEET mode encapsulation for IPv6. | ||
3 | * | ||
4 | * Copyright (c) 2006 Diego Beltrami <diego.beltrami@gmail.com> | ||
5 | * Miika Komu <miika@iki.fi> | ||
6 | * Herbert Xu <herbert@gondor.apana.org.au> | ||
7 | * Abhinav Pathak <abhinav.pathak@hiit.fi> | ||
8 | * Jeff Ahrenholz <ahrenholz@gmail.com> | ||
9 | */ | ||
10 | |||
11 | #include <linux/init.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/skbuff.h> | ||
15 | #include <linux/stringify.h> | ||
16 | #include <net/dsfield.h> | ||
17 | #include <net/dst.h> | ||
18 | #include <net/inet_ecn.h> | ||
19 | #include <net/ipv6.h> | ||
20 | #include <net/xfrm.h> | ||
21 | |||
22 | static struct xfrm_mode xfrm6_beet_mode = { | ||
23 | .owner = THIS_MODULE, | ||
24 | .encap = XFRM_MODE_BEET, | ||
25 | .flags = XFRM_MODE_FLAG_TUNNEL, | ||
26 | .family = AF_INET6, | ||
27 | }; | ||
28 | |||
29 | static int __init xfrm6_beet_init(void) | ||
30 | { | ||
31 | return xfrm_register_mode(&xfrm6_beet_mode); | ||
32 | } | ||
33 | |||
34 | static void __exit xfrm6_beet_exit(void) | ||
35 | { | ||
36 | xfrm_unregister_mode(&xfrm6_beet_mode); | ||
37 | } | ||
38 | |||
39 | module_init(xfrm6_beet_init); | ||
40 | module_exit(xfrm6_beet_exit); | ||
41 | MODULE_LICENSE("GPL"); | ||
42 | MODULE_ALIAS_XFRM_MODE(AF_INET6, XFRM_MODE_BEET); | ||
diff --git a/net/ipv6/xfrm6_mode_ro.c b/net/ipv6/xfrm6_mode_ro.c deleted file mode 100644 index d0a6a4dbd689..000000000000 --- a/net/ipv6/xfrm6_mode_ro.c +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | /* | ||
2 | * xfrm6_mode_ro.c - Route optimization mode for IPv6. | ||
3 | * | ||
4 | * Copyright (C)2003-2006 Helsinki University of Technology | ||
5 | * Copyright (C)2003-2006 USAGI/WIDE Project | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | ||
20 | /* | ||
21 | * Authors: | ||
22 | * Noriaki TAKAMIYA @USAGI | ||
23 | * Masahide NAKAMURA @USAGI | ||
24 | */ | ||
25 | |||
26 | #include <linux/init.h> | ||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/module.h> | ||
29 | #include <linux/skbuff.h> | ||
30 | #include <linux/spinlock.h> | ||
31 | #include <linux/stringify.h> | ||
32 | #include <linux/time.h> | ||
33 | #include <net/ipv6.h> | ||
34 | #include <net/xfrm.h> | ||
35 | |||
36 | static struct xfrm_mode xfrm6_ro_mode = { | ||
37 | .owner = THIS_MODULE, | ||
38 | .encap = XFRM_MODE_ROUTEOPTIMIZATION, | ||
39 | .family = AF_INET6, | ||
40 | }; | ||
41 | |||
42 | static int __init xfrm6_ro_init(void) | ||
43 | { | ||
44 | return xfrm_register_mode(&xfrm6_ro_mode); | ||
45 | } | ||
46 | |||
47 | static void __exit xfrm6_ro_exit(void) | ||
48 | { | ||
49 | xfrm_unregister_mode(&xfrm6_ro_mode); | ||
50 | } | ||
51 | |||
52 | module_init(xfrm6_ro_init); | ||
53 | module_exit(xfrm6_ro_exit); | ||
54 | MODULE_LICENSE("GPL"); | ||
55 | MODULE_ALIAS_XFRM_MODE(AF_INET6, XFRM_MODE_ROUTEOPTIMIZATION); | ||
diff --git a/net/ipv6/xfrm6_mode_transport.c b/net/ipv6/xfrm6_mode_transport.c deleted file mode 100644 index d90c934c2f1a..000000000000 --- a/net/ipv6/xfrm6_mode_transport.c +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | /* | ||
2 | * xfrm6_mode_transport.c - Transport mode encapsulation for IPv6. | ||
3 | * | ||
4 | * Copyright (C) 2002 USAGI/WIDE Project | ||
5 | * Copyright (c) 2004-2006 Herbert Xu <herbert@gondor.apana.org.au> | ||
6 | */ | ||
7 | |||
8 | #include <linux/init.h> | ||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/skbuff.h> | ||
12 | #include <linux/stringify.h> | ||
13 | #include <net/dst.h> | ||
14 | #include <net/ipv6.h> | ||
15 | #include <net/xfrm.h> | ||
16 | #include <net/protocol.h> | ||
17 | |||
18 | static struct xfrm_mode xfrm6_transport_mode = { | ||
19 | .owner = THIS_MODULE, | ||
20 | .encap = XFRM_MODE_TRANSPORT, | ||
21 | .family = AF_INET6, | ||
22 | }; | ||
23 | |||
24 | static int __init xfrm6_transport_init(void) | ||
25 | { | ||
26 | return xfrm_register_mode(&xfrm6_transport_mode); | ||
27 | } | ||
28 | |||
29 | static void __exit xfrm6_transport_exit(void) | ||
30 | { | ||
31 | xfrm_unregister_mode(&xfrm6_transport_mode); | ||
32 | } | ||
33 | |||
34 | module_init(xfrm6_transport_init); | ||
35 | module_exit(xfrm6_transport_exit); | ||
36 | MODULE_LICENSE("GPL"); | ||
37 | MODULE_ALIAS_XFRM_MODE(AF_INET6, XFRM_MODE_TRANSPORT); | ||
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c deleted file mode 100644 index e5c928dd70e3..000000000000 --- a/net/ipv6/xfrm6_mode_tunnel.c +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | /* | ||
2 | * xfrm6_mode_tunnel.c - Tunnel mode encapsulation for IPv6. | ||
3 | * | ||
4 | * Copyright (C) 2002 USAGI/WIDE Project | ||
5 | * Copyright (c) 2004-2006 Herbert Xu <herbert@gondor.apana.org.au> | ||
6 | */ | ||
7 | |||
8 | #include <linux/gfp.h> | ||
9 | #include <linux/init.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/skbuff.h> | ||
13 | #include <linux/stringify.h> | ||
14 | #include <net/dsfield.h> | ||
15 | #include <net/dst.h> | ||
16 | #include <net/inet_ecn.h> | ||
17 | #include <net/ip6_route.h> | ||
18 | #include <net/ipv6.h> | ||
19 | #include <net/xfrm.h> | ||
20 | |||
21 | /* Add encapsulation header. | ||
22 | * | ||
23 | * The top IP header will be constructed per RFC 2401. | ||
24 | */ | ||
25 | static struct xfrm_mode xfrm6_tunnel_mode = { | ||
26 | .owner = THIS_MODULE, | ||
27 | .encap = XFRM_MODE_TUNNEL, | ||
28 | .flags = XFRM_MODE_FLAG_TUNNEL, | ||
29 | .family = AF_INET6, | ||
30 | }; | ||
31 | |||
32 | static int __init xfrm6_mode_tunnel_init(void) | ||
33 | { | ||
34 | return xfrm_register_mode(&xfrm6_tunnel_mode); | ||
35 | } | ||
36 | |||
37 | static void __exit xfrm6_mode_tunnel_exit(void) | ||
38 | { | ||
39 | xfrm_unregister_mode(&xfrm6_tunnel_mode); | ||
40 | } | ||
41 | |||
42 | module_init(xfrm6_mode_tunnel_init); | ||
43 | module_exit(xfrm6_mode_tunnel_exit); | ||
44 | MODULE_LICENSE("GPL"); | ||
45 | MODULE_ALIAS_XFRM_MODE(AF_INET6, XFRM_MODE_TUNNEL); | ||