diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-09-29 23:31:56 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-01 00:16:05 -0400 |
commit | 82efee1499a27c06f5afb11b07db384fdb3f7004 (patch) | |
tree | c329e037ddf4e13cd824c131eab3bd3a2e67a0fc /include/linux/inetdevice.h | |
parent | 828bac87bb074f3366621724fdfbe314f98ccc7e (diff) |
ipv4: introduce __ip_dev_find()
ip_dev_find(net, addr) finds a device given an IPv4 source address and
takes a reference on it.
Introduce __ip_dev_find(), taking a third argument, to optionally take
the device reference. Callers not asking the reference to be taken
should be in an rcu_read_lock() protected section.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/inetdevice.h')
-rw-r--r-- | include/linux/inetdevice.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 1ec09bb4a3ab..ccd5b07d678d 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -159,7 +159,12 @@ struct in_ifaddr { | |||
159 | extern int register_inetaddr_notifier(struct notifier_block *nb); | 159 | extern int register_inetaddr_notifier(struct notifier_block *nb); |
160 | extern int unregister_inetaddr_notifier(struct notifier_block *nb); | 160 | extern int unregister_inetaddr_notifier(struct notifier_block *nb); |
161 | 161 | ||
162 | 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 | |||
163 | 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); |
164 | 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 *); |
165 | extern void devinet_init(void); | 170 | extern void devinet_init(void); |