Commit 501ae4d6 authored by Peter Johnston's avatar Peter Johnston Committed by Chromium LUCI CQ

[fuchsia] Remove `address_counter` from network interface name.

This change crrev.com/c/2380329 added an index to the interface name,
following this now-deleted comment:

  // Interfaces with more than one IPv6 address will yield multiple
  // NetworkInterface objects, with friendly names to distinguish the
  // different IPs (e.g. "wlan" with three IPv6 IPs yields wlan-0,
  // wlan-1, wlan-2).

This comment was incorrectly describing the previous behavior, and
clients relied on `interface_name` not including an index.

Bug: b/171599542
Bug: fuchsia:21155
Change-Id: Ied6972f15546a8f022f486e8c049bdf1dfb1e819
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2586317
Commit-Queue: Peter Johnston <peterjohnston@google.com>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#837136}
parent cf7b96e4
...@@ -81,7 +81,6 @@ bool InterfaceProperties::Update( ...@@ -81,7 +81,6 @@ bool InterfaceProperties::Update(
void InterfaceProperties::AppendNetworkInterfaces( void InterfaceProperties::AppendNetworkInterfaces(
NetworkInterfaceList* interfaces) const { NetworkInterfaceList* interfaces) const {
uint32_t address_counter = 1;
for (const auto& fidl_address : properties_.addresses()) { for (const auto& fidl_address : properties_.addresses()) {
IPAddress address = FuchsiaIpAddressToIPAddress(fidl_address.addr().addr); IPAddress address = FuchsiaIpAddressToIPAddress(fidl_address.addr().addr);
if (address.empty()) { if (address.empty()) {
...@@ -93,11 +92,8 @@ void InterfaceProperties::AppendNetworkInterfaces( ...@@ -93,11 +92,8 @@ void InterfaceProperties::AppendNetworkInterfaces(
// TODO(crbug.com/1131220): Set correct attributes once available in // TODO(crbug.com/1131220): Set correct attributes once available in
// fuchsia::net::interfaces::Properties. // fuchsia::net::interfaces::Properties.
const int kAttributes = 0; const int kAttributes = 0;
std::string interface_name = base::StringPrintf(
"%s-%d", properties_.name().c_str(), address_counter);
address_counter++;
interfaces->emplace_back( interfaces->emplace_back(
interface_name, interface_name, properties_.id(), properties_.name(), properties_.name(), properties_.id(),
internal::ConvertConnectionType(properties_.device_class()), internal::ConvertConnectionType(properties_.device_class()),
std::move(address), fidl_address.addr().prefix_len, kAttributes); std::move(address), fidl_address.addr().prefix_len, kAttributes);
} }
......
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