Commit 0eaae8dc authored by Hideaki Yoshifuji's avatar Hideaki Yoshifuji

[IPV6] introduce lightweight IPv6 address comparison function.

It is not optimal to use ipv6_addr_cmp() for simple address
comparison, which checks if two addresses are equal.
Based on idea from Dave Craig <dwcraig@qualcomm.com>.
Signed-off-by: default avatarHideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
parent 75fa5440
...@@ -296,6 +296,15 @@ static inline void ipv6_addr_set(struct in6_addr *addr, ...@@ -296,6 +296,15 @@ static inline void ipv6_addr_set(struct in6_addr *addr,
} }
#endif #endif
static inline int ipv6_addr_equal(const struct in6_addr *a1,
const struct in6_addr *a2)
{
return (a1->s6_addr32[0] == a2->s6_addr32[0] &&
a1->s6_addr32[1] == a2->s6_addr32[1] &&
a1->s6_addr32[2] == a2->s6_addr32[2] &&
a1->s6_addr32[3] == a2->s6_addr32[3]);
}
static inline int ipv6_addr_any(const struct in6_addr *a) static inline int ipv6_addr_any(const struct in6_addr *a)
{ {
return ((a->s6_addr32[0] | a->s6_addr32[1] | return ((a->s6_addr32[0] | a->s6_addr32[1] |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment