Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Unified Diff: net/quic/quic_address_mismatch.cc

Issue 294823002: Treat IPv4-mapped IPv6 addresses as IPv4 addresses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Change histogram owners Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/quic/quic_address_mismatch_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_address_mismatch.cc
===================================================================
--- net/quic/quic_address_mismatch.cc (revision 271511)
+++ net/quic/quic_address_mismatch.cc (working copy)
@@ -14,9 +14,17 @@
if (first_address.address().empty() || second_address.address().empty()) {
return -1;
}
+ IPAddressNumber first_ip_address = first_address.address();
+ if (IsIPv4Mapped(first_ip_address)) {
+ first_ip_address = ConvertIPv4MappedToIPv4(first_ip_address);
+ }
+ IPAddressNumber second_ip_address = second_address.address();
+ if (IsIPv4Mapped(second_ip_address)) {
+ second_ip_address = ConvertIPv4MappedToIPv4(second_ip_address);
+ }
int sample;
- if (first_address.address() != second_address.address()) {
+ if (first_ip_address != second_ip_address) {
sample = QUIC_ADDRESS_MISMATCH_BASE;
} else if (first_address.port() != second_address.port()) {
sample = QUIC_PORT_MISMATCH_BASE;
@@ -29,8 +37,8 @@
// V6_V6: add 1
// V4_V6: add 2
// V6_V4: add 3
- bool first_ipv4 = (first_address.address().size() == kIPv4AddressSize);
- bool second_ipv4 = (second_address.address().size() == kIPv4AddressSize);
+ bool first_ipv4 = (first_ip_address.size() == kIPv4AddressSize);
+ bool second_ipv4 = (second_ip_address.size() == kIPv4AddressSize);
if (first_ipv4 != second_ipv4) {
CHECK_EQ(sample, QUIC_ADDRESS_MISMATCH_BASE);
sample += 2;
« no previous file with comments | « no previous file | net/quic/quic_address_mismatch_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698