diff options
author | Wladimir J. van der Laan <laanwj@protonmail.com> | 2019-12-17 16:15:18 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@protonmail.com> | 2019-12-17 16:19:29 +0100 |
commit | 7df6a7ea98121997af2dcc57a69046ae252a9ec6 (patch) | |
tree | c6a64cc404a115e3be6aa073d32afbdcdbd117b9 | |
parent | 03dfa36641077033ffebf8b431945bfc503632a9 (diff) | |
parent | 529d332fbfe633d60845a97e1a06f552bd63d0d4 (diff) |
Merge #17758: Fix CNetAddr::IsRFC2544 comment + tests
529d332fbfe633d60845a97e1a06f552bd63d0d4 test: add IsRFC2544 tests (Mark Tyneway)
419ef3b7cc04e3ab26252d7024da847dfd5ab1a3 CNetAddr: fix IsRFC2544 comment (Mark Tyneway)
Pull request description:
The comment describing the functionality of `CNetAddr::IsRFC2544` is incorrect.
https://github.com/bitcoin/bitcoin/blob/46d6930f8c7ba7cbcd7d86dd5d0117642fcbc819/src/netaddress.h#L57
It should actually read `198.18.0.0/15` based on [RFC 3330](https://tools.ietf.org/html/rfc3330):
```
198.18.0.0/15 - This block has been allocated for use in benchmark
tests of network interconnect devices. Its use is documented in
[RFC2544].
```
See [RFC 2544](https://tools.ietf.org/html/rfc2544) here.
See the implementation here:
https://github.com/bitcoin/bitcoin/blob/47d981e8273804a040d71665a4cb16038d6717e1/src/netaddress.cpp#L142-L145
This PR also adds tests for the minimum and maximum values that are valid RFC 2544 addresses.
ACKs for top commit:
practicalswift:
ACK 529d332fbfe633d60845a97e1a06f552bd63d0d4
laanwj:
ACK 529d332fbfe633d60845a97e1a06f552bd63d0d4
promag:
ACK 529d332fbfe633d60845a97e1a06f552bd63d0d4, nit could squash.
jonatack:
ACK 529d332fbfe633d60845a97e1a06f552bd63d0d4
Tree-SHA512: 954a9582856d77564e0ea5fd2e3d287d0cfc4ecfe0588115692d01005e8ca7ad8ab20ff390ded867dc91af2bfb758d4e73a336e6c0b7798846c30a6d69b8ae3d
-rw-r--r-- | src/netaddress.h | 2 | ||||
-rw-r--r-- | src/test/netbase_tests.cpp | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/netaddress.h b/src/netaddress.h index fbb1553338..32f4476fac 100644 --- a/src/netaddress.h +++ b/src/netaddress.h @@ -54,7 +54,7 @@ class CNetAddr bool IsIPv4() const; // IPv4 mapped address (::FFFF:0:0/96, 0.0.0.0/0) bool IsIPv6() const; // IPv6 address (not mapped IPv4, not Tor) bool IsRFC1918() const; // IPv4 private networks (10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12) - bool IsRFC2544() const; // IPv4 inter-network communications (192.18.0.0/15) + bool IsRFC2544() const; // IPv4 inter-network communications (198.18.0.0/15) bool IsRFC6598() const; // IPv4 ISP-level NAT (100.64.0.0/10) bool IsRFC5737() const; // IPv4 documentation addresses (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24) bool IsRFC3849() const; // IPv6 documentation address (2001:0DB8::/32) diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp index 78c11ff202..481dedc356 100644 --- a/src/test/netbase_tests.cpp +++ b/src/test/netbase_tests.cpp @@ -54,6 +54,8 @@ BOOST_AUTO_TEST_CASE(netbase_properties) BOOST_CHECK(ResolveIP("10.0.0.1").IsRFC1918()); BOOST_CHECK(ResolveIP("192.168.1.1").IsRFC1918()); BOOST_CHECK(ResolveIP("172.31.255.255").IsRFC1918()); + BOOST_CHECK(ResolveIP("198.18.0.0").IsRFC2544()); + BOOST_CHECK(ResolveIP("198.19.255.255").IsRFC2544()); BOOST_CHECK(ResolveIP("2001:0DB8::").IsRFC3849()); BOOST_CHECK(ResolveIP("169.254.1.1").IsRFC3927()); BOOST_CHECK(ResolveIP("2002::1").IsRFC3964()); |