merged RC_1_1 into master

This commit is contained in:
arvidn 2017-08-19 23:30:13 +02:00
commit 58f91e67fb
2 changed files with 54 additions and 7 deletions

View File

@ -77,6 +77,7 @@
* resume data no longer has timestamps of files
* require C++11 to build libtorrent
* fix IPv6 tracker support by performing the second announce in more cases
* fix utf-8 encoding check in torrent parser
* fix infinite loop when parsing maliciously crafted torrents
* fix invalid read in parse_int in bdecoder

View File

@ -304,9 +304,10 @@ void on_alert_notify(lt::session* ses)
});
}
// this test makes sure that a tracker whose host name resolves to both IPv6 and
// IPv4 addresses will be announced to twice, once for each address family
TORRENT_TEST(ipv6_support)
static const int num_interfaces = 3;
void test_ipv6_support(char const* listen_interfaces
, int const expect_v4, int const expect_v6)
{
using sim::asio::ip::address_v4;
sim_config network_cfg;
@ -346,8 +347,6 @@ TORRENT_TEST(ipv6_support)
return sim::send_response(200, "OK", size) + response;
});
static const int num_interfaces = 3;
{
lt::session_proxy zombie;
@ -364,6 +363,10 @@ TORRENT_TEST(ipv6_support)
asio::io_service ios(sim, ips);
lt::settings_pack sett = settings();
if (listen_interfaces)
{
sett.set_str(settings_pack::listen_interfaces, listen_interfaces);
}
std::unique_ptr<lt::session> ses(new lt::session(sett, ios));
ses->set_alert_notify(std::bind(&on_alert_notify, ses.get()));
@ -399,10 +402,53 @@ TORRENT_TEST(ipv6_support)
sim.run();
}
TEST_EQUAL(v4_announces, expect_v4);
TEST_EQUAL(v6_announces, expect_v6);
}
// this test makes sure that a tracker whose host name resolves to both IPv6 and
// IPv4 addresses will be announced to twice, once for each address family
TORRENT_TEST(ipv6_support)
{
// null means default
test_ipv6_support(nullptr, 2, num_interfaces * 2);
}
TORRENT_TEST(ipv6_support_bind_v4_v6_any)
{
// 2 because there's one announce on startup and one when shutting down
TEST_EQUAL(v4_announces, 2);
// IPv6 will send announces for each interface
TEST_EQUAL(v6_announces, num_interfaces * 2);
test_ipv6_support("0.0.0.0:6881,[::0]:6881", 2, num_interfaces * 2);
}
TORRENT_TEST(ipv6_support_bind_v6_any)
{
test_ipv6_support("[::0]:6881", 0, num_interfaces * 2);
}
TORRENT_TEST(ipv6_support_bind_v4)
{
test_ipv6_support("10.0.0.3:6881", 2, 0);
}
TORRENT_TEST(ipv6_support_bind_v6)
{
test_ipv6_support("[ffff::1337:1]:6881", 0, 2);
}
TORRENT_TEST(ipv6_support_bind_v6_3interfaces)
{
test_ipv6_support("[ffff::1337:1]:6881,[ffff::1337:2]:6881,[ffff::1337:3]:6881", 0, 3 * 2);
}
TORRENT_TEST(ipv6_support_bind_v4_v6)
{
test_ipv6_support("10.0.0.3:6881,[ffff::1337:1]:6881", 2, 2);
}
TORRENT_TEST(ipv6_support_bind_v6_v4)
{
test_ipv6_support("[ffff::1337:1]:6881,10.0.0.3:6881", 2, 2);
}
// this runs a simulation of a torrent with tracker(s), making sure the request