Skip to content

Commit fc6cbc3

Browse files
committed
Merge #15689: netaddress: Update CNetAddr for ORCHIDv2
8be3f30 netaddress: Update CNetAddr for ORCHIDv2 (Carl Dong) Pull request description: ``` The original ORCHID prefix was deprecated as of 2014-03, the new ORCHIDv2 prefix was allocated by RFC7343 as of 2014-07. We did not consider the original ORCHID prefix routable, and I don't see any reason to consider the new one to be either. ``` Would like to know if people think this kind of thing is even worth keeping the codebase updated for. Perhaps it'd be nice to write a devtool to pull the csv from [here](https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml) and generate the code. ACKs for commit 8be3f3: laanwj: utACK 8be3f30 ryanofsky: utACK 8be3f30. Only change since last review is rebasing after #15718 merge. Tree-SHA512: 7c93317f597b1a6c1443e12dd690010392edb9d72a479a8201970db7d3444fbb99a80b98026caad6fbfbebb455ab4035d2dde79bc9263bfd1d0398cd218392e1
2 parents 03858b2 + 8be3f30 commit fc6cbc3

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/netaddress.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ bool CNetAddr::IsRFC4843() const
204204
return (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x00 && (GetByte(12) & 0xF0) == 0x10);
205205
}
206206

207+
bool CNetAddr::IsRFC7343() const
208+
{
209+
return (GetByte(15) == 0x20 && GetByte(14) == 0x01 && GetByte(13) == 0x00 && (GetByte(12) & 0xF0) == 0x20);
210+
}
211+
207212
/**
208213
* @returns Whether or not this is a dummy address that maps an onion address
209214
* into IPv6.
@@ -289,7 +294,7 @@ bool CNetAddr::IsValid() const
289294
*/
290295
bool CNetAddr::IsRoutable() const
291296
{
292-
return IsValid() && !(IsRFC1918() || IsRFC2544() || IsRFC3927() || IsRFC4862() || IsRFC6598() || IsRFC5737() || (IsRFC4193() && !IsTor()) || IsRFC4843() || IsLocal() || IsInternal());
297+
return IsValid() && !(IsRFC1918() || IsRFC2544() || IsRFC3927() || IsRFC4862() || IsRFC6598() || IsRFC5737() || (IsRFC4193() && !IsTor()) || IsRFC4843() || IsRFC7343() || IsLocal() || IsInternal());
293298
}
294299

295300
/**

src/netaddress.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ class CNetAddr
6363
bool IsRFC3964() const; // IPv6 6to4 tunnelling (2002::/16)
6464
bool IsRFC4193() const; // IPv6 unique local (FC00::/7)
6565
bool IsRFC4380() const; // IPv6 Teredo tunnelling (2001::/32)
66-
bool IsRFC4843() const; // IPv6 ORCHID (2001:10::/28)
66+
bool IsRFC4843() const; // IPv6 ORCHID (deprecated) (2001:10::/28)
67+
bool IsRFC7343() const; // IPv6 ORCHIDv2 (2001:20::/28)
6768
bool IsRFC4862() const; // IPv6 autoconfig (FE80::/64)
6869
bool IsRFC6052() const; // IPv6 well-known prefix for IPv4-embedded address (64:FF9B::/96)
6970
bool IsRFC6145() const; // IPv6 IPv4-translated address (::FFFF:0:0:0/96) (actually defined in RFC2765)

src/test/netbase_tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ BOOST_AUTO_TEST_CASE(netbase_properties)
5959
BOOST_CHECK(ResolveIP("FC00::").IsRFC4193());
6060
BOOST_CHECK(ResolveIP("2001::2").IsRFC4380());
6161
BOOST_CHECK(ResolveIP("2001:10::").IsRFC4843());
62+
BOOST_CHECK(ResolveIP("2001:20::").IsRFC7343());
6263
BOOST_CHECK(ResolveIP("FE80::").IsRFC4862());
6364
BOOST_CHECK(ResolveIP("64:FF9B::").IsRFC6052());
6465
BOOST_CHECK(ResolveIP("FD87:D87E:EB43:edb1:8e4:3588:e546:35ca").IsTor());

0 commit comments

Comments
 (0)