aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2005-11-08 12:38:12 -0500
committerDavid S. Miller <davem@davemloft.net>2005-11-08 12:38:12 -0500
commitb1cacb6820e0afc4aeeea67bcb5296a316862cad (patch)
treee7a563d832dfb028b31492ec76054ca30c2c8878 /include
parent971f359ddcb2e7a0d577479c7561bda407febe1b (diff)
[IPV6]: Make ipv6_addr_type() more generic so that we can use it for source address selection.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/ipv6.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 98661fa4fc78..6addb4d464d6 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -252,12 +252,25 @@ typedef int (*inet_getfrag_t) (const void *data,
252 char *, 252 char *,
253 unsigned int, unsigned int); 253 unsigned int, unsigned int);
254 254
255 255extern int __ipv6_addr_type(const struct in6_addr *addr);
256extern int ipv6_addr_type(const struct in6_addr *addr); 256static inline int ipv6_addr_type(const struct in6_addr *addr)
257{
258 return __ipv6_addr_type(addr) & 0xffff;
259}
257 260
258static inline int ipv6_addr_scope(const struct in6_addr *addr) 261static inline int ipv6_addr_scope(const struct in6_addr *addr)
259{ 262{
260 return ipv6_addr_type(addr) & IPV6_ADDR_SCOPE_MASK; 263 return __ipv6_addr_type(addr) & IPV6_ADDR_SCOPE_MASK;
264}
265
266static inline int __ipv6_addr_src_scope(int type)
267{
268 return (type == IPV6_ADDR_ANY ? __IPV6_ADDR_SCOPE_INVALID : (type >> 16));
269}
270
271static inline int ipv6_addr_src_scope(const struct in6_addr *addr)
272{
273 return __ipv6_addr_src_scope(__ipv6_addr_type(addr));
261} 274}
262 275
263static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2) 276static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2)