ip6: fix parentheses in ip6_addr_has_scope

Both of the multicast checks should be skipped if the address type
is unicast. This bug accidentally caused only one of them to be
skipped, resulting in some unnecessary performance overhead.

Reported by Axel Lin.
This commit is contained in:
David van Moolenbroek 2017-02-04 13:56:13 +00:00 committed by Dirk Ziegelmeier
parent f60a2e8f85
commit 2903b476c7

View File

@ -157,9 +157,9 @@
* @return 1 if the address has a constrained scope, 0 if it does not.
*/
#define ip6_addr_has_scope(ip6addr, type) \
(ip6_addr_islinklocal(ip6addr) || ((((type) != IP6_UNICAST) && \
ip6_addr_ismulticast_iflocal(ip6addr)) || \
ip6_addr_ismulticast_linklocal(ip6addr)))
(ip6_addr_islinklocal(ip6addr) || (((type) != IP6_UNICAST) && \
(ip6_addr_ismulticast_iflocal(ip6addr) || \
ip6_addr_ismulticast_linklocal(ip6addr))))
/**
* Assign a zone index to an IPv6 address, based on a network interface. If the