rtnetlink: ipv6: convert remaining users to rtnl_register_module
authorFlorian Westphal <fw@strlen.de>
Mon, 4 Dec 2017 18:19:18 +0000 (19:19 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 Dec 2017 18:35:36 +0000 (13:35 -0500)
convert remaining users of rtnl_register to rtnl_register_module
and un-export rtnl_register.

Requested-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/addrconf.h
net/core/rtnetlink.c
net/ipv6/addrconf.c
net/ipv6/addrlabel.c
net/ipv6/ip6mr.c

index b623b65a79d1687602ba319cf9047a4c41b6396b..c4185a7b0e9029aea30da1a40649fa97de0fe0d6 100644 (file)
@@ -180,7 +180,7 @@ static inline int addrconf_finite_timeout(unsigned long timeout)
  */
 int ipv6_addr_label_init(void);
 void ipv6_addr_label_cleanup(void);
-void ipv6_addr_label_rtnl_register(void);
+int ipv6_addr_label_rtnl_register(void);
 u32 ipv6_addr_label(struct net *net, const struct in6_addr *addr,
                    int type, int ifindex);
 
index a55d0c236b40c5226c7520154745525253a9fd11..642b3afb12b901e127fb26c54645ace97da3c797 100644 (file)
@@ -265,7 +265,6 @@ void rtnl_register(int protocol, int msgtype,
                pr_err("Unable to register rtnetlink message handler, "
                       "protocol = %d, message type = %d\n", protocol, msgtype);
 }
-EXPORT_SYMBOL_GPL(rtnl_register);
 
 /**
  * rtnl_unregister - Unregister a rtnetlink message type
index a5ad8425551a119250f02bdd52ab10253c8c339f..ed06b1190f05b849c595b56ff110948735583b3c 100644 (file)
@@ -6627,7 +6627,9 @@ int __init addrconf_init(void)
                                   RTNL_FLAG_DOIT_UNLOCKED);
        if (err < 0)
                goto errout;
-       ipv6_addr_label_rtnl_register();
+       err = ipv6_addr_label_rtnl_register();
+       if (err < 0)
+               goto errout;
 
        return 0;
 errout:
index 303fcce5beefca40d462136270d06d3f66622d97..1d6ced37ad718398c947cf49b3b486d4b88f3f6f 100644 (file)
@@ -547,12 +547,22 @@ static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr *nlh,
        return err;
 }
 
-void __init ipv6_addr_label_rtnl_register(void)
+int __init ipv6_addr_label_rtnl_register(void)
 {
-       rtnl_register(PF_INET6, RTM_NEWADDRLABEL, ip6addrlbl_newdel,
-                     NULL, RTNL_FLAG_DOIT_UNLOCKED);
-       rtnl_register(PF_INET6, RTM_DELADDRLABEL, ip6addrlbl_newdel,
-                     NULL, RTNL_FLAG_DOIT_UNLOCKED);
-       rtnl_register(PF_INET6, RTM_GETADDRLABEL, ip6addrlbl_get,
-                     ip6addrlbl_dump, RTNL_FLAG_DOIT_UNLOCKED);
+       int ret;
+
+       ret = rtnl_register_module(THIS_MODULE, PF_INET6, RTM_NEWADDRLABEL,
+                                  ip6addrlbl_newdel,
+                                  NULL, RTNL_FLAG_DOIT_UNLOCKED);
+       if (ret < 0)
+               return ret;
+       ret = rtnl_register_module(THIS_MODULE, PF_INET6, RTM_DELADDRLABEL,
+                                  ip6addrlbl_newdel,
+                                  NULL, RTNL_FLAG_DOIT_UNLOCKED);
+       if (ret < 0)
+               return ret;
+       ret = rtnl_register_module(THIS_MODULE, PF_INET6, RTM_GETADDRLABEL,
+                                  ip6addrlbl_get,
+                                  ip6addrlbl_dump, RTNL_FLAG_DOIT_UNLOCKED);
+       return ret;
 }
index a2e1a864eb4695ee4323ce2f85f2a560efd73ee4..890f9bda06a4bcfb3d3e7a26e658e98768bbcc7e 100644 (file)
@@ -1425,10 +1425,13 @@ int __init ip6_mr_init(void)
                goto add_proto_fail;
        }
 #endif
-       rtnl_register(RTNL_FAMILY_IP6MR, RTM_GETROUTE, NULL,
-                     ip6mr_rtm_dumproute, 0);
-       return 0;
+       err = rtnl_register_module(THIS_MODULE, RTNL_FAMILY_IP6MR, RTM_GETROUTE,
+                                  NULL, ip6mr_rtm_dumproute, 0);
+       if (err == 0)
+               return 0;
+
 #ifdef CONFIG_IPV6_PIMSM_V2
+       inet6_del_protocol(&pim6_protocol, IPPROTO_PIM);
 add_proto_fail:
        unregister_netdevice_notifier(&ip6_mr_notifier);
 #endif