diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2005-11-08 12:38:12 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-11-08 12:38:12 -0500 |
commit | b1cacb6820e0afc4aeeea67bcb5296a316862cad (patch) | |
tree | e7a563d832dfb028b31492ec76054ca30c2c8878 /include/net/ipv6.h | |
parent | 971f359ddcb2e7a0d577479c7561bda407febe1b (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/net/ipv6.h')
-rw-r--r-- | include/net/ipv6.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 98661fa4fc7..6addb4d464d 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 | 255 | extern int __ipv6_addr_type(const struct in6_addr *addr); | |
256 | extern int ipv6_addr_type(const struct in6_addr *addr); | 256 | static inline int ipv6_addr_type(const struct in6_addr *addr) |
257 | { | ||
258 | return __ipv6_addr_type(addr) & 0xffff; | ||
259 | } | ||
257 | 260 | ||
258 | static inline int ipv6_addr_scope(const struct in6_addr *addr) | 261 | static 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 | |||
266 | static inline int __ipv6_addr_src_scope(int type) | ||
267 | { | ||
268 | return (type == IPV6_ADDR_ANY ? __IPV6_ADDR_SCOPE_INVALID : (type >> 16)); | ||
269 | } | ||
270 | |||
271 | static 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 | ||
263 | static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2) | 276 | static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2) |