ip_tunnel: Call ip_tunnel_core_init() from inet_init()
authorThomas Graf <tgraf@suug.ch>
Thu, 23 Jul 2015 08:08:44 +0000 (10:08 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 Jul 2015 08:28:21 +0000 (01:28 -0700)
Convert the module_init() to a invocation from inet_init() since
ip_tunnel_core is part of the INET built-in.

Fixes: 3093fbe7ff4 ("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>
include/net/ip_tunnels.h
net/ipv4/af_inet.c
net/ipv4/ip_tunnel_core.c

index d975b3ebd6c7c20b90c9d56192d5738166cb49a7..47984415f5d1e7758d6a1c8b0feaeb55f902a7dd 100644 (file)
@@ -311,6 +311,8 @@ static inline int ip_tunnel_collect_metadata(void)
        return static_key_false(&ip_tunnel_metadata_cnt);
 }
 
+void __init ip_tunnel_core_init(void);
+
 void ip_tunnel_need_metadata(void);
 void ip_tunnel_unneed_metadata(void);
 
index 9532ee87151f5d184205eafc70729fc543a9eb82..cc4e498a0ccf390115c2f6f0306248650f4a2c35 100644 (file)
 #include <net/raw.h>
 #include <net/icmp.h>
 #include <net/inet_common.h>
+#include <net/ip_tunnels.h>
 #include <net/xfrm.h>
 #include <net/net_namespace.h>
 #include <net/secure_seq.h>
@@ -1780,6 +1781,8 @@ static int __init inet_init(void)
 
        dev_add_pack(&ip_packet_type);
 
+       ip_tunnel_core_init();
+
        rc = 0;
 out:
        return rc;
index 630e6d5712e8e5548c65b34b6a6489caa90249fc..5512f4e4ec1b1b629a9c1fe1c7ac2ac4ffced248 100644 (file)
@@ -292,19 +292,10 @@ static const struct lwtunnel_encap_ops ip_tun_lwt_ops = {
        .get_encap_size = ip_tun_encap_nlsize,
 };
 
-static int __init ip_tunnel_core_init(void)
+void __init ip_tunnel_core_init(void)
 {
        lwtunnel_encap_add_ops(&ip_tun_lwt_ops, LWTUNNEL_ENCAP_IP);
-
-       return 0;
-}
-module_init(ip_tunnel_core_init);
-
-static void __exit ip_tunnel_core_exit(void)
-{
-       lwtunnel_encap_del_ops(&ip_tun_lwt_ops, LWTUNNEL_ENCAP_IP);
 }
-module_exit(ip_tunnel_core_exit);
 
 struct static_key ip_tunnel_metadata_cnt = STATIC_KEY_INIT_FALSE;
 EXPORT_SYMBOL(ip_tunnel_metadata_cnt);