Relanding: Move "max IPv6 networks" logic to BasicPortAllocator, and fix sorting.
Relanding because the broken chromium test has been fixed:
https://chromium-review.googlesource.com/582196
This CL moves the responsibility for restricting the number of IPv6
interfaces used for ICE to BasicPortAllocator. This is the right place
to do it in the first place; it's where all the rest of the filtering
occurs. And NetworkManager shouldn't need to know about ICE limitations;
only the ICE classes should.
Part of the reason I'm doing this is that I want to add a
"max_ipv6_networks" API to RTCConfiguration, so that applications can
override the default easily (see linked bug). But that means that
PeerConnection would need to be able to call "set_max_ipv6_networks" on
the underlying object that does the filtering, and that method isn't
available on the "NetworkManager" base class. So rather than adding
another method to a place it doesn't belong, I'm moving it to the place
it does belong.
In the process, I noticed that "CompareNetworks" is inconsistent with
"SortNetworks"; the former orders interfaces alphabetically, and the
latter reverse-alphabetically. I believe this was unintentional, and
results in undesirable behavior (like "eth1" being preferred over
"eth0"), so I'm fixing it and adding a test.
BUG=webrtc:7703
Review-Url: https://codereview.webrtc.org/2983213002
Cr-Original-Commit-Position: refs/heads/master@{#19112}
Committed: https://chromium.googlesource.com/external/webrtc/+/ad9561404c0cc007574eaedade581928aa3d24ef
Review-Url: https://codereview.webrtc.org/2983213002
Cr-Commit-Position: refs/heads/master@{#19159}
diff --git a/webrtc/rtc_base/network.h b/webrtc/rtc_base/network.h
index 4cbbfef..ceb96c4 100644
--- a/webrtc/rtc_base/network.h
+++ b/webrtc/rtc_base/network.h
@@ -147,13 +147,13 @@
void GetNetworks(NetworkList* networks) const override;
void GetAnyAddressNetworks(NetworkList* networks) override;
+
// Defaults to true.
+ // TODO(deadbeef): Remove this. Nothing but tests use this; IPv6 is enabled
+ // by default everywhere else.
bool ipv6_enabled() const { return ipv6_enabled_; }
void set_ipv6_enabled(bool enabled) { ipv6_enabled_ = enabled; }
- void set_max_ipv6_networks(int networks) { max_ipv6_networks_ = networks; }
- int max_ipv6_networks() { return max_ipv6_networks_; }
-
EnumerationPermission enumeration_permission() const override;
bool GetDefaultLocalAddress(int family, IPAddress* ipaddr) const override;
@@ -187,7 +187,6 @@
EnumerationPermission enumeration_permission_;
NetworkList networks_;
- int max_ipv6_networks_;
NetworkMap networks_map_;
bool ipv6_enabled_;