devif/ipv6_input.c: fix compile warning

devif/ipv6_input.c: In function ‘ipv6_input’:
devif/ipv6_input.c:344:32: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
  344 |       if ((ipv6->destipaddr[0] & HTONS(0xff0f) != HTONS(0xff00)) &&
      |                                ^
devif/ipv6_input.c:345:32: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
  345 |           (ipv6->destipaddr[0] & HTONS(0xff0f) != HTONS(0xff01)) &&
      |                                ^
devif/ipv6_input.c:346:32: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
  346 |           (ipv6->destipaddr[0] & HTONS(0xff0f) != HTONS(0xff02)))
      |                                ^

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-02-18 12:34:20 +08:00 committed by Xiang Xiao
parent f073ed3a44
commit 61fa5d70f5

View File

@ -341,9 +341,9 @@ int ipv6_input(FAR struct net_driver_s *dev)
* ffx2 are interface-local, and therefore, should not be forwarded
*/
if ((ipv6->destipaddr[0] & HTONS(0xff0f) != HTONS(0xff00)) &&
(ipv6->destipaddr[0] & HTONS(0xff0f) != HTONS(0xff01)) &&
(ipv6->destipaddr[0] & HTONS(0xff0f) != HTONS(0xff02)))
if (((ipv6->destipaddr[0] & HTONS(0xff0f)) != HTONS(0xff00)) &&
((ipv6->destipaddr[0] & HTONS(0xff0f)) != HTONS(0xff01)) &&
((ipv6->destipaddr[0] & HTONS(0xff0f)) != HTONS(0xff02)))
{
/* Forward broadcast packets */