Revert 8532 "Ensure only temporary IPv6 address is selected as t..."

> Ensure only temporary IPv6 address is selected as the best IP.
> 
> The current logic of IPv6 selection could still have a small chance for non-temporary address to be selected for candidate. The scenario is that when there is no non-deprecated temporary IP, the global ones could be selected.
> 
> Global ones don't necessarily carry MAC. However, instead of comparing whether it has the MAC in it (sometimes 5 out of 6 elements from a MAC are the same, only one diffs), we should just err on the safe side.
> 
> BUG=4348
> R=juberti@webrtc.org, pthatcher@webrtc.org
> 
> Review URL: https://webrtc-codereview.appspot.com/38289004

TBR=guoweis@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#8534}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8534 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
aluebs@webrtc.org
2015-02-27 18:42:22 +00:00
parent 21ad37528e
commit 07dcf60ee0
3 changed files with 44 additions and 17 deletions

View File

@ -759,20 +759,18 @@ TEST_F(NetworkTest, TestIPv6Selection) {
ipv6_network.AddIP(ip);
EXPECT_EQ(ipv6_network.GetBestIP(), IPAddress());
// Add ULA one. ULA is the unique local address which starts with either 0xfc
// or 0xfd. Since it doesn't have the temporary address attribute, it'll be
// ignored.
// Add ULA one. ULA is unique local address which is starting either
// with 0xfc or 0xfd.
ipstr = "fd00:fa00:4:1000:be30:5bff:fee5:c4";
ASSERT_TRUE(IPFromString(ipstr, IPV6_ADDRESS_FLAG_NONE, &ip));
ipv6_network.AddIP(ip);
EXPECT_EQ(ipv6_network.GetBestIP(), IPAddress());
EXPECT_EQ(ipv6_network.GetBestIP(), static_cast<IPAddress>(ip));
// Add global one. Since it doesn't have the temporary address attribute,
// it'll be ignored.
// Add global one.
ipstr = "2401:fa00:4:1000:be30:5bff:fee5:c5";
ASSERT_TRUE(IPFromString(ipstr, IPV6_ADDRESS_FLAG_NONE, &ip));
ipv6_network.AddIP(ip);
EXPECT_EQ(ipv6_network.GetBestIP(), IPAddress());
EXPECT_EQ(ipv6_network.GetBestIP(), static_cast<IPAddress>(ip));
// Add global dynamic temporary one.
ipstr = "2401:fa00:4:1000:be30:5bff:fee5:c6";