diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/net/ipv6.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 988c9f28f0fc..42ef6abf25c3 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -320,6 +320,18 @@ static inline int ipv6_addr_src_scope(const struct in6_addr *addr) | |||
320 | return __ipv6_addr_src_scope(__ipv6_addr_type(addr)); | 320 | return __ipv6_addr_src_scope(__ipv6_addr_type(addr)); |
321 | } | 321 | } |
322 | 322 | ||
323 | static inline bool __ipv6_addr_needs_scope_id(int type) | ||
324 | { | ||
325 | return type & IPV6_ADDR_LINKLOCAL || | ||
326 | (type & IPV6_ADDR_MULTICAST && | ||
327 | (type & (IPV6_ADDR_LOOPBACK|IPV6_ADDR_LINKLOCAL))); | ||
328 | } | ||
329 | |||
330 | static inline __u32 ipv6_iface_scope_id(const struct in6_addr *addr, int iface) | ||
331 | { | ||
332 | return __ipv6_addr_needs_scope_id(__ipv6_addr_type(addr)) ? iface : 0; | ||
333 | } | ||
334 | |||
323 | static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2) | 335 | static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2) |
324 | { | 336 | { |
325 | return memcmp(a1, a2, sizeof(struct in6_addr)); | 337 | return memcmp(a1, a2, sizeof(struct in6_addr)); |