-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tim Cooper
committed
Dec 13, 2023
1 parent
6579be8
commit 1006025
Showing
2 changed files
with
21 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I don't think that this will work correctly. Let's have following IPv6 with prefix:
2001:1530:100e::/47
.bit
value will be 7octet
(in the first iteration) will be 5ip[octet]&(1<<(7-bit)) == ip[5]&(1<<(7-7)) == 0xe&1 != 0
From my point of view the original code was almost correct. You just need to iterate over rest of bytes to zero them.
Please correct me if I'm wrong.