Commit 1a0e2c0f authored by Oleh Lamzin's avatar Oleh Lamzin Committed by Commit Bot

Remove needs update logic for SetUsbEthernetMacAddressSource

Remove logic that checks whether MAC address source property on USB
Ethernet adapter must be updated. This logic is complicated and doesn't
work very well.

For example,
  0. policy value for MAC address source is "designated_dock_mac"
  1. device is not link up and has MAC address source property
     equals to "designated_dock_mac"
  2. we send request to change MAC address source to
     "usb_adapter_mac"
  3. device is link up, but MAC address source property hadn't been
     updated, so we update path to primary USB Ethernet adapter
  4. device MAC address source property was updated to
     "usb_adapter_mac", but we see that primary USB Ethernet adapter
     didn't change and policy value is still the same. Here we have to
     verify that primary Ethernet adapter still has correct property.

After applying this CL, each time there will be property value
verification.

Side effect of this CL is that we may send the same
request to shill few times. In practice, it's only 2 requests.

BUG=b:152425041
TEST=manual end-to-end
TEST=existing unit tests

Change-Id: I773aeff67d0aae9a2bb5e7172e3677dbd8a18141
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2150598
Commit-Queue: Oleh Lamzin <lamzin@google.com>
Auto-Submit: Oleh Lamzin <lamzin@google.com>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarPavol Marko <pmarko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759619}
parent 9e135e3c
...@@ -339,7 +339,6 @@ void NetworkDeviceHandlerImpl::SetUsbEthernetMacAddressSource( ...@@ -339,7 +339,6 @@ void NetworkDeviceHandlerImpl::SetUsbEthernetMacAddressSource(
} }
usb_ethernet_mac_address_source_ = source; usb_ethernet_mac_address_source_ = source;
usb_ethernet_mac_address_source_needs_update_ = true;
mac_address_change_not_supported_.clear(); mac_address_change_not_supported_.clear();
ApplyUsbEthernetMacAddressSourceToShill(); ApplyUsbEthernetMacAddressSourceToShill();
} }
...@@ -539,21 +538,9 @@ void NetworkDeviceHandlerImpl::ApplyUsbEthernetMacAddressSourceToShill() { ...@@ -539,21 +538,9 @@ void NetworkDeviceHandlerImpl::ApplyUsbEthernetMacAddressSourceToShill() {
return; return;
} }
std::string previous_primary_enabled_usb_ethernet_device_path =
primary_enabled_usb_ethernet_device_path_;
UpdatePrimaryEnabledUsbEthernetDevice(); UpdatePrimaryEnabledUsbEthernetDevice();
ResetMacAddressSourceForSecondaryUsbEthernetDevices(); ResetMacAddressSourceForSecondaryUsbEthernetDevices();
// Do nothing else if device path and MAC address source have not changed.
if (!usb_ethernet_mac_address_source_needs_update_ &&
previous_primary_enabled_usb_ethernet_device_path ==
primary_enabled_usb_ethernet_device_path_) {
return;
}
usb_ethernet_mac_address_source_needs_update_ = false;
const DeviceState* primary_enabled_usb_ethernet_device_state = const DeviceState* primary_enabled_usb_ethernet_device_state =
network_state_handler_->GetDeviceState( network_state_handler_->GetDeviceState(
primary_enabled_usb_ethernet_device_path_); primary_enabled_usb_ethernet_device_path_);
......
...@@ -191,7 +191,6 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) NetworkDeviceHandlerImpl ...@@ -191,7 +191,6 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) NetworkDeviceHandlerImpl
bool mac_addr_randomization_enabled_ = false; bool mac_addr_randomization_enabled_ = false;
std::string usb_ethernet_mac_address_source_; std::string usb_ethernet_mac_address_source_;
bool usb_ethernet_mac_address_source_needs_update_ = false;
std::string primary_enabled_usb_ethernet_device_path_; std::string primary_enabled_usb_ethernet_device_path_;
// Set of device's MAC addresses that do not support MAC address source change // Set of device's MAC addresses that do not support MAC address source change
// to |usb_ethernet_mac_address_source_|. Use MAC address as unique device // to |usb_ethernet_mac_address_source_|. Use MAC address as unique device
......
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