Skip to content

Commit 045a0fa

Browse files
tgrafdavem330
authored andcommitted
ip_tunnel: Call ip_tunnel_core_init() from inet_init()
Convert the module_init() to a invocation from inet_init() since ip_tunnel_core is part of the INET built-in. Fixes: 3093fbe ("route: Per route IP tunnel metadata via lightweight tunnel") Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c5e40ee commit 045a0fa

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

include/net/ip_tunnels.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ static inline int ip_tunnel_collect_metadata(void)
311311
return static_key_false(&ip_tunnel_metadata_cnt);
312312
}
313313

314+
void __init ip_tunnel_core_init(void);
315+
314316
void ip_tunnel_need_metadata(void);
315317
void ip_tunnel_unneed_metadata(void);
316318

net/ipv4/af_inet.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
#include <net/raw.h>
113113
#include <net/icmp.h>
114114
#include <net/inet_common.h>
115+
#include <net/ip_tunnels.h>
115116
#include <net/xfrm.h>
116117
#include <net/net_namespace.h>
117118
#include <net/secure_seq.h>
@@ -1780,6 +1781,8 @@ static int __init inet_init(void)
17801781

17811782
dev_add_pack(&ip_packet_type);
17821783

1784+
ip_tunnel_core_init();
1785+
17831786
rc = 0;
17841787
out:
17851788
return rc;

net/ipv4/ip_tunnel_core.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -292,19 +292,10 @@ static const struct lwtunnel_encap_ops ip_tun_lwt_ops = {
292292
.get_encap_size = ip_tun_encap_nlsize,
293293
};
294294

295-
static int __init ip_tunnel_core_init(void)
295+
void __init ip_tunnel_core_init(void)
296296
{
297297
lwtunnel_encap_add_ops(&ip_tun_lwt_ops, LWTUNNEL_ENCAP_IP);
298-
299-
return 0;
300-
}
301-
module_init(ip_tunnel_core_init);
302-
303-
static void __exit ip_tunnel_core_exit(void)
304-
{
305-
lwtunnel_encap_del_ops(&ip_tun_lwt_ops, LWTUNNEL_ENCAP_IP);
306298
}
307-
module_exit(ip_tunnel_core_exit);
308299

309300
struct static_key ip_tunnel_metadata_cnt = STATIC_KEY_INIT_FALSE;
310301
EXPORT_SYMBOL(ip_tunnel_metadata_cnt);

0 commit comments

Comments
 (0)