mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-12 16:17:53 +00:00
Fix netbase tests
* Do not rely on "a.b.c" being interpreted as "a.0.b.c" * Parse numeric addresses for address families for which no device is configured
This commit is contained in:
parent
c5532e188e
commit
4c6b210af0
@ -65,19 +65,17 @@ bool static LookupIntern(const char *pszName, std::vector<CNetAddr>& vIP, unsign
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
# ifdef USE_IPV6
|
# ifdef USE_IPV6
|
||||||
aiHint.ai_family = AF_UNSPEC;
|
aiHint.ai_family = AF_UNSPEC;
|
||||||
aiHint.ai_flags = fAllowLookup ? 0 : AI_NUMERICHOST;
|
|
||||||
# else
|
# else
|
||||||
aiHint.ai_family = AF_INET;
|
aiHint.ai_family = AF_INET;
|
||||||
aiHint.ai_flags = fAllowLookup ? 0 : AI_NUMERICHOST;
|
|
||||||
# endif
|
# endif
|
||||||
|
aiHint.ai_flags = fAllowLookup ? 0 : AI_NUMERICHOST;
|
||||||
#else
|
#else
|
||||||
# ifdef USE_IPV6
|
# ifdef USE_IPV6
|
||||||
aiHint.ai_family = AF_UNSPEC;
|
aiHint.ai_family = AF_UNSPEC;
|
||||||
aiHint.ai_flags = AI_ADDRCONFIG | (fAllowLookup ? 0 : AI_NUMERICHOST);
|
|
||||||
# else
|
# else
|
||||||
aiHint.ai_family = AF_INET;
|
aiHint.ai_family = AF_INET;
|
||||||
aiHint.ai_flags = AI_ADDRCONFIG | (fAllowLookup ? 0 : AI_NUMERICHOST);
|
|
||||||
# endif
|
# endif
|
||||||
|
aiHint.ai_flags = fAllowLookup ? AI_ADDRCONFIG : AI_NUMERICHOST;
|
||||||
#endif
|
#endif
|
||||||
struct addrinfo *aiRes = NULL;
|
struct addrinfo *aiRes = NULL;
|
||||||
int nErr = getaddrinfo(pszName, NULL, &aiHint, &aiRes);
|
int nErr = getaddrinfo(pszName, NULL, &aiHint, &aiRes);
|
||||||
|
@ -86,7 +86,6 @@ BOOST_AUTO_TEST_CASE(netbase_lookupnumeric)
|
|||||||
BOOST_CHECK(TestParse("[::]:8333", "[::]:8333"));
|
BOOST_CHECK(TestParse("[::]:8333", "[::]:8333"));
|
||||||
BOOST_CHECK(TestParse("[127.0.0.1]", "127.0.0.1:65535"));
|
BOOST_CHECK(TestParse("[127.0.0.1]", "127.0.0.1:65535"));
|
||||||
BOOST_CHECK(TestParse(":::", ""));
|
BOOST_CHECK(TestParse(":::", ""));
|
||||||
BOOST_CHECK(TestParse("128.5.1", "128.5.0.1:65535"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
Loading…
Reference in New Issue
Block a user