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

Unified Diff: remoting/host/it2me/it2me_host.cc

Issue 2901033002: Host port range policy is no longer ignored in it2me host (Closed)
Patch Set: Host port range policy is no longer ignored in it2me host Created 3 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 | « remoting/host/it2me/it2me_host.h ('k') | remoting/host/it2me/it2me_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/it2me/it2me_host.cc
diff --git a/remoting/host/it2me/it2me_host.cc b/remoting/host/it2me/it2me_host.cc
index 17e7143541fc2d8f58256a01957bdd7da893b722..42345ec07e5ef2cddb3dd7dd29953fcc295fb592 100644
--- a/remoting/host/it2me/it2me_host.cc
+++ b/remoting/host/it2me/it2me_host.cc
@@ -191,12 +191,14 @@ void It2MeHost::FinishConnect() {
// Beyond this point nothing can fail, so save the config and request.
register_request_ = std::move(register_request);
- // If NAT traversal is off then limit port range to allow firewall pin-holing.
- HOST_LOG << "NAT state: " << nat_traversal_enabled_;
protocol::NetworkSettings network_settings(
nat_traversal_enabled_ ?
protocol::NetworkSettings::NAT_TRAVERSAL_FULL :
protocol::NetworkSettings::NAT_TRAVERSAL_DISABLED);
+ network_settings.port_range = udp_port_range_;
+
+ // If NAT traversal is off then limit port range to allow firewall pin-holing.
+ HOST_LOG << "NAT state: " << nat_traversal_enabled_;
if (!nat_traversal_enabled_) {
network_settings.port_range.min_port =
Sergey Ulanov 2017/05/25 22:24:38 Setting port range here makes sense only if it isn
Gus Smith 2017/05/25 22:55:58 Done. I don't think I fully understand what should
Sergey Ulanov 2017/05/26 00:40:08 If an admin disables NAT traversal then they also
protocol::NetworkSettings::kDefaultMinPort;
@@ -330,6 +332,12 @@ void It2MeHost::OnPolicyUpdate(
UpdateClientDomainListPolicy(std::move(client_domain_list_vector));
}
+ std::string port_range_string;
+ if (policies->GetString(policy::key::kRemoteAccessHostUdpPortRange,
+ &port_range_string)) {
+ UpdateHostUdpPortRangePolicy(port_range_string);
+ }
+
policy_received_ = true;
if (!pending_connect_.is_null()) {
@@ -386,6 +394,22 @@ void It2MeHost::UpdateClientDomainListPolicy(
required_client_domain_list_ = std::move(client_domain_list);
}
+void It2MeHost::UpdateHostUdpPortRangePolicy(
+ const std::string& port_range_string) {
+ DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
+
+ VLOG(2) << "UpdateHostUdpPortRangePolicy: " << port_range_string;
+
+ if (IsRunning()) {
+ DisconnectOnNetworkThread();
+ }
+
+ if (!PortRange::Parse(port_range_string, &udp_port_range_)) {
+ // PolicyWatcher verifies that the value is formatted correctly.
+ LOG(FATAL) << "Invalid port range: " << port_range_string;
+ }
+}
+
void It2MeHost::SetState(It2MeHostState state,
const std::string& error_message) {
DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
« no previous file with comments | « remoting/host/it2me/it2me_host.h ('k') | remoting/host/it2me/it2me_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698