Skip to content

Commit 9d92b49

Browse files
committed
Simplify IPv6 reserved ranges.
1 parent 219ba9c commit 9d92b49

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎tdutils/td/utils/port/IPAddress.cpp‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,14 @@ bool IPAddress::is_reserved() const {
299299
size_t bit_count;
300300
};
301301

302-
// globally reachable addresses from reserved blocks
302+
// globally reachable addresses from reserved blocks;
303+
// 2001:1::2/127 combines 2001:1::2/128 and 2001:1::3/128, 2001:20::/27 combines 2001:20::/28 and 2001:30::/28
303304
static const Ipv6Block global_blocks[] = {
304305
{{0x20, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}, 128},
305-
{{0x20, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, 128},
306-
{{0x20, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03}, 128},
306+
{{0x20, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}, 127},
307307
{{0x20, 0x01, 0x00, 0x03}, 32},
308308
{{0x20, 0x01, 0x00, 0x04, 0x01, 0x12}, 48},
309-
{{0x20, 0x01, 0x00, 0x20}, 28},
310-
{{0x20, 0x01, 0x00, 0x30}, 28}};
309+
{{0x20, 0x01, 0x00, 0x20}, 27}};
311310
for (auto &block : global_blocks) {
312311
if (begins_with_bits(addr, block.prefix, block.bit_count)) {
313312
return false;

0 commit comments

Comments
 (0)