aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/addrconf.h
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-04-11 07:17:55 -0400
committerYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2008-04-12 00:43:14 -0400
commitfed85383ac34d82e96f227ce49ce68117cec23a0 (patch)
tree970dacedc8df29cf96511c0fc3e4bc1d103d3055 /include/net/addrconf.h
parentcaad295fed8b652c67159911d11c65d476351d2f (diff)
[IPV6]: Use XOR and OR rather than mutiple ands for ipv6 address comparisons.
ipv6_addr_equal(), ipv6_addr_v4mapped(), ipv6_addr_is_ll_all_{nodes,routers}(), ipv6_masked_addr_cmp() Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Diffstat (limited to 'include/net/addrconf.h')
-rw-r--r--include/net/addrconf.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index bdcc863a60a4..1dc9d03372d9 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -240,18 +240,16 @@ static inline int ipv6_addr_is_multicast(const struct in6_addr *addr)
240 240
241static inline int ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) 241static inline int ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr)
242{ 242{
243 return (addr->s6_addr32[0] == htonl(0xff020000) && 243 return (((addr->s6_addr32[0] ^ htonl(0xff020000)) |
244 addr->s6_addr32[1] == 0 && 244 addr->s6_addr32[1] | addr->s6_addr32[2] |
245 addr->s6_addr32[2] == 0 && 245 (addr->s6_addr32[3] ^ htonl(0x00000001))) == 0);
246 addr->s6_addr32[3] == htonl(0x00000001));
247} 246}
248 247
249static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) 248static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr)
250{ 249{
251 return (addr->s6_addr32[0] == htonl(0xff020000) && 250 return (((addr->s6_addr32[0] ^ htonl(0xff020000)) |
252 addr->s6_addr32[1] == 0 && 251 addr->s6_addr32[1] | addr->s6_addr32[2] |
253 addr->s6_addr32[2] == 0 && 252 (addr->s6_addr32[3] ^ htonl(0x00000002))) == 0);
254 addr->s6_addr32[3] == htonl(0x00000002));
255} 253}
256 254
257static inline int ipv6_isatap_eui64(u8 *eui, __be32 addr) 255static inline int ipv6_isatap_eui64(u8 *eui, __be32 addr)