diff --git a/doc/api/net.md b/doc/api/net.md index 81a25eee0f1b..fcc85d1c0de9 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -259,11 +259,15 @@ The included ranges are: * `10.0.0.0/8` — RFC 1918 private IPv4 * `172.16.0.0/12` — RFC 1918 private IPv4 * `192.168.0.0/16` — RFC 1918 private IPv4 +* `0.0.0.0/8` — IPv4 "this" network / unspecified (common localhost alias) * `127.0.0.0/8` — IPv4 loopback * `::1/128` — IPv6 loopback +* `::/128` — IPv6 unspecified * `169.254.0.0/16` — IPv4 link-local * `fe80::/10` — IPv6 link-local * `fc00::/7` — IPv6 unique local (ULA) +* `100.64.0.0/10` — RFC 6598 shared address space (CGNAT) +* `198.18.0.0/15` — RFC 2544 benchmarking methodology ```js const blockList = new net.BlockList(); diff --git a/lib/internal/blocklist.js b/lib/internal/blocklist.js index f290c7ada405..4a0b269e25e6 100644 --- a/lib/internal/blocklist.js +++ b/lib/internal/blocklist.js @@ -85,14 +85,22 @@ class BlockList { '10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16', + // "This" network / IPv4 unspecified (often treated as localhost alias) + '0.0.0.0/8', // Loopback '127.0.0.0/8', '::1/128', + // IPv6 unspecified + '::/128', // Link-local '169.254.0.0/16', 'fe80::/10', // Unique local (ULA) 'fc00::/7', + // RFC 6598 - Shared Address Space / Carrier-Grade NAT + '100.64.0.0/10', + // RFC 2544 - Benchmarking Methodology (commonly non-routable lab space) + '198.18.0.0/15', ]); [kInspect](depth, options) { diff --git a/test/parallel/test-blocklist.js b/test/parallel/test-blocklist.js index 08a293bb6a81..ea65f5f736a0 100644 --- a/test/parallel/test-blocklist.js +++ b/test/parallel/test-blocklist.js @@ -814,6 +814,13 @@ const util = require('util'); assert(blockList.check('127.255.255.255')); assert(blockList.check('::1', 'ipv6')); + // IPv4 "this" network / unspecified (alternate localhost spellings) + assert(blockList.check('0.0.0.0')); + assert(blockList.check('0.0.0.1')); + + // IPv6 unspecified + assert(blockList.check('::', 'ipv6')); + // Link-local assert(blockList.check('169.254.0.1')); assert(blockList.check('fe80::1', 'ipv6')); @@ -822,6 +829,12 @@ const util = require('util'); assert(blockList.check('fc00::1', 'ipv6')); assert(blockList.check('fd00::1', 'ipv6')); + // CGNAT (RFC 6598) and benchmarking (RFC 2544) + assert(blockList.check('100.64.0.1')); + assert(blockList.check('100.127.255.255')); + assert(blockList.check('198.18.0.1')); + assert(blockList.check('198.19.255.255')); + // Public addresses should not match assert(!blockList.check('8.8.8.8')); assert(!blockList.check('1.1.1.1'));