diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-18 21:02:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-18 21:02:35 -0400 |
commit | 334d094504c2fe1c44211ecb49146ae6bca8c321 (patch) | |
tree | d3c0f68e4b9f8e3d2ccc39e7dfe5de0534a5fad9 /include/net/addrconf.h | |
parent | d1a4be630fb068f251d64b62919f143c49ca8057 (diff) | |
parent | d1643d24c61b725bef399cc1cf2944b4c9c23177 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.26
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.26: (1090 commits)
[NET]: Fix and allocate less memory for ->priv'less netdevices
[IPV6]: Fix dangling references on error in fib6_add().
[NETLABEL]: Fix NULL deref in netlbl_unlabel_staticlist_gen() if ifindex not found
[PKT_SCHED]: Fix datalen check in tcf_simp_init().
[INET]: Uninline the __inet_inherit_port call.
[INET]: Drop the inet_inherit_port() call.
SCTP: Initialize partial_bytes_acked to 0, when all of the data is acked.
[netdrvr] forcedeth: internal simplifications; changelog removal
phylib: factor out get_phy_id from within get_phy_device
PHY: add BCM5464 support to broadcom PHY driver
cxgb3: Fix __must_check warning with dev_dbg.
tc35815: Statistics cleanup
natsemi: fix MMIO for PPC 44x platforms
[TIPC]: Cleanup of TIPC reference table code
[TIPC]: Optimized initialization of TIPC reference table
[TIPC]: Remove inlining of reference table locking routines
e1000: convert uint16_t style integers to u16
ixgb: convert uint16_t style integers to u16
sb1000.c: make const arrays static
sb1000.c: stop inlining largish static functions
...
Diffstat (limited to 'include/net/addrconf.h')
-rw-r--r-- | include/net/addrconf.h | 122 |
1 files changed, 39 insertions, 83 deletions
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 496503c03846..0a2f0372df31 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
@@ -55,9 +55,12 @@ struct prefix_info { | |||
55 | extern int addrconf_init(void); | 55 | extern int addrconf_init(void); |
56 | extern void addrconf_cleanup(void); | 56 | extern void addrconf_cleanup(void); |
57 | 57 | ||
58 | extern int addrconf_add_ifaddr(void __user *arg); | 58 | extern int addrconf_add_ifaddr(struct net *net, |
59 | extern int addrconf_del_ifaddr(void __user *arg); | 59 | void __user *arg); |
60 | extern int addrconf_set_dstaddr(void __user *arg); | 60 | extern int addrconf_del_ifaddr(struct net *net, |
61 | void __user *arg); | ||
62 | extern int addrconf_set_dstaddr(struct net *net, | ||
63 | void __user *arg); | ||
61 | 64 | ||
62 | extern int ipv6_chk_addr(struct net *net, | 65 | extern int ipv6_chk_addr(struct net *net, |
63 | struct in6_addr *addr, | 66 | struct in6_addr *addr, |
@@ -68,16 +71,18 @@ extern int ipv6_chk_addr(struct net *net, | |||
68 | extern int ipv6_chk_home_addr(struct net *net, | 71 | extern int ipv6_chk_home_addr(struct net *net, |
69 | struct in6_addr *addr); | 72 | struct in6_addr *addr); |
70 | #endif | 73 | #endif |
74 | |||
75 | extern int ipv6_chk_prefix(struct in6_addr *addr, | ||
76 | struct net_device *dev); | ||
77 | |||
71 | extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, | 78 | extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, |
72 | struct in6_addr *addr, | 79 | const struct in6_addr *addr, |
73 | struct net_device *dev, | 80 | struct net_device *dev, |
74 | int strict); | 81 | int strict); |
75 | 82 | ||
76 | extern int ipv6_get_saddr(struct dst_entry *dst, | ||
77 | struct in6_addr *daddr, | ||
78 | struct in6_addr *saddr); | ||
79 | extern int ipv6_dev_get_saddr(struct net_device *dev, | 83 | extern int ipv6_dev_get_saddr(struct net_device *dev, |
80 | struct in6_addr *daddr, | 84 | const struct in6_addr *daddr, |
85 | unsigned int srcprefs, | ||
81 | struct in6_addr *saddr); | 86 | struct in6_addr *saddr); |
82 | extern int ipv6_get_lladdr(struct net_device *dev, | 87 | extern int ipv6_get_lladdr(struct net_device *dev, |
83 | struct in6_addr *addr, | 88 | struct in6_addr *addr, |
@@ -100,31 +105,31 @@ extern u32 ipv6_addr_label(const struct in6_addr *addr, | |||
100 | /* | 105 | /* |
101 | * multicast prototypes (mcast.c) | 106 | * multicast prototypes (mcast.c) |
102 | */ | 107 | */ |
103 | extern int ipv6_sock_mc_join(struct sock *sk, int ifindex, | 108 | extern int ipv6_sock_mc_join(struct sock *sk, int ifindex, |
104 | struct in6_addr *addr); | 109 | const struct in6_addr *addr); |
105 | extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex, | 110 | extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex, |
106 | struct in6_addr *addr); | 111 | const struct in6_addr *addr); |
107 | extern void ipv6_sock_mc_close(struct sock *sk); | 112 | extern void ipv6_sock_mc_close(struct sock *sk); |
108 | extern int inet6_mc_check(struct sock *sk, struct in6_addr *mc_addr, | 113 | extern int inet6_mc_check(struct sock *sk, |
109 | struct in6_addr *src_addr); | 114 | const struct in6_addr *mc_addr, |
115 | const struct in6_addr *src_addr); | ||
110 | 116 | ||
111 | extern int ipv6_dev_mc_inc(struct net_device *dev, struct in6_addr *addr); | 117 | extern int ipv6_dev_mc_inc(struct net_device *dev, const struct in6_addr *addr); |
112 | extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, struct in6_addr *addr); | 118 | extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr); |
113 | extern int ipv6_dev_mc_dec(struct net_device *dev, struct in6_addr *addr); | 119 | extern int ipv6_dev_mc_dec(struct net_device *dev, const struct in6_addr *addr); |
114 | extern void ipv6_mc_up(struct inet6_dev *idev); | 120 | extern void ipv6_mc_up(struct inet6_dev *idev); |
115 | extern void ipv6_mc_down(struct inet6_dev *idev); | 121 | extern void ipv6_mc_down(struct inet6_dev *idev); |
116 | extern void ipv6_mc_init_dev(struct inet6_dev *idev); | 122 | extern void ipv6_mc_init_dev(struct inet6_dev *idev); |
117 | extern void ipv6_mc_destroy_dev(struct inet6_dev *idev); | 123 | extern void ipv6_mc_destroy_dev(struct inet6_dev *idev); |
118 | extern void addrconf_dad_failure(struct inet6_ifaddr *ifp); | 124 | extern void addrconf_dad_failure(struct inet6_ifaddr *ifp); |
119 | 125 | ||
120 | extern int ipv6_chk_mcast_addr(struct net_device *dev, struct in6_addr *group, | 126 | extern int ipv6_chk_mcast_addr(struct net_device *dev, |
121 | struct in6_addr *src_addr); | 127 | const struct in6_addr *group, |
128 | const struct in6_addr *src_addr); | ||
122 | extern int ipv6_is_mld(struct sk_buff *skb, int nexthdr); | 129 | extern int ipv6_is_mld(struct sk_buff *skb, int nexthdr); |
123 | 130 | ||
124 | extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len); | 131 | extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len); |
125 | 132 | ||
126 | extern int ipv6_get_hoplimit(struct net_device *dev); | ||
127 | |||
128 | /* | 133 | /* |
129 | * anycast prototypes (anycast.c) | 134 | * anycast prototypes (anycast.c) |
130 | */ | 135 | */ |
@@ -135,7 +140,8 @@ extern int inet6_ac_check(struct sock *sk, struct in6_addr *addr, int ifindex); | |||
135 | 140 | ||
136 | extern int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr); | 141 | extern int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr); |
137 | extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr); | 142 | extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr); |
138 | extern int ipv6_chk_acast_addr(struct net_device *dev, struct in6_addr *addr); | 143 | extern int ipv6_chk_acast_addr(struct net *net, struct net_device *dev, |
144 | struct in6_addr *addr); | ||
139 | 145 | ||
140 | 146 | ||
141 | /* Device notifier */ | 147 | /* Device notifier */ |
@@ -185,26 +191,6 @@ static inline void in6_ifa_put(struct inet6_ifaddr *ifp) | |||
185 | #define in6_ifa_hold(ifp) atomic_inc(&(ifp)->refcnt) | 191 | #define in6_ifa_hold(ifp) atomic_inc(&(ifp)->refcnt) |
186 | 192 | ||
187 | 193 | ||
188 | extern void addrconf_forwarding_on(void); | ||
189 | /* | ||
190 | * Hash function taken from net_alias.c | ||
191 | */ | ||
192 | |||
193 | static __inline__ u8 ipv6_addr_hash(const struct in6_addr *addr) | ||
194 | { | ||
195 | __u32 word; | ||
196 | |||
197 | /* | ||
198 | * We perform the hash function over the last 64 bits of the address | ||
199 | * This will include the IEEE address token on links that support it. | ||
200 | */ | ||
201 | |||
202 | word = (__force u32)(addr->s6_addr32[2] ^ addr->s6_addr32[3]); | ||
203 | word ^= (word >> 16); | ||
204 | word ^= (word >> 8); | ||
205 | |||
206 | return ((word ^ (word >> 4)) & 0x0f); | ||
207 | } | ||
208 | 194 | ||
209 | /* | 195 | /* |
210 | * compute link-local solicited-node multicast address | 196 | * compute link-local solicited-node multicast address |
@@ -214,61 +200,31 @@ static inline void addrconf_addr_solict_mult(const struct in6_addr *addr, | |||
214 | struct in6_addr *solicited) | 200 | struct in6_addr *solicited) |
215 | { | 201 | { |
216 | ipv6_addr_set(solicited, | 202 | ipv6_addr_set(solicited, |
217 | __constant_htonl(0xFF020000), 0, | 203 | htonl(0xFF020000), 0, |
218 | __constant_htonl(0x1), | 204 | htonl(0x1), |
219 | __constant_htonl(0xFF000000) | addr->s6_addr32[3]); | 205 | htonl(0xFF000000) | addr->s6_addr32[3]); |
220 | } | ||
221 | |||
222 | |||
223 | static inline void ipv6_addr_all_nodes(struct in6_addr *addr) | ||
224 | { | ||
225 | ipv6_addr_set(addr, | ||
226 | __constant_htonl(0xFF020000), 0, 0, | ||
227 | __constant_htonl(0x1)); | ||
228 | } | ||
229 | |||
230 | static inline void ipv6_addr_all_routers(struct in6_addr *addr) | ||
231 | { | ||
232 | ipv6_addr_set(addr, | ||
233 | __constant_htonl(0xFF020000), 0, 0, | ||
234 | __constant_htonl(0x2)); | ||
235 | } | 206 | } |
236 | 207 | ||
237 | static inline int ipv6_addr_is_multicast(const struct in6_addr *addr) | 208 | static inline int ipv6_addr_is_multicast(const struct in6_addr *addr) |
238 | { | 209 | { |
239 | return (addr->s6_addr32[0] & __constant_htonl(0xFF000000)) == __constant_htonl(0xFF000000); | 210 | return (addr->s6_addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000); |
240 | } | 211 | } |
241 | 212 | ||
242 | static inline int ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) | 213 | static inline int ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) |
243 | { | 214 | { |
244 | return (addr->s6_addr32[0] == htonl(0xff020000) && | 215 | return (((addr->s6_addr32[0] ^ htonl(0xff020000)) | |
245 | addr->s6_addr32[1] == 0 && | 216 | addr->s6_addr32[1] | addr->s6_addr32[2] | |
246 | addr->s6_addr32[2] == 0 && | 217 | (addr->s6_addr32[3] ^ htonl(0x00000001))) == 0); |
247 | addr->s6_addr32[3] == htonl(0x00000001)); | ||
248 | } | 218 | } |
249 | 219 | ||
250 | static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) | 220 | static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) |
251 | { | 221 | { |
252 | return (addr->s6_addr32[0] == htonl(0xff020000) && | 222 | return (((addr->s6_addr32[0] ^ htonl(0xff020000)) | |
253 | addr->s6_addr32[1] == 0 && | 223 | addr->s6_addr32[1] | addr->s6_addr32[2] | |
254 | addr->s6_addr32[2] == 0 && | 224 | (addr->s6_addr32[3] ^ htonl(0x00000002))) == 0); |
255 | addr->s6_addr32[3] == htonl(0x00000002)); | ||
256 | } | 225 | } |
257 | 226 | ||
258 | static inline int ipv6_isatap_eui64(u8 *eui, __be32 addr) | 227 | extern int __ipv6_isatap_ifid(u8 *eui, __be32 addr); |
259 | { | ||
260 | eui[0] = (ipv4_is_zeronet(addr) || ipv4_is_private_10(addr) || | ||
261 | ipv4_is_loopback(addr) || ipv4_is_linklocal_169(addr) || | ||
262 | ipv4_is_private_172(addr) || ipv4_is_test_192(addr) || | ||
263 | ipv4_is_anycast_6to4(addr) || ipv4_is_private_192(addr) || | ||
264 | ipv4_is_test_198(addr) || ipv4_is_multicast(addr) || | ||
265 | ipv4_is_lbcast(addr)) ? 0x00 : 0x02; | ||
266 | eui[1] = 0; | ||
267 | eui[2] = 0x5E; | ||
268 | eui[3] = 0xFE; | ||
269 | memcpy (eui+4, &addr, 4); | ||
270 | return 0; | ||
271 | } | ||
272 | 228 | ||
273 | static inline int ipv6_addr_is_isatap(const struct in6_addr *addr) | 229 | static inline int ipv6_addr_is_isatap(const struct in6_addr *addr) |
274 | { | 230 | { |