Turn on IPv6 for WebRTC as default as required before ramping the experiment to 30%.

BUG=
R=juberti@webrtc.org

Committed: https://code.google.com/p/webrtc/source/detail?r=8582

Review URL: https://webrtc-codereview.appspot.com/43529004

Cr-Commit-Position: refs/heads/master@{#8607}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8607 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
guoweis@webrtc.org 2015-03-05 03:40:08 +00:00
parent 4536289353
commit 86c33e3a94
5 changed files with 23 additions and 8 deletions

View File

@ -341,17 +341,18 @@ bool PeerConnection::Initialize(
int portallocator_flags = port_allocator_->flags();
portallocator_flags |= cricket::PORTALLOCATOR_ENABLE_BUNDLE |
cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG |
cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET;
cricket::PORTALLOCATOR_ENABLE_SHARED_SOCKET |
cricket::PORTALLOCATOR_ENABLE_IPV6;
bool value;
// If IPv6 flag was specified, we'll not override it by experiment.
if (FindConstraint(
constraints, MediaConstraintsInterface::kEnableIPv6, &value, NULL)) {
if (value) {
portallocator_flags |= cricket::PORTALLOCATOR_ENABLE_IPV6;
if (!value) {
portallocator_flags &= ~(cricket::PORTALLOCATOR_ENABLE_IPV6);
}
} else if (webrtc::field_trial::FindFullName("WebRTC-IPv6Default") ==
"Enabled") {
portallocator_flags |= cricket::PORTALLOCATOR_ENABLE_IPV6;
"Disabled") {
portallocator_flags &= ~(cricket::PORTALLOCATOR_ENABLE_IPV6);
}
port_allocator_->set_flags(portallocator_flags);

View File

@ -432,6 +432,12 @@ bool IPIs6To4(const IPAddress& ip) {
return IPIsHelper(ip, k6To4Prefix, 16);
}
bool IPIsLinkLocal(const IPAddress& ip) {
// Can't use the helper because the prefix is 10 bits.
in6_addr addr = ip.ipv6_address();
return addr.s6_addr[0] == 0xFE && (addr.s6_addr[1] & 0x80) == 0x80;
}
bool IPIsSiteLocal(const IPAddress& ip) {
// Can't use the helper because the prefix is 10 bits.
in6_addr addr = ip.ipv6_address();

View File

@ -162,6 +162,7 @@ size_t HashIP(const IPAddress& ip);
// These are only really applicable for IPv6 addresses.
bool IPIs6Bone(const IPAddress& ip);
bool IPIs6To4(const IPAddress& ip);
bool IPIsLinkLocal(const IPAddress& ip);
bool IPIsSiteLocal(const IPAddress& ip);
bool IPIsTeredo(const IPAddress& ip);
bool IPIsULA(const IPAddress& ip);

View File

@ -601,6 +601,13 @@ bool BasicNetworkManager::IsIgnoredNetwork(const Network& network) const {
if (network.prefix().family() == AF_INET) {
return (network.prefix().v4AddressAsHostOrderInteger() < 0x01000000);
}
// Linklocal addresses require scope id to be bound successfully. However, our
// IPAddress structure doesn't carry that so the information is lost and
// causes binding failure.
if (IPIsLinkLocal(network.GetBestIP())) {
return true;
}
return false;
}

View File

@ -285,13 +285,13 @@ TEST_F(NetworkTest, TestBasicMergeNetworkList) {
void SetupNetworks(NetworkManager::NetworkList* list) {
IPAddress ip;
IPAddress prefix;
EXPECT_TRUE(IPFromString("fe80::1234:5678:abcd:ef12", &ip));
EXPECT_TRUE(IPFromString("fe80::", &prefix));
EXPECT_TRUE(IPFromString("abcd::1234:5678:abcd:ef12", &ip));
EXPECT_TRUE(IPFromString("abcd::", &prefix));
// First, fake link-locals.
Network ipv6_eth0_linklocalnetwork("test_eth0", "Test NetworkAdapter 1",
prefix, 64);
ipv6_eth0_linklocalnetwork.AddIP(ip);
EXPECT_TRUE(IPFromString("fe80::5678:abcd:ef12:3456", &ip));
EXPECT_TRUE(IPFromString("abcd::5678:abcd:ef12:3456", &ip));
Network ipv6_eth1_linklocalnetwork("test_eth1", "Test NetworkAdapter 2",
prefix, 64);
ipv6_eth1_linklocalnetwork.AddIP(ip);