mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
ipv6: introdcue __ipv6_addr_needs_scope_id and ipv6_iface_scope_id helper functions
[msm/android-3.4 commit 2c75b248e5243d0af7cc97522148db7415a70f8a] __ipv6_addr_needs_scope_id checks if an ipv6 address needs to supply a 'sin6_scope_id != 0'. 'sin6_scope_id != 0' was enforced in case of link-local addresses. To support interface-local multicast these checks had to be enhanced and are now consolidated into these new helper functions. v2: a) migrated to struct ipv6_addr_props v3: a) reverted changes for ipv6_addr_props b) test for address type instead of comparing scope v4: a) unchanged Bug: 9469865 Change-Id: Ib2ac81050a001c5a370198b34c8973dfd86439dd Suggested-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Lorenzo Colitti <lorenzo@google.com>
This commit is contained in:
parent
4f9f2034ed
commit
a2fc0f19be
1 changed files with 12 additions and 0 deletions
|
@ -294,6 +294,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));
|
||||
|
|
Loading…
Reference in a new issue