From c9b4f2285f0ca86577af271b0901823e669a575b Mon Sep 17 00:00:00 2001 From: Hannes Frederic Sowa Date: Fri, 8 Mar 2013 02:07:16 +0000 Subject: [PATCH] --- yaml --- r: 368151 b: refs/heads/master c: b7ef213ef65256168df83ddfbb8131ed9adc10f9 h: refs/heads/master i: 368149: 474b613d2a91ff6eed6cbf1a461231830fe77c38 368147: e4b11325148a0e806a7c0e09ac6a2b2254659cad 368143: 3df40c44f8b47c5247755fcea697b0982ea7316b v: v3 --- [refs] | 2 +- trunk/include/net/ipv6.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 5ab0b9249105..ffc5d2badd98 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 80580d4b20e13383009b4fb2043235a7d0a42589 +refs/heads/master: b7ef213ef65256168df83ddfbb8131ed9adc10f9 diff --git a/trunk/include/net/ipv6.h b/trunk/include/net/ipv6.h index 988c9f28f0fc..42ef6abf25c3 100644 --- a/trunk/include/net/ipv6.h +++ b/trunk/include/net/ipv6.h @@ -320,6 +320,18 @@ static inline int ipv6_addr_src_scope(const struct in6_addr *addr) return __ipv6_addr_src_scope(__ipv6_addr_type(addr)); } +static inline bool __ipv6_addr_needs_scope_id(int type) +{ + return type & IPV6_ADDR_LINKLOCAL || + (type & IPV6_ADDR_MULTICAST && + (type & (IPV6_ADDR_LOOPBACK|IPV6_ADDR_LINKLOCAL))); +} + +static inline __u32 ipv6_iface_scope_id(const struct in6_addr *addr, int iface) +{ + return __ipv6_addr_needs_scope_id(__ipv6_addr_type(addr)) ? iface : 0; +} + static inline int ipv6_addr_cmp(const struct in6_addr *a1, const struct in6_addr *a2) { return memcmp(a1, a2, sizeof(struct in6_addr));