Commit 022c5b0e authored by Marina Ciocea's avatar Marina Ciocea Committed by Commit Bot

[fuchsia] Migrate to fuchsia.net.interfaces/State

Fixed: fuchsia:21155
Change-Id: I85b388be33d4c9697ba866cf11a143493b2b3239
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2380329Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarAdam Langley <agl@chromium.org>
Reviewed-by: default avatarSergey Volk <servolk@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Commit-Queue: Marina Ciocea <marinaciocea@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828229}
parent 62ce5fc8
{ {
"sandbox": { "sandbox": {
"dev": [
"null",
"zero"
],
"features": [ "features": [
"deprecated-ambient-replace-as-executable", "deprecated-ambient-replace-as-executable",
"isolated-cache-storage", "isolated-cache-storage",
...@@ -8,10 +12,6 @@ ...@@ -8,10 +12,6 @@
"root-ssl-certificates", "root-ssl-certificates",
"vulkan" "vulkan"
], ],
"dev": [
"null",
"zero"
],
"services": [ "services": [
"fuchsia.accessibility.semantics.SemanticsManager", "fuchsia.accessibility.semantics.SemanticsManager",
"fuchsia.camera3.DeviceWatcher", "fuchsia.camera3.DeviceWatcher",
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
"fuchsia.mediacodec.CodecFactory", "fuchsia.mediacodec.CodecFactory",
"fuchsia.memorypressure.Provider", "fuchsia.memorypressure.Provider",
"fuchsia.net.NameLookup", "fuchsia.net.NameLookup",
"fuchsia.netstack.Netstack", "fuchsia.net.interfaces.State",
"fuchsia.posix.socket.Provider", "fuchsia.posix.socket.Provider",
"fuchsia.process.Launcher", "fuchsia.process.Launcher",
"fuchsia.sys.Environment", "fuchsia.sys.Environment",
......
{ {
"sandbox": { "sandbox": {
"dev": [
"null",
"zero"
],
"features": [ "features": [
"config-data", "config-data",
"isolated-cache-storage", "isolated-cache-storage",
...@@ -8,10 +12,6 @@ ...@@ -8,10 +12,6 @@
"root-ssl-certificates", "root-ssl-certificates",
"vulkan" "vulkan"
], ],
"dev": [
"null",
"zero"
],
"services": [ "services": [
"fuchsia.accessibility.semantics.SemanticsManager", "fuchsia.accessibility.semantics.SemanticsManager",
"fuchsia.camera3.DeviceWatcher", "fuchsia.camera3.DeviceWatcher",
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
"fuchsia.mediacodec.CodecFactory", "fuchsia.mediacodec.CodecFactory",
"fuchsia.memorypressure.Provider", "fuchsia.memorypressure.Provider",
"fuchsia.net.NameLookup", "fuchsia.net.NameLookup",
"fuchsia.netstack.Netstack", "fuchsia.net.interfaces.State",
"fuchsia.posix.socket.Provider", "fuchsia.posix.socket.Provider",
"fuchsia.process.Launcher", "fuchsia.process.Launcher",
"fuchsia.sys.Environment", "fuchsia.sys.Environment",
......
...@@ -32,10 +32,7 @@ cast_source_set("net") { ...@@ -32,10 +32,7 @@ cast_source_set("net") {
"network_change_notifier_factory_fuchsia.h", "network_change_notifier_factory_fuchsia.h",
] ]
deps += [ deps += [ "//chromecast/base:chromecast_switches" ]
"//chromecast/base:chromecast_switches",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.hardware.ethernet",
]
} }
} }
...@@ -51,9 +48,7 @@ cast_source_set("time_sync_tracker") { ...@@ -51,9 +48,7 @@ cast_source_set("time_sync_tracker") {
"time_sync_tracker.cc", "time_sync_tracker.cc",
"time_sync_tracker.h", "time_sync_tracker.h",
] ]
deps = [ deps = [ "//base" ]
"//base",
]
if (is_fuchsia) { if (is_fuchsia) {
sources += [ sources += [
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include "chromecast/net/network_change_notifier_factory_fuchsia.h" #include "chromecast/net/network_change_notifier_factory_fuchsia.h"
#include <fuchsia/hardware/ethernet/cpp/fidl.h>
#include "base/command_line.h" #include "base/command_line.h"
#include "chromecast/base/chromecast_switches.h" #include "chromecast/base/chromecast_switches.h"
#include "net/base/network_change_notifier_fuchsia.h" #include "net/base/network_change_notifier_fuchsia.h"
...@@ -14,12 +12,10 @@ namespace chromecast { ...@@ -14,12 +12,10 @@ namespace chromecast {
std::unique_ptr<net::NetworkChangeNotifier> std::unique_ptr<net::NetworkChangeNotifier>
NetworkChangeNotifierFactoryFuchsia::CreateInstance() { NetworkChangeNotifierFactoryFuchsia::CreateInstance() {
auto required_features = GetSwitchValueBoolean(switches::kRequireWlan, false) auto require_wlan = GetSwitchValueBoolean(switches::kRequireWlan, false);
? fuchsia::hardware::ethernet::Features::WLAN
: fuchsia::hardware::ethernet::Features();
// Caller assumes ownership. // Caller assumes ownership.
return std::make_unique<net::NetworkChangeNotifierFuchsia>(required_features); return std::make_unique<net::NetworkChangeNotifierFuchsia>(require_wlan);
} }
NetworkChangeNotifierFactoryFuchsia::NetworkChangeNotifierFactoryFuchsia() = NetworkChangeNotifierFactoryFuchsia::NetworkChangeNotifierFactoryFuchsia() =
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
"fuchsia.mediacodec.CodecFactory", "fuchsia.mediacodec.CodecFactory",
"fuchsia.memorypressure.Provider", "fuchsia.memorypressure.Provider",
"fuchsia.net.NameLookup", "fuchsia.net.NameLookup",
"fuchsia.netstack.Netstack", "fuchsia.net.interfaces.State",
"fuchsia.posix.socket.Provider", "fuchsia.posix.socket.Provider",
"fuchsia.process.Launcher", "fuchsia.process.Launcher",
"fuchsia.sys.Launcher", "fuchsia.sys.Launcher",
......
{ {
"sandbox": { "sandbox": {
"features": [ "features": [
"isolated-persistent-storage", "deprecated-ambient-replace-as-executable",
"deprecated-ambient-replace-as-executable" "isolated-persistent-storage"
], ],
"services": [ "services": [
"fuchsia.accessibility.semantics.SemanticsManager", "fuchsia.accessibility.semantics.SemanticsManager",
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"fuchsia.mediacodec.CodecFactory", "fuchsia.mediacodec.CodecFactory",
"fuchsia.memorypressure.Provider", "fuchsia.memorypressure.Provider",
"fuchsia.net.NameLookup", "fuchsia.net.NameLookup",
"fuchsia.netstack.Netstack", "fuchsia.net.interfaces.State",
"fuchsia.posix.socket.Provider", "fuchsia.posix.socket.Provider",
"fuchsia.process.Launcher", "fuchsia.process.Launcher",
"fuchsia.sys.Launcher", "fuchsia.sys.Launcher",
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"fuchsia.media.SessionAudioConsumerFactory", "fuchsia.media.SessionAudioConsumerFactory",
"fuchsia.memorypressure.Provider", "fuchsia.memorypressure.Provider",
"fuchsia.net.NameLookup", "fuchsia.net.NameLookup",
"fuchsia.netstack.Netstack", "fuchsia.net.interfaces.State",
"fuchsia.posix.socket.Provider", "fuchsia.posix.socket.Provider",
"fuchsia.process.Launcher", "fuchsia.process.Launcher",
"fuchsia.sys.Launcher", "fuchsia.sys.Launcher",
......
per-file *.cmx=set noparent
per-file *.cmx=file://fuchsia/SECURITY_OWNERS
{ {
"sandbox": { "sandbox": {
"features": [ "features": [
"root-ssl-certificates", "deprecated-ambient-replace-as-executable",
"deprecated-ambient-replace-as-executable" "root-ssl-certificates"
], ],
"services": [ "services": [
"fuchsia.device.NameProvider", "fuchsia.device.NameProvider",
"fuchsia.intl.PropertyProvider", "fuchsia.intl.PropertyProvider",
"fuchsia.logger.LogSink", "fuchsia.logger.LogSink",
"fuchsia.net.NameLookup", "fuchsia.net.NameLookup",
"fuchsia.netstack.Netstack", "fuchsia.net.interfaces.State",
"fuchsia.posix.socket.Provider" "fuchsia.posix.socket.Provider"
] ]
} }
......
...@@ -40,7 +40,7 @@ static constexpr const char* kServices[] = { ...@@ -40,7 +40,7 @@ static constexpr const char* kServices[] = {
"fuchsia.mediacodec.CodecFactory", "fuchsia.mediacodec.CodecFactory",
"fuchsia.memorypressure.Provider", "fuchsia.memorypressure.Provider",
"fuchsia.net.NameLookup", "fuchsia.net.NameLookup",
"fuchsia.netstack.Netstack", "fuchsia.net.interfaces.State",
"fuchsia.posix.socket.Provider", "fuchsia.posix.socket.Provider",
"fuchsia.process.Launcher", "fuchsia.process.Launcher",
"fuchsia.settings.Display", "fuchsia.settings.Display",
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"fuchsia.mediacodec.CodecFactory", "fuchsia.mediacodec.CodecFactory",
"fuchsia.memorypressure.Provider", "fuchsia.memorypressure.Provider",
"fuchsia.net.NameLookup", "fuchsia.net.NameLookup",
"fuchsia.netstack.Netstack", "fuchsia.net.interfaces.State",
"fuchsia.posix.socket.Provider", "fuchsia.posix.socket.Provider",
"fuchsia.process.Launcher", "fuchsia.process.Launcher",
"fuchsia.settings.Display", "fuchsia.settings.Display",
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
], ],
"services": [ "services": [
"fuchsia.accessibility.semantics.SemanticsManager", "fuchsia.accessibility.semantics.SemanticsManager",
"fuchsia.device.NameProvider",
"fuchsia.camera3.DeviceWatcher", "fuchsia.camera3.DeviceWatcher",
"fuchsia.device.NameProvider",
"fuchsia.fonts.Provider", "fuchsia.fonts.Provider",
"fuchsia.intl.PropertyProvider", "fuchsia.intl.PropertyProvider",
"fuchsia.logger.LogSink", "fuchsia.logger.LogSink",
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"fuchsia.mediacodec.CodecFactory", "fuchsia.mediacodec.CodecFactory",
"fuchsia.memorypressure.Provider", "fuchsia.memorypressure.Provider",
"fuchsia.net.NameLookup", "fuchsia.net.NameLookup",
"fuchsia.netstack.Netstack", "fuchsia.net.interfaces.State",
"fuchsia.posix.socket.Provider", "fuchsia.posix.socket.Provider",
"fuchsia.process.Launcher", "fuchsia.process.Launcher",
"fuchsia.sysmem.Allocator", "fuchsia.sysmem.Allocator",
......
...@@ -1456,7 +1456,8 @@ component("net") { ...@@ -1456,7 +1456,8 @@ component("net") {
if (is_fuchsia) { if (is_fuchsia) {
deps += [ "//third_party/fuchsia-sdk/sdk/pkg/async-loop-cpp" ] deps += [ "//third_party/fuchsia-sdk/sdk/pkg/async-loop-cpp" ]
public_deps += [ "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.netstack" ] public_deps +=
[ "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.net.interfaces" ]
sources += [ sources += [
"base/network_change_notifier_fuchsia.cc", "base/network_change_notifier_fuchsia.cc",
"base/network_change_notifier_fuchsia.h", "base/network_change_notifier_fuchsia.h",
...@@ -1708,8 +1709,8 @@ source_set("net_deps") { ...@@ -1708,8 +1709,8 @@ source_set("net_deps") {
if (is_fuchsia) { if (is_fuchsia) {
public_deps += [ public_deps += [
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.hardware.ethernet", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.hardware.network",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.netstack", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.net.interfaces",
"//third_party/fuchsia-sdk/sdk/pkg/sys_cpp", "//third_party/fuchsia-sdk/sdk/pkg/sys_cpp",
] ]
} }
...@@ -4625,7 +4626,7 @@ test("net_unittests") { ...@@ -4625,7 +4626,7 @@ test("net_unittests") {
if (is_fuchsia) { if (is_fuchsia) {
use_test_server = true use_test_server = true
deps += [ deps += [
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.netstack", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.net.interfaces",
"//third_party/fuchsia-sdk/sdk/pkg/fidl_cpp", "//third_party/fuchsia-sdk/sdk/pkg/fidl_cpp",
] ]
sources += [ "base/network_change_notifier_fuchsia_unittest.cc" ] sources += [ "base/network_change_notifier_fuchsia_unittest.cc" ]
......
...@@ -248,7 +248,7 @@ std::unique_ptr<NetworkChangeNotifier> NetworkChangeNotifier::CreateIfNeeded( ...@@ -248,7 +248,7 @@ std::unique_ptr<NetworkChangeNotifier> NetworkChangeNotifier::CreateIfNeeded(
return std::make_unique<NetworkChangeNotifierMac>(); return std::make_unique<NetworkChangeNotifierMac>();
#elif defined(OS_FUCHSIA) #elif defined(OS_FUCHSIA)
return std::make_unique<NetworkChangeNotifierFuchsia>( return std::make_unique<NetworkChangeNotifierFuchsia>(
fuchsia::hardware::ethernet::Features()); /*require_wlan=*/false);
#else #else
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return NULL; return NULL;
......
This diff is collapsed.
...@@ -5,19 +5,21 @@ ...@@ -5,19 +5,21 @@
#ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_FUCHSIA_H_ #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_FUCHSIA_H_
#define NET_BASE_NETWORK_CHANGE_NOTIFIER_FUCHSIA_H_ #define NET_BASE_NETWORK_CHANGE_NOTIFIER_FUCHSIA_H_
#include <fuchsia/netstack/cpp/fidl.h> #include <fuchsia/net/interfaces/cpp/fidl.h>
#include <lib/fidl/cpp/binding.h> #include <lib/fidl/cpp/binding.h>
#include <vector> #include <vector>
#include "base/atomicops.h" #include "base/atomicops.h"
#include "base/callback.h" #include "base/callback.h"
#include "base/containers/flat_set.h" #include "base/containers/flat_map.h"
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/strings/string_piece.h"
#include "base/threading/thread_checker.h" #include "base/threading/thread_checker.h"
#include "net/base/net_export.h" #include "net/base/net_export.h"
#include "net/base/network_change_notifier.h" #include "net/base/network_change_notifier.h"
#include "net/base/network_interfaces.h" #include "net/base/network_interfaces.h"
#include "net/base/network_interfaces_fuchsia.h"
namespace net { namespace net {
...@@ -25,9 +27,8 @@ class NET_EXPORT_PRIVATE NetworkChangeNotifierFuchsia ...@@ -25,9 +27,8 @@ class NET_EXPORT_PRIVATE NetworkChangeNotifierFuchsia
: public NetworkChangeNotifier { : public NetworkChangeNotifier {
public: public:
// Registers for asynchronous notifications of changes to network interfaces. // Registers for asynchronous notifications of changes to network interfaces.
// Interfaces are filtered by |required_features|. // Only WLAN interfaces are observed if |require_wlan| is requested.
explicit NetworkChangeNotifierFuchsia( explicit NetworkChangeNotifierFuchsia(bool require_wlan);
fuchsia::hardware::ethernet::Features required_features);
NetworkChangeNotifierFuchsia(const NetworkChangeNotifierFuchsia&) = delete; NetworkChangeNotifierFuchsia(const NetworkChangeNotifierFuchsia&) = delete;
NetworkChangeNotifierFuchsia& operator=(const NetworkChangeNotifierFuchsia&) = NetworkChangeNotifierFuchsia& operator=(const NetworkChangeNotifierFuchsia&) =
delete; delete;
...@@ -37,42 +38,55 @@ class NET_EXPORT_PRIVATE NetworkChangeNotifierFuchsia ...@@ -37,42 +38,55 @@ class NET_EXPORT_PRIVATE NetworkChangeNotifierFuchsia
ConnectionType GetCurrentConnectionType() const override; ConnectionType GetCurrentConnectionType() const override;
private: private:
using InterfacePropertiesMap =
base::flat_map<uint64_t, internal::InterfaceProperties>;
friend class NetworkChangeNotifierFuchsiaTest; friend class NetworkChangeNotifierFuchsiaTest;
// For testing purposes. Receives a |netstack| pointer for easy mocking.
// Interfaces are filtered by |required_features|.
NetworkChangeNotifierFuchsia( NetworkChangeNotifierFuchsia(
fidl::InterfaceHandle<fuchsia::netstack::Netstack> netstack, fidl::InterfaceHandle<fuchsia::net::interfaces::Watcher> watcher,
fuchsia::hardware::ethernet::Features required_features, bool require_wlan,
SystemDnsConfigChangeNotifier* system_dns_config_notifier = nullptr); SystemDnsConfigChangeNotifier* system_dns_config_notifier = nullptr);
// Forwards the network interface list along with the result of // Processes events from the watcher for interface addition, change, or
// GetRouteTable() to OnRouteTableReceived(). // removal.
void ProcessInterfaceList( void OnInterfacesEvent(fuchsia::net::interfaces::Event event);
std::vector<fuchsia::netstack::NetInterface> interfaces);
// Computes network change notification state change from the list of // Handlers for the interface change events. Listeners are notified of changes
// interfaces and routing table data, sending observer events if IP or // that affect them. |watcher_| is closed if an event is malformed in some
// connection type changes are detected. // way.
void OnRouteTableReceived( void OnInterfaceAdded(fuchsia::net::interfaces::Properties properties);
std::vector<fuchsia::netstack::NetInterface> interfaces, void OnInterfaceRemoved(uint64_t interface_id);
std::vector<fuchsia::netstack::RouteTableEntry> table); void OnInterfaceChanged(fuchsia::net::interfaces::Properties properties);
// Required features for an interface to be taken into account. // Unbinds the watcher, reset the connection type and logs |error_message|.
const fuchsia::hardware::ethernet::Features required_features_; void OnWatcherError(base::StringPiece error_message);
fuchsia::netstack::NetstackPtr netstack_; // Updates the connection type from |interface_cache_| and notifies observers
// of changes.
void UpdateConnectionType();
// Used to allow the constructor to block until the initial state is received // Resets the connection type to CONNECTION_UNKNOWN.
// from |netstack_|. void ResetConnectionType();
base::OnceClosure on_initial_interfaces_received_;
// Returns the ConnectionType converted from |properties|' device_class.
// Returns CONNECTION_NONE if the interface is not publicly routable, taking
// into account the |requires_wlan_| setting.
ConnectionType GetEffectiveConnectionType(
const internal::InterfaceProperties& properties);
// Returns true if the effective connection type is not CONNECTION_NONE.
bool CanReachExternalNetwork(const internal::InterfaceProperties& properties);
// Whether only WLAN interfaces should be taken into account.
const bool require_wlan_;
fuchsia::net::interfaces::WatcherPtr watcher_;
// The ConnectionType of the default network interface, stored as an atomic // The ConnectionType of the default network interface, stored as an atomic
// 32-bit int for safe concurrent access. // 32-bit int for safe concurrent access.
base::subtle::Atomic32 cached_connection_type_ = CONNECTION_UNKNOWN; base::subtle::Atomic32 cached_connection_type_ = CONNECTION_UNKNOWN;
// Set of addresses from the previous query/update for the default interface. InterfacePropertiesMap interface_cache_;
base::flat_set<IPAddress> cached_addresses_;
THREAD_CHECKER(thread_checker_); THREAD_CHECKER(thread_checker_);
}; };
......
This diff is collapsed.
...@@ -5,41 +5,81 @@ ...@@ -5,41 +5,81 @@
#ifndef NET_BASE_NETWORK_INTERFACES_FUCHSIA_H_ #ifndef NET_BASE_NETWORK_INTERFACES_FUCHSIA_H_
#define NET_BASE_NETWORK_INTERFACES_FUCHSIA_H_ #define NET_BASE_NETWORK_INTERFACES_FUCHSIA_H_
#include <fuchsia/net/interfaces/cpp/fidl.h>
#include <vector> #include <vector>
#include "net/base/network_change_notifier.h" #include "net/base/network_change_notifier.h"
#include "net/base/network_interfaces.h"
namespace fuchsia {
namespace net { namespace net {
class IpAddress; namespace internal {
}
namespace netstack {
class NetInterface;
} // namespace netstack
} // namespace fuchsia
namespace net { // Move-only wrapper for fuchsia::net::interface::Properties that guarantees
// that its inner |properties_| are valid and complete properties as reported by
// |VerifyCompleteInterfaceProperties|.
class InterfaceProperties final {
public:
// Creates an |InterfaceProperties| if |properties| are valid complete
// properties as reported by |VerifyCompleteInterfaceProperties|.
static base::Optional<InterfaceProperties> VerifyAndCreate(
fuchsia::net::interfaces::Properties properties);
InterfaceProperties(InterfaceProperties&& interface);
InterfaceProperties& operator=(InterfaceProperties&& interface);
~InterfaceProperties();
class IPAddress; // Updates this instance with the values set in |properties|.
struct NetworkInterface; // Fields not set in |properties| retain their previous values.
// Returns false if the |properties| has a missing or mismatched |id| field,
// or if any field set in |properties| has an invalid value (e.g. addresses of
// unknown types).
bool Update(fuchsia::net::interfaces::Properties properties);
namespace internal { // Appends the NetworkInterfaces for this interface to |interfaces|.
void AppendNetworkInterfaces(NetworkInterfaceList* interfaces) const;
// Returns true if the interface is online and it has either an IPv4 default
// route and a non-link-local address, or an IPv6 default route and a global
// address.
bool IsPubliclyRoutable() const;
bool HasAddresses() const { return !properties_.addresses().empty(); }
uint64_t id() const { return properties_.id(); }
bool online() const { return properties_.online(); }
const fuchsia::net::interfaces::DeviceClass& device_class() const {
return properties_.device_class();
}
private:
explicit InterfaceProperties(fuchsia::net::interfaces::Properties properties);
fuchsia::net::interfaces::Properties properties_;
};
using ExistingInterfaceProperties =
std::vector<std::pair<uint64_t, InterfaceProperties>>;
// Returns the //net ConnectionType for the supplied netstack interface // Returns the //net ConnectionType for the supplied netstack interface
// description. Returns ConnectionType::CONNECTION_NONE if the interface is not // description. Returns CONNECTION_NONE for loopback interfaces.
// "up".
NetworkChangeNotifier::ConnectionType ConvertConnectionType( NetworkChangeNotifier::ConnectionType ConvertConnectionType(
const fuchsia::netstack::NetInterface& iface); const fuchsia::net::interfaces::DeviceClass& device_class);
// Connects to the service via the process' ComponentContext, and connects the
// Watcher to the service.
fuchsia::net::interfaces::WatcherHandle ConnectInterfacesWatcher();
// Converts a Fuchsia Netstack NetInterface object to NetworkInterface objects. // Validates that |properties| contains all the required fields, returning
// Interfaces with more than one IPv6 address will yield multiple // |true| if so.
// NetworkInterface objects, with friendly names to distinguish the different bool VerifyCompleteInterfaceProperties(
// IPs (e.g. "wlan" with three IPv6 IPs yields wlan-0, wlan-1, wlan-2). const fuchsia::net::interfaces::Properties& properties);
std::vector<NetworkInterface> NetInterfaceToNetworkInterfaces(
const fuchsia::netstack::NetInterface& iface_in);
// Converts a Fuchsia IPv4/IPv6 address to a Chromium IPAddress. // Consumes events describing existing interfaces from |watcher| and
IPAddress FuchsiaIpAddressToIPAddress(const fuchsia::net::IpAddress& addr); // returns a vector of interface Id & properties pairs. |watcher| must
// be a newly-connected Watcher channel.
// Returns base::nullopt if any protocol error is encountered, e.g.
// |watcher| supplies an invalid event, or disconnects.
base::Optional<internal::ExistingInterfaceProperties> GetExistingInterfaces(
const fuchsia::net::interfaces::WatcherSyncPtr& watcher);
} // namespace internal } // namespace internal
} // namespace net } // namespace net
......
...@@ -129,7 +129,7 @@ component("policy") { ...@@ -129,7 +129,7 @@ component("policy") {
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.logger", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.logger",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.mediacodec", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.mediacodec",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.net", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.net",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.netstack", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.net.interfaces",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.sysmem", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.sysmem",
"//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.scenic", "//third_party/fuchsia-sdk/sdk/fidl/fuchsia.ui.scenic",
] ]
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <fuchsia/logger/cpp/fidl.h> #include <fuchsia/logger/cpp/fidl.h>
#include <fuchsia/mediacodec/cpp/fidl.h> #include <fuchsia/mediacodec/cpp/fidl.h>
#include <fuchsia/net/cpp/fidl.h> #include <fuchsia/net/cpp/fidl.h>
#include <fuchsia/netstack/cpp/fidl.h> #include <fuchsia/net/interfaces/cpp/fidl.h>
#include <fuchsia/sysmem/cpp/fidl.h> #include <fuchsia/sysmem/cpp/fidl.h>
#include <fuchsia/ui/scenic/cpp/fidl.h> #include <fuchsia/ui/scenic/cpp/fidl.h>
#include <lib/sys/cpp/component_context.h> #include <lib/sys/cpp/component_context.h>
...@@ -90,7 +90,7 @@ constexpr SandboxConfig kGpuConfig = { ...@@ -90,7 +90,7 @@ constexpr SandboxConfig kGpuConfig = {
constexpr SandboxConfig kNetworkConfig = { constexpr SandboxConfig kNetworkConfig = {
base::make_span((const char* const[]){ base::make_span((const char* const[]){
fuchsia::net::NameLookup::Name_, fuchsia::net::NameLookup::Name_,
fuchsia::netstack::Netstack::Name_, fuchsia::net::interfaces::State::Name_,
"fuchsia.posix.socket.Provider", "fuchsia.posix.socket.Provider",
}), }),
kProvideSslConfig, kProvideSslConfig,
......
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