diff options
Diffstat (limited to 'include/linux/inetdevice.h')
-rw-r--r-- | include/linux/inetdevice.h | 21 |
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 | ||
13 | enum | 14 | enum |
14 | { | 15 | { |
@@ -158,7 +159,12 @@ struct in_ifaddr { | |||
158 | extern int register_inetaddr_notifier(struct notifier_block *nb); | 159 | extern int register_inetaddr_notifier(struct notifier_block *nb); |
159 | extern int unregister_inetaddr_notifier(struct notifier_block *nb); | 160 | extern int unregister_inetaddr_notifier(struct notifier_block *nb); |
160 | 161 | ||
161 | extern struct net_device *ip_dev_find(struct net *net, __be32 addr); | 162 | extern struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref); |
163 | static inline struct net_device *ip_dev_find(struct net *net, __be32 addr) | ||
164 | { | ||
165 | return __ip_dev_find(net, addr, true); | ||
166 | } | ||
167 | |||
162 | extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); | 168 | extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); |
163 | extern int devinet_ioctl(struct net *net, unsigned int cmd, void __user *); | 169 | extern int devinet_ioctl(struct net *net, unsigned int cmd, void __user *); |
164 | extern void devinet_init(void); | 170 | extern void devinet_init(void); |
@@ -198,14 +204,10 @@ static __inline__ int bad_mask(__be32 mask, __be32 addr) | |||
198 | 204 | ||
199 | static inline struct in_device *__in_dev_get_rcu(const struct net_device *dev) | 205 | static 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 | ||
207 | static __inline__ struct in_device * | 210 | static inline struct in_device *in_dev_get(const struct net_device *dev) |
208 | in_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 | ||
220 | static __inline__ struct in_device * | 222 | static 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 | ||
226 | extern void in_dev_finish_destroy(struct in_device *idev); | 227 | extern void in_dev_finish_destroy(struct in_device *idev); |