summaryrefslogtreecommitdiff
path: root/ot_accesslist.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2024-03-29 03:58:23 +0100
committerDirk Engling <erdgeist@erdgeist.org>2024-03-29 03:58:23 +0100
commita3251ffac76ea1211d52b97ee232b8171a47c13d (patch)
tree758d4199adb06aa52a6dd3e855a80a4635eeddeb /ot_accesslist.c
parent5805fe5f864d1c56da7e214cc6d954af1b6198d4 (diff)
mask bits to be checked in ot_net
Diffstat (limited to 'ot_accesslist.c')
-rw-r--r--ot_accesslist.c4
1 files 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 ) {
385#endif 385#endif
386 386
387int address_in_net( const ot_ip6 address, const ot_net *net ) { 387int address_in_net( const ot_ip6 address, const ot_net *net ) {
388 int bits = net->bits; 388 int bits = net->bits, checkbits = ( 0x7f00 >> ( bits & 7 ));
389 int result = memcmp( address, &net->address, bits >> 3 ); 389 int result = memcmp( address, &net->address, bits >> 3 );
390 if( !result && ( bits & 7 ) ) 390 if( !result && ( bits & 7 ) )
391 result = ( ( 0x7f00 >> ( bits & 7 ) ) & address[bits>>3] ) - net->address[bits>>3]; 391 result = ( checkbits & address[bits>>3] ) - ( checkbits & net->address[bits>>3]);
392 return result == 0; 392 return result == 0;
393} 393}
394 394