aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/addrconf.h
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/net/addrconf.h
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'include/net/addrconf.h')
-rw-r--r--include/net/addrconf.h92
1 files changed, 54 insertions, 38 deletions
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 4d40c4d0230b..582e4ae70753 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -1,8 +1,6 @@
1#ifndef _ADDRCONF_H 1#ifndef _ADDRCONF_H
2#define _ADDRCONF_H 2#define _ADDRCONF_H
3 3
4#define RETRANS_TIMER HZ
5
6#define MAX_RTR_SOLICITATIONS 3 4#define MAX_RTR_SOLICITATIONS 3
7#define RTR_SOLICITATION_INTERVAL (4*HZ) 5#define RTR_SOLICITATION_INTERVAL (4*HZ)
8 6
@@ -44,8 +42,6 @@ struct prefix_info {
44}; 42};
45 43
46 44
47#ifdef __KERNEL__
48
49#include <linux/netdevice.h> 45#include <linux/netdevice.h>
50#include <net/if_inet6.h> 46#include <net/if_inet6.h>
51#include <net/ipv6.h> 47#include <net/ipv6.h>
@@ -63,16 +59,16 @@ extern int addrconf_set_dstaddr(struct net *net,
63 void __user *arg); 59 void __user *arg);
64 60
65extern int ipv6_chk_addr(struct net *net, 61extern int ipv6_chk_addr(struct net *net,
66 struct in6_addr *addr, 62 const struct in6_addr *addr,
67 struct net_device *dev, 63 struct net_device *dev,
68 int strict); 64 int strict);
69 65
70#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) 66#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
71extern int ipv6_chk_home_addr(struct net *net, 67extern int ipv6_chk_home_addr(struct net *net,
72 struct in6_addr *addr); 68 const struct in6_addr *addr);
73#endif 69#endif
74 70
75extern int ipv6_chk_prefix(struct in6_addr *addr, 71extern int ipv6_chk_prefix(const struct in6_addr *addr,
76 struct net_device *dev); 72 struct net_device *dev);
77 73
78extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, 74extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net,
@@ -91,9 +87,9 @@ extern int ipv6_get_lladdr(struct net_device *dev,
91extern int ipv6_rcv_saddr_equal(const struct sock *sk, 87extern int ipv6_rcv_saddr_equal(const struct sock *sk,
92 const struct sock *sk2); 88 const struct sock *sk2);
93extern void addrconf_join_solict(struct net_device *dev, 89extern void addrconf_join_solict(struct net_device *dev,
94 struct in6_addr *addr); 90 const struct in6_addr *addr);
95extern void addrconf_leave_solict(struct inet6_dev *idev, 91extern void addrconf_leave_solict(struct inet6_dev *idev,
96 struct in6_addr *addr); 92 const struct in6_addr *addr);
97 93
98static inline unsigned long addrconf_timeout_fixup(u32 timeout, 94static inline unsigned long addrconf_timeout_fixup(u32 timeout,
99 unsigned unit) 95 unsigned unit)
@@ -160,35 +156,47 @@ extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len);
160/* 156/*
161 * anycast prototypes (anycast.c) 157 * anycast prototypes (anycast.c)
162 */ 158 */
163extern int ipv6_sock_ac_join(struct sock *sk,int ifindex,struct in6_addr *addr); 159extern int ipv6_sock_ac_join(struct sock *sk,int ifindex, const struct in6_addr *addr);
164extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex,struct in6_addr *addr); 160extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex, const struct in6_addr *addr);
165extern void ipv6_sock_ac_close(struct sock *sk); 161extern void ipv6_sock_ac_close(struct sock *sk);
166extern int inet6_ac_check(struct sock *sk, struct in6_addr *addr, int ifindex); 162extern int inet6_ac_check(struct sock *sk, const struct in6_addr *addr, int ifindex);
167 163
168extern int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr); 164extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr);
169extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr); 165extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr);
170extern int ipv6_chk_acast_addr(struct net *net, struct net_device *dev, 166extern int ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
171 struct in6_addr *addr); 167 const struct in6_addr *addr);
172 168
173 169
174/* Device notifier */ 170/* Device notifier */
175extern int register_inet6addr_notifier(struct notifier_block *nb); 171extern int register_inet6addr_notifier(struct notifier_block *nb);
176extern int unregister_inet6addr_notifier(struct notifier_block *nb); 172extern int unregister_inet6addr_notifier(struct notifier_block *nb);
177 173
178static inline struct inet6_dev * 174/**
179__in6_dev_get(struct net_device *dev) 175 * __in6_dev_get - get inet6_dev pointer from netdevice
176 * @dev: network device
177 *
178 * Caller must hold rcu_read_lock or RTNL, because this function
179 * does not take a reference on the inet6_dev.
180 */
181static inline struct inet6_dev *__in6_dev_get(const struct net_device *dev)
180{ 182{
181 return rcu_dereference_check(dev->ip6_ptr, 183 return rcu_dereference_rtnl(dev->ip6_ptr);
182 rcu_read_lock_held() ||
183 lockdep_rtnl_is_held());
184} 184}
185 185
186static inline struct inet6_dev * 186/**
187in6_dev_get(struct net_device *dev) 187 * in6_dev_get - get inet6_dev pointer from netdevice
188 * @dev: network device
189 *
190 * This version can be used in any context, and takes a reference
191 * on the inet6_dev. Callers must use in6_dev_put() later to
192 * release this reference.
193 */
194static inline struct inet6_dev *in6_dev_get(const struct net_device *dev)
188{ 195{
189 struct inet6_dev *idev = NULL; 196 struct inet6_dev *idev;
197
190 rcu_read_lock(); 198 rcu_read_lock();
191 idev = __in6_dev_get(dev); 199 idev = rcu_dereference(dev->ip6_ptr);
192 if (idev) 200 if (idev)
193 atomic_inc(&idev->refcnt); 201 atomic_inc(&idev->refcnt);
194 rcu_read_unlock(); 202 rcu_read_unlock();
@@ -197,16 +205,21 @@ in6_dev_get(struct net_device *dev)
197 205
198extern void in6_dev_finish_destroy(struct inet6_dev *idev); 206extern void in6_dev_finish_destroy(struct inet6_dev *idev);
199 207
200static inline void 208static inline void in6_dev_put(struct inet6_dev *idev)
201in6_dev_put(struct inet6_dev *idev)
202{ 209{
203 if (atomic_dec_and_test(&idev->refcnt)) 210 if (atomic_dec_and_test(&idev->refcnt))
204 in6_dev_finish_destroy(idev); 211 in6_dev_finish_destroy(idev);
205} 212}
206 213
207#define __in6_dev_put(idev) atomic_dec(&(idev)->refcnt) 214static inline void __in6_dev_put(struct inet6_dev *idev)
208#define in6_dev_hold(idev) atomic_inc(&(idev)->refcnt) 215{
216 atomic_dec(&idev->refcnt);
217}
209 218
219static inline void in6_dev_hold(struct inet6_dev *idev)
220{
221 atomic_inc(&idev->refcnt);
222}
210 223
211extern void inet6_ifa_finish_destroy(struct inet6_ifaddr *ifp); 224extern void inet6_ifa_finish_destroy(struct inet6_ifaddr *ifp);
212 225
@@ -216,9 +229,15 @@ static inline void in6_ifa_put(struct inet6_ifaddr *ifp)
216 inet6_ifa_finish_destroy(ifp); 229 inet6_ifa_finish_destroy(ifp);
217} 230}
218 231
219#define __in6_ifa_put(ifp) atomic_dec(&(ifp)->refcnt) 232static inline void __in6_ifa_put(struct inet6_ifaddr *ifp)
220#define in6_ifa_hold(ifp) atomic_inc(&(ifp)->refcnt) 233{
234 atomic_dec(&ifp->refcnt);
235}
221 236
237static inline void in6_ifa_hold(struct inet6_ifaddr *ifp)
238{
239 atomic_inc(&ifp->refcnt);
240}
222 241
223 242
224/* 243/*
@@ -241,23 +260,21 @@ static inline int ipv6_addr_is_multicast(const struct in6_addr *addr)
241 260
242static inline int ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) 261static inline int ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr)
243{ 262{
244 return (((addr->s6_addr32[0] ^ htonl(0xff020000)) | 263 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
245 addr->s6_addr32[1] | addr->s6_addr32[2] | 264 addr->s6_addr32[1] | addr->s6_addr32[2] |
246 (addr->s6_addr32[3] ^ htonl(0x00000001))) == 0); 265 (addr->s6_addr32[3] ^ htonl(0x00000001))) == 0;
247} 266}
248 267
249static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) 268static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr)
250{ 269{
251 return (((addr->s6_addr32[0] ^ htonl(0xff020000)) | 270 return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
252 addr->s6_addr32[1] | addr->s6_addr32[2] | 271 addr->s6_addr32[1] | addr->s6_addr32[2] |
253 (addr->s6_addr32[3] ^ htonl(0x00000002))) == 0); 272 (addr->s6_addr32[3] ^ htonl(0x00000002))) == 0;
254} 273}
255 274
256extern int __ipv6_isatap_ifid(u8 *eui, __be32 addr);
257
258static inline int ipv6_addr_is_isatap(const struct in6_addr *addr) 275static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
259{ 276{
260 return ((addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE)); 277 return (addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE);
261} 278}
262 279
263#ifdef CONFIG_PROC_FS 280#ifdef CONFIG_PROC_FS
@@ -266,4 +283,3 @@ extern void if6_proc_exit(void);
266#endif 283#endif
267 284
268#endif 285#endif
269#endif