4 #define RETRANS_TIMER HZ
6 #define MAX_RTR_SOLICITATIONS 3
7 #define RTR_SOLICITATION_INTERVAL (4*HZ)
9 #define ADDR_CHECK_FREQUENCY (120*HZ)
16 #if defined(__BIG_ENDIAN_BITFIELD)
20 #elif defined(__LITTLE_ENDIAN_BITFIELD)
25 #error "Please fix <asm/byteorder.h>"
31 struct in6_addr prefix
;
37 #include <linux/in6.h>
38 #include <linux/netdevice.h>
39 #include <net/if_inet6.h>
41 #define IN6_ADDR_HSIZE 16
43 extern void addrconf_init(void);
44 extern void addrconf_cleanup(void);
46 extern int addrconf_notify(struct notifier_block
*this,
50 extern int addrconf_add_ifaddr(void *arg
);
51 extern int addrconf_del_ifaddr(void *arg
);
52 extern int addrconf_set_dstaddr(void *arg
);
54 extern int ipv6_chk_addr(struct in6_addr
*addr
,
55 struct net_device
*dev
);
56 extern struct inet6_ifaddr
* ipv6_get_ifaddr(struct in6_addr
*addr
,
57 struct net_device
*dev
);
58 extern int ipv6_get_saddr(struct dst_entry
*dst
,
59 struct in6_addr
*daddr
,
60 struct in6_addr
*saddr
);
61 extern int ipv6_get_lladdr(struct net_device
*dev
, struct in6_addr
*);
64 * multicast prototypes (mcast.c)
66 extern int ipv6_sock_mc_join(struct sock
*sk
,
68 struct in6_addr
*addr
);
69 extern int ipv6_sock_mc_drop(struct sock
*sk
,
71 struct in6_addr
*addr
);
72 extern void ipv6_sock_mc_close(struct sock
*sk
);
73 extern int inet6_mc_check(struct sock
*sk
, struct in6_addr
*addr
);
75 extern int ipv6_dev_mc_inc(struct net_device
*dev
,
76 struct in6_addr
*addr
);
77 extern int ipv6_dev_mc_dec(struct net_device
*dev
,
78 struct in6_addr
*addr
);
79 extern void ipv6_mc_up(struct inet6_dev
*idev
);
80 extern void ipv6_mc_down(struct inet6_dev
*idev
);
81 extern void ipv6_mc_destroy_dev(struct inet6_dev
*idev
);
82 extern void addrconf_dad_failure(struct inet6_ifaddr
*ifp
);
84 extern int ipv6_chk_mcast_addr(struct net_device
*dev
,
85 struct in6_addr
*addr
);
87 extern void addrconf_prefix_rcv(struct net_device
*dev
,
90 extern __inline__
struct inet6_dev
*
91 __in6_dev_get(struct net_device
*dev
)
93 return (struct inet6_dev
*)dev
->ip6_ptr
;
96 extern rwlock_t addrconf_lock
;
98 extern __inline__
struct inet6_dev
*
99 in6_dev_get(struct net_device
*dev
)
101 struct inet6_dev
*idev
= NULL
;
102 read_lock(&addrconf_lock
);
105 atomic_inc(&idev
->refcnt
);
106 read_unlock(&addrconf_lock
);
110 extern void in6_dev_finish_destroy(struct inet6_dev
*idev
);
112 extern __inline__
void
113 in6_dev_put(struct inet6_dev
*idev
)
115 if (atomic_dec_and_test(&idev
->refcnt
))
116 in6_dev_finish_destroy(idev
);
119 #define __in6_dev_put(idev) atomic_dec(&(idev)->refcnt)
120 #define in6_dev_hold(idev) atomic_inc(&(idev)->refcnt)
123 extern void inet6_ifa_finish_destroy(struct inet6_ifaddr
*ifp
);
125 extern __inline__
void in6_ifa_put(struct inet6_ifaddr
*ifp
)
127 if (atomic_dec_and_test(&ifp
->refcnt
))
128 inet6_ifa_finish_destroy(ifp
);
131 #define __in6_ifa_put(idev) atomic_dec(&(idev)->refcnt)
132 #define in6_ifa_hold(idev) atomic_inc(&(idev)->refcnt)
135 extern void addrconf_forwarding_on(void);
137 * Hash function taken from net_alias.c
140 static __inline__ u8
ipv6_addr_hash(struct in6_addr
*addr
)
145 * We perform the hash function over the last 64 bits of the address
146 * This will include the IEEE address token on links that support it.
149 word
= addr
->s6_addr
[2] ^ addr
->s6_addr32
[3];
153 return ((word
^ (word
>> 4)) & 0x0f);
157 * compute link-local solicited-node multicast address
160 extern __inline__
void addrconf_addr_solict_mult_old(struct in6_addr
*addr
,
161 struct in6_addr
*solicited
)
163 ipv6_addr_set(solicited
,
164 __constant_htonl(0xFF020000), 0,
165 __constant_htonl(0x1), addr
->s6_addr32
[3]);
168 extern __inline__
void addrconf_addr_solict_mult_new(struct in6_addr
*addr
,
169 struct in6_addr
*solicited
)
171 ipv6_addr_set(solicited
,
172 __constant_htonl(0xFF020000), 0,
173 __constant_htonl(0x1),
174 __constant_htonl(0xFF000000) | addr
->s6_addr32
[3]);
178 extern __inline__
void ipv6_addr_all_nodes(struct in6_addr
*addr
)
181 __constant_htonl(0xFF020000), 0, 0,
182 __constant_htonl(0x1));
185 extern __inline__
void ipv6_addr_all_routers(struct in6_addr
*addr
)
188 __constant_htonl(0xFF020000), 0, 0,
189 __constant_htonl(0x2));
192 extern __inline__
int ipv6_addr_is_multicast(struct in6_addr
*addr
)
194 return (addr
->s6_addr32
[0] & __constant_htonl(0xFF000000)) == __constant_htonl(0xFF000000);