diff options
author | Dirk Engling <erdgeist@erdgeist.org> | 2024-03-29 03:58:23 +0100 |
---|---|---|
committer | Dirk Engling <erdgeist@erdgeist.org> | 2024-03-29 03:58:23 +0100 |
commit | a3251ffac76ea1211d52b97ee232b8171a47c13d (patch) | |
tree | 758d4199adb06aa52a6dd3e855a80a4635eeddeb | |
parent | 5805fe5f864d1c56da7e214cc6d954af1b6198d4 (diff) |
mask bits to be checked in ot_net
-rw-r--r-- | ot_accesslist.c | 4 |
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 | ||
387 | int address_in_net( const ot_ip6 address, const ot_net *net ) { | 387 | int 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 | ||