aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorCong Wang <amwang@redhat.com>2013-08-31 01:44:35 -0400
committerDavid S. Miller <davem@davemloft.net>2013-08-31 22:30:00 -0400
commitf39dc1023d6b9933528638a0c2dd618b4fdf664e (patch)
tree827325cb95d1edf0e4b928c80539d5d962da556d /net/ipv6
parente15a00aafa4b7953ad717d3cb1ad7acf4ff76945 (diff)
ipv6: move in6_dev_finish_destroy() into core kernel
in6_dev_put() will be needed by vxlan module, so is in6_dev_finish_destroy(). Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Cong Wang <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/addrconf.c30
-rw-r--r--net/ipv6/addrconf_core.c31
2 files changed, 31 insertions, 30 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index baaaead69ee1..2a66eaad047f 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -304,36 +304,6 @@ err_ip:
304 return -ENOMEM; 304 return -ENOMEM;
305} 305}
306 306
307static void snmp6_free_dev(struct inet6_dev *idev)
308{
309 kfree(idev->stats.icmpv6msgdev);
310 kfree(idev->stats.icmpv6dev);
311 snmp_mib_free((void __percpu **)idev->stats.ipv6);
312}
313
314/* Nobody refers to this device, we may destroy it. */
315
316void in6_dev_finish_destroy(struct inet6_dev *idev)
317{
318 struct net_device *dev = idev->dev;
319
320 WARN_ON(!list_empty(&idev->addr_list));
321 WARN_ON(idev->mc_list != NULL);
322 WARN_ON(timer_pending(&idev->rs_timer));
323
324#ifdef NET_REFCNT_DEBUG
325 pr_debug("%s: %s\n", __func__, dev ? dev->name : "NIL");
326#endif
327 dev_put(dev);
328 if (!idev->dead) {
329 pr_warn("Freeing alive inet6 device %p\n", idev);
330 return;
331 }
332 snmp6_free_dev(idev);
333 kfree_rcu(idev, rcu);
334}
335EXPORT_SYMBOL(in6_dev_finish_destroy);
336
337static struct inet6_dev *ipv6_add_dev(struct net_device *dev) 307static struct inet6_dev *ipv6_add_dev(struct net_device *dev)
338{ 308{
339 struct inet6_dev *ndev; 309 struct inet6_dev *ndev;
diff --git a/net/ipv6/addrconf_core.c b/net/ipv6/addrconf_core.c
index a864033d9e78..4c11cbcf8308 100644
--- a/net/ipv6/addrconf_core.c
+++ b/net/ipv6/addrconf_core.c
@@ -6,6 +6,7 @@
6#include <linux/export.h> 6#include <linux/export.h>
7#include <net/ipv6.h> 7#include <net/ipv6.h>
8#include <net/addrconf.h> 8#include <net/addrconf.h>
9#include <net/ip.h>
9 10
10#define IPV6_ADDR_SCOPE_TYPE(scope) ((scope) << 16) 11#define IPV6_ADDR_SCOPE_TYPE(scope) ((scope) << 16)
11 12
@@ -117,3 +118,33 @@ const struct in6_addr in6addr_interfacelocal_allrouters = IN6ADDR_INTERFACELOCAL
117EXPORT_SYMBOL(in6addr_interfacelocal_allrouters); 118EXPORT_SYMBOL(in6addr_interfacelocal_allrouters);
118const struct in6_addr in6addr_sitelocal_allrouters = IN6ADDR_SITELOCAL_ALLROUTERS_INIT; 119const struct in6_addr in6addr_sitelocal_allrouters = IN6ADDR_SITELOCAL_ALLROUTERS_INIT;
119EXPORT_SYMBOL(in6addr_sitelocal_allrouters); 120EXPORT_SYMBOL(in6addr_sitelocal_allrouters);
121
122static void snmp6_free_dev(struct inet6_dev *idev)
123{
124 kfree(idev->stats.icmpv6msgdev);
125 kfree(idev->stats.icmpv6dev);
126 snmp_mib_free((void __percpu **)idev->stats.ipv6);
127}
128
129/* Nobody refers to this device, we may destroy it. */
130
131void in6_dev_finish_destroy(struct inet6_dev *idev)
132{
133 struct net_device *dev = idev->dev;
134
135 WARN_ON(!list_empty(&idev->addr_list));
136 WARN_ON(idev->mc_list != NULL);
137 WARN_ON(timer_pending(&idev->rs_timer));
138
139#ifdef NET_REFCNT_DEBUG
140 pr_debug("%s: %s\n", __func__, dev ? dev->name : "NIL");
141#endif
142 dev_put(dev);
143 if (!idev->dead) {
144 pr_warn("Freeing alive inet6 device %p\n", idev);
145 return;
146 }
147 snmp6_free_dev(idev);
148 kfree_rcu(idev, rcu);
149}
150EXPORT_SYMBOL(in6_dev_finish_destroy);