aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/inetdevice.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/inetdevice.h')
-rw-r--r--include/linux/inetdevice.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index 2be1a1a2beb9..ccd5b07d678d 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -9,6 +9,7 @@
9#include <linux/rcupdate.h> 9#include <linux/rcupdate.h>
10#include <linux/timer.h> 10#include <linux/timer.h>
11#include <linux/sysctl.h> 11#include <linux/sysctl.h>
12#include <linux/rtnetlink.h>
12 13
13enum 14enum
14{ 15{
@@ -158,7 +159,12 @@ struct in_ifaddr {
158extern int register_inetaddr_notifier(struct notifier_block *nb); 159extern int register_inetaddr_notifier(struct notifier_block *nb);
159extern int unregister_inetaddr_notifier(struct notifier_block *nb); 160extern int unregister_inetaddr_notifier(struct notifier_block *nb);
160 161
161extern struct net_device *ip_dev_find(struct net *net, __be32 addr); 162extern struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref);
163static inline struct net_device *ip_dev_find(struct net *net, __be32 addr)
164{
165 return __ip_dev_find(net, addr, true);
166}
167
162extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); 168extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
163extern int devinet_ioctl(struct net *net, unsigned int cmd, void __user *); 169extern int devinet_ioctl(struct net *net, unsigned int cmd, void __user *);
164extern void devinet_init(void); 170extern void devinet_init(void);
@@ -198,14 +204,10 @@ static __inline__ int bad_mask(__be32 mask, __be32 addr)
198 204
199static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev) 205static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev)
200{ 206{
201 struct in_device *in_dev = dev->ip_ptr; 207 return rcu_dereference(dev->ip_ptr);
202 if (in_dev)
203 in_dev = rcu_dereference(in_dev);
204 return in_dev;
205} 208}
206 209
207static __inline__ struct in_device * 210static inline struct in_device *in_dev_get(const struct net_device *dev)
208in_dev_get(const struct net_device *dev)
209{ 211{
210 struct in_device *in_dev; 212 struct in_device *in_dev;
211 213
@@ -217,10 +219,9 @@ in_dev_get(const struct net_device *dev)
217 return in_dev; 219 return in_dev;
218} 220}
219 221
220static __inline__ struct in_device * 222static inline struct in_device *__in_dev_get_rtnl(const struct net_device *dev)
221__in_dev_get_rtnl(const struct net_device *dev)
222{ 223{
223 return (struct in_device*)dev->ip_ptr; 224 return rcu_dereference_check(dev->ip_ptr, lockdep_rtnl_is_held());
224} 225}
225 226
226extern void in_dev_finish_destroy(struct in_device *idev); 227extern void in_dev_finish_destroy(struct in_device *idev);