Commit 9d1462ca authored by Hugo Benichi's avatar Hugo Benichi Committed by Commit Bot

arc: net: get Service properties for all network updates

This patch ensures ensures that ARC++ gets updated with the layer 3 IP
configurations of all active networks, including host VPN networks.

To do so this patch changes two parts in ArcNetHostImpl:

1) First, shill properties are now always asynchronously retrieved and
cached for active networks. Asynchronous network properties requests
are now sent to shill when chromeos::NetworkStateHandlerObserver's
NetworkPropertiesUpdated() or NetworkListChanged() callbacks are
triggered, only for currently active networks. When the properties are
received, a call to net.mojom ActiveNetworkChanged is triggered. This
replaces the previous net.mojom ActiveNetworksChanged triggers on every
callback invocation of chromeos::NetworkStateHandlerObserver's
ActiveNetworksChanged and DefaultNetworkChanged.

2) When net.mojom NetworkConfiguration objects are created, on top of
device properties (not available for VPNs) and ONC properties obtained
from the cached chromeos::NetworkState, cached shill properties are also
used for populating the IP configuration. This allows to obtain the
layer 3 IP configuration for VPNs, which have neither an associated
Device nor any cached layer 3 information in chromeos::NetworkState.

This change makes the retrieval of IP configurations from ONC properties
mostly obsolete. A follow-up patch will remove that code.

BUG=b:145960788
BUG=b:143258259
BUG=b:155129178
BUG=crbug:991189
TEST=Flashed chrome, tested various connectivity setup with multiple
networks, including L2TP connections and Chrome 3p VPN connections.

Change-Id: If3e511212f491a5ec6533c8fb259c49eab29295b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2210335
Commit-Queue: Hugo Benichi <hugobenichi@google.com>
Auto-Submit: Hugo Benichi <hugobenichi@google.com>
Reviewed-by: default avatarYusuke Sato <yusukes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772084}
parent a2abca78
This diff is collapsed.
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define COMPONENTS_ARC_NET_ARC_NET_HOST_IMPL_H_ #define COMPONENTS_ARC_NET_ARC_NET_HOST_IMPL_H_
#include <stdint.h> #include <stdint.h>
#include <map>
#include <memory> #include <memory>
#include <set> #include <set>
#include <string> #include <string>
...@@ -89,13 +90,11 @@ class ArcNetHostImpl : public KeyedService, ...@@ -89,13 +90,11 @@ class ArcNetHostImpl : public KeyedService,
// Overriden from chromeos::NetworkStateHandlerObserver. // Overriden from chromeos::NetworkStateHandlerObserver.
void ScanCompleted(const chromeos::DeviceState* /*unused*/) override; void ScanCompleted(const chromeos::DeviceState* /*unused*/) override;
void OnShuttingDown() override; void OnShuttingDown() override;
void DefaultNetworkChanged(const chromeos::NetworkState* network) override;
void NetworkConnectionStateChanged( void NetworkConnectionStateChanged(
const chromeos::NetworkState* network) override; const chromeos::NetworkState* network) override;
void ActiveNetworksChanged(
const std::vector<const chromeos::NetworkState*>& networks) override;
void NetworkListChanged() override; void NetworkListChanged() override;
void DeviceListChanged() override; void DeviceListChanged() override;
void NetworkPropertiesUpdated(const chromeos::NetworkState* network) override;
// Overriden from chromeos::NetworkConnectionObserver. // Overriden from chromeos::NetworkConnectionObserver.
void DisconnectRequested(const std::string& service_path) override; void DisconnectRequested(const std::string& service_path) override;
...@@ -153,6 +152,9 @@ class ArcNetHostImpl : public KeyedService, ...@@ -153,6 +152,9 @@ class ArcNetHostImpl : public KeyedService,
// Request properties of the Service corresponding to |service_path|. // Request properties of the Service corresponding to |service_path|.
void RequestUpdateForNetwork(const std::string& service_path); void RequestUpdateForNetwork(const std::string& service_path);
// Callback for chromeos::NetworkHandler::GetShillProperties
void ReceiveShillProperties(const std::string& service_path,
const base::DictionaryValue& shill_properties);
ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager. ArcBridgeService* const arc_bridge_service_; // Owned by ArcServiceManager.
...@@ -162,6 +164,8 @@ class ArcNetHostImpl : public KeyedService, ...@@ -162,6 +164,8 @@ class ArcNetHostImpl : public KeyedService,
// Contains all service paths for which a property update request is // Contains all service paths for which a property update request is
// currently scheduled. // currently scheduled.
std::set<std::string> pending_service_property_requests_; std::set<std::string> pending_service_property_requests_;
// Cached shill properties for all active networks, keyed by Service path.
std::map<std::string, base::Value> shill_network_properties_;
std::string cached_service_path_; std::string cached_service_path_;
std::string cached_guid_; std::string cached_guid_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment