From a3251ffac76ea1211d52b97ee232b8171a47c13d Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Fri, 29 Mar 2024 03:58:23 +0100 Subject: mask bits to be checked in ot_net --- ot_accesslist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ot_accesslist.c b/ot_accesslist.c index 181c8f0..1badc25 100644 --- a/ot_accesslist.c +++ b/ot_accesslist.c @@ -385,10 +385,10 @@ void accesslist_cleanup( void ) { #endif int address_in_net( const ot_ip6 address, const ot_net *net ) { - int bits = net->bits; + int bits = net->bits, checkbits = ( 0x7f00 >> ( bits & 7 )); int result = memcmp( address, &net->address, bits >> 3 ); if( !result && ( bits & 7 ) ) - result = ( ( 0x7f00 >> ( bits & 7 ) ) & address[bits>>3] ) - net->address[bits>>3]; + result = ( checkbits & address[bits>>3] ) - ( checkbits & net->address[bits>>3]); return result == 0; } -- cgit v1.2.3