aboutsummaryrefslogtreecommitdiff
path: root/src/test/netbase_tests.cpp
diff options
context:
space:
mode:
authorCory Fields <[email protected]>2017-06-13 17:26:50 -0400
committerCory Fields <[email protected]>2017-06-14 18:05:01 -0400
commit6d0bd5b73d14517b349bb07656a18b2acb0d5c45 (patch)
tree4c56c39f5d71719016ac84929cb41fc31d380333 /src/test/netbase_tests.cpp
parentnet: add an internal subnet for representing unresolved hostnames (diff)
downloaddiscoin-6d0bd5b73d14517b349bb07656a18b2acb0d5c45.tar.xz
discoin-6d0bd5b73d14517b349bb07656a18b2acb0d5c45.zip
net: do not allow resolving to an internal address
In order to prevent mixups, our internal range is never allowed as a resolve result. This means that no user-provided string will ever be confused with an internal address.
Diffstat (limited to 'src/test/netbase_tests.cpp')
-rw-r--r--src/test/netbase_tests.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/netbase_tests.cpp b/src/test/netbase_tests.cpp
index 94a3dac4b..b45a7fcc5 100644
--- a/src/test/netbase_tests.cpp
+++ b/src/test/netbase_tests.cpp
@@ -113,6 +113,11 @@ BOOST_AUTO_TEST_CASE(netbase_lookupnumeric)
BOOST_CHECK(TestParse("[::]:8333", "[::]:8333"));
BOOST_CHECK(TestParse("[127.0.0.1]", "127.0.0.1:65535"));
BOOST_CHECK(TestParse(":::", "[::]:0"));
+
+ // verify that an internal address fails to resolve
+ BOOST_CHECK(TestParse("[fd6b:88c0:8724:1:2:3:4:5]", "[::]:0"));
+ // and that a one-off resolves correctly
+ BOOST_CHECK(TestParse("[fd6c:88c0:8724:1:2:3:4:5]", "[fd6c:88c0:8724:1:2:3:4:5]:65535"));
}
BOOST_AUTO_TEST_CASE(onioncat_test)