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

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
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..52395c38ccdc2f6451131c757eb60ef25f353d4e 100644
--- a/remoting/host/it2me/it2me_host.cc
+++ b/remoting/host/it2me/it2me_host.cc
@@ -178,6 +178,16 @@ void It2MeHost::FinishConnect() {
}
}
+ // Check the port range policy.
+ PortRange port_range;
+ if (!PortRange::Parse(udp_port_range_string_, &port_range)) {
Sergey Ulanov 2017/05/25 19:34:53 It looks like PolicyWatcher is supposed to verify
Gus Smith 2017/05/25 21:39:09 OK - I'll change it back. Originally I did the par
+ std::string error_message =
+ "Invalid RemoteAccessHostUdpPortRange policy value.";
+ LOG(ERROR) << error_message;
+ SetState(kError, error_message);
+ return;
+ }
+
// Generate a key pair for the Host to use.
// TODO(wez): Move this to the worker thread.
host_key_pair_ = RsaKeyPair::Generate();
@@ -191,12 +201,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 = 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 =
protocol::NetworkSettings::kDefaultMinPort;
@@ -330,6 +342,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 +404,18 @@ void It2MeHost::UpdateClientDomainListPolicy(
required_client_domain_list_ = std::move(client_domain_list);
}
+void It2MeHost::UpdateHostUdpPortRangePolicy(std::string port_range_string) {
+ DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
+
+ VLOG(2) << "UpdateHostUdpPortRangePolicy: " << port_range_string;
+
+ if (IsRunning()) {
+ DisconnectOnNetworkThread();
+ }
+
+ udp_port_range_string_ = port_range_string;
+}
+
void It2MeHost::SetState(It2MeHostState state,
const std::string& error_message) {
DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());

Powered by Google App Engine
This is Rietveld 408576698