History log of /system/connectivity/shill/device_unittest.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
3a62e235646ec19bee71e8dbee5208282dcd13b5 20-Jan-2016 Alex Vakulenko <avakulenko@google.com> shill: Update libchrome APIs to r369476

The new libchrome has been ported from Chromium and some APIs have
changed. Make necessary changes at call sites.

Change-Id: Ib4c4b5438a2e249777c9c1b6509f085ad5d00049
/system/connectivity/shill/device_unittest.cc
b2267c9c1cb77564df9d74b5e81689c7e43b8e10 20-Jan-2016 Peter Qiu <zqiu@google.com> Revert "Revert "shill: store VendorEncapsulatedOptions as ByteArray""

This reverts commit d8cc557efffedd0fe1c7ca4a68bb44e438c90e57.

Change-Id: I63fa9a32ede5aab573b02ed6dc089c2817831496
/system/connectivity/shill/device_unittest.cc
d8cc557efffedd0fe1c7ca4a68bb44e438c90e57 20-Jan-2016 Alex Vakulenko <avakulenko@google.com> Revert "shill: store VendorEncapsulatedOptions as ByteArray"

This reverts commit 57c3f29eb884856bf063c05c4f7aae3ca6535804.

Change-Id: Idd37a019974273e7cd2e15d78b82c86f9ac1a24a
/system/connectivity/shill/device_unittest.cc
18596f4ea9df2f420142e22015f79212b0b32c1b 06-Jan-2016 Victor Dodon <printesoi@google.com> shill: store VendorEncapsulatedOptions as ByteArray

As per RFC 2132, Section 8.4. Vendor Specific Information, the DHCP option 43
is "an opaque object of n octets" and "SHOULD be encoded as a sequence of
code/length/value fields of identical syntax to the DHCP options field". Store
VendorEncapsulatedOptions property as ByteArray instead of std::string

Bug: None
BUG=chromium:574578
TEST=unit tests; manual test on beaglebone_servo

Change-Id: Ie8abdfb35c6f1b250e195495c6ce255ade5825b9
/system/connectivity/shill/device_unittest.cc
fa1eb722d0742d89c26b9c5c81d02ef2a138cbf2 21-Dec-2015 Alex Vakulenko <avakulenko@google.com> shill: Disable RTTI

There is no longer a reliance on RTTI in libbrillo, so disable RTTI
in the rest of Brillo codebase.

Shill also used dynamic_cast<> in many places but it looks like there
is no reason for that. Using static_cast<> in those places seems to
work just as well and doesn't require RTTI.

Bug: 26292405, chromium:220387
TEST: Compiles, all unit tests pass on Dragonboard
Was able to bootstrap a device from scratch and networking
seems to work fine.

Change-Id: Id0c47168e634e354b4279f613246e6667df6fb5f
/system/connectivity/shill/device_unittest.cc
2774eabea99ba62fba88cb904770606ab3cd852b 11-Nov-2015 Rebecca Silberstein <silberst@google.com> shill: move assignment of dhcp_props in AcquireIPConfigWithSelectedService test

When DHCPv6 is enabled for DeviceTest.AcquireIPConfigWithSelectedService,
dhcp_props are set before the new manager is created. Move this
assignment to after the #ifndef DISABLE_DHCPV6 block.

Bug: 25645065
TEST="P2_TEST_FILTER="shill::DeviceTest.AcquireIPConfigWithSelectedService"
USE="dhcpv6 ipv6" FEATURES=test emerge-storm shill"
TEST="P2_TEST_FILTER="shill::DeviceTest.AcquireIPConfigWithSelectedService"
FEATURES=test emerge-daisy shill"

Change-Id: I859ab2d981e555eef1b3f020e85eaebbc8414382
/system/connectivity/shill/device_unittest.cc
15d5431798155cc83a3fcb8abe0d1a2d5128f7b6 09-Oct-2015 Rebecca Silberstein <silberst@google.com> RE-LAND: shill: use DhcpProperties for dhcpv4 config

In some deployments, DHCP properties need to be specified for DHCP
requests. These properties will be set via the PropertyStore and stored
in the user profile (per service) and the default profile.

To implement this, the manager and service classes will each have an
instance of DhcpProperties to track the property settings stored in the
applicable profile. When a device creates a dhcp_config object to
configure the dhcpcd options, it will merge any applicable
DhcpProperties values set in the default and user profiles.

Users were previously able to set the hostname for DHCP requests using
the Manager.Hostname property. This value is now included in the new
DhcpProperties object. Two options are currently supported:
DhcpProperties.Hostname and DhcpProperties.VendorClass.

This change also includes new tests for the new object and the
affiliated functions. Existing tests were also updated to cover this
new functionality.

Bug: 24162121
TEST="FEATURES=test emerge-daisy shill"
TEST=compiled for brillo

Change-Id: I045ab0dbf866ea0084a8f77b28bfff24970bb92c
/system/connectivity/shill/device_unittest.cc
f95fe0f32645a56ba4a1dfb2dfbcaabf80b0b3f2 31-Oct-2015 Rebecca Silberstein <silberst@google.com> Revert "shill: use DhcpProperties for dhcpv4 config"

This reverts commit 5ac8c7b32241582e2e39469297de6b7cab2c7d19.

Change-Id: I7b8e747aca30a2d09dc474d2c5ef31ffcccf8032
/system/connectivity/shill/device_unittest.cc
5ac8c7b32241582e2e39469297de6b7cab2c7d19 09-Oct-2015 Rebecca Silberstein <silberst@google.com> shill: use DhcpProperties for dhcpv4 config

In some deployments, DHCP properties need to be specified for DHCP
requests. These properties will be set via the PropertyStore and stored
in the user profile (per service) and the default profile.

To implement this, the manager and service classes will each have an
instance of DhcpProperties to track the property settings stored in the
applicable profile. When a device creates a dhcp_config object to
configure the dhcpcd options, it will merge any applicable
DhcpProperties values set in the default and user profiles.

Users were previously able to set the hostname for DHCP requests using
the Manager.Hostname property. This value is now included in the new
DhcpProperties object. Two options are currently supported:
DhcpProperties.Hostname and DhcpProperties.VendorClass.

This change also includes new tests for the new object and the
affiliated functions. Existing tests were also updated to cover this
new functionality.

Bug: 24162121
TEST="USE="asan clang" FEATURES=test emerge-samus shill"

Change-Id: I9e25ced863661cfd73164faf9032df25b208c6c2
/system/connectivity/shill/device_unittest.cc
03e6719bae1e0903d94853b896673a033196bcf5 13-Oct-2015 Alex Vakulenko <avakulenko@google.com> shill: Rename "chromeos" -> "brillo" in include paths and namespaces

libchromeos is transitioning to libbrillo and chromeos namespaces
and include directory is changing to brillo.

Bug: 24872993
TEST=built for aosp and brillo, all unit tests pass on dragonboard

Change-Id: I804311e49ee780ca96e05f6a581e8c95709d4e1d
/system/connectivity/shill/device_unittest.cc
6f99f2cb25bead57398151880118a7794d5428a3 07-Oct-2015 Samuel Tan <samueltan@google.com> shill: change unittest string matching expectations for __func__

In Android, __func__ prints out the entire function signature, whereas
in CrOS, __func__ only prints the function name. Change unittest
expectations to account for this.

BUG: 24705085
Change-Id: I968def135b5f448980d2d5818948e6276f23d9b2
TEST: shill unittests pass in Android and Chrome OS.
/system/connectivity/shill/device_unittest.cc
289a5a5e18bb1a676b3dfce111af4c2c00c7776e 21-Sep-2015 Samuel Tan <samueltan@google.com> shill: use different service_constants.h path for Android builds

Use the service_constants.h file from the external/cros/system_api/dbus
instead of chromeos/dbus/service_constants.h, since this header file
is installed into different directories when building shill for Android
and Chrome OS.

BUG: 22956441
Change-Id: I7e6ea46b4893588d2862792cf43aa83fdf7c30b4
TEST: shill still compiles using emerge.
/system/connectivity/shill/device_unittest.cc
bad1c10ffd2d4ac14f7bd9f4ef6a8982e711f566 19-Sep-2015 mukesh agrawal <quiche@google.com> shill: remove references to GLib

There are a number of references to GLib (the object),
even though no one uses GLib in a substantive way.
Remove these obsolete references.

Bug: 23386647
TEST=unit tests

Change-Id: I8d574980bc8e853c8b87ef64b581d64a71491201
/system/connectivity/shill/device_unittest.cc
c0beca55d290fe0b1c96d78cbbcf94b05c23f5a5 03-Sep-2015 Peter Qiu <zqiu@google.com> License shill to Apache2

This patch automatically replaced the license on all text files from
Chromium OS (BSD style) to AOSP (Apache2), keeping the original year as
a reference.

The license header was added to .gyp and .gypi, the NOTICE was added with a copy
of the Apache2 license and MODULE_LICENSE_* file was added.

BUG=23587594
TEST=grep 'Chromium OS Authors' doesn't find anything.

Change-Id: If41ede586c2465f5831fb7fee270ff41dbfdb596
/system/connectivity/shill/device_unittest.cc
b8172ec75bbc9faac13a33e162ddedd53a97d1c8 12-Aug-2015 Peter Qiu <zqiu@chromium.org> shill: remove dbus-c++ dependency from PropertyStoreTest

Also update tests that uses PropertyStoreTest.

BUG=chromium:517680
TEST=unittests

Change-Id: Ie668a5adddeaec9355ad6b99fff40266ad14826c
Reviewed-on: https://chromium-review.googlesource.com/293005
Commit-Ready: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
490063ebd172dbaf5328c682f7338b2c1f6331df 12-Aug-2015 Samuel Tan <samueltan@google.com> shill: perform connection diagnostics after portal detection failure

Perform connection diagnostics after portal detection fails
for a particular device. This will provide more information
in the logs about what connectivity issue shill is experiencing.

Also, have connection diagnostics log the likely connection issue
to LOG(INFO) (instead of WiFi logs level -4) when it is done.
This ensures that the results of the diagnostics appear in
feedback reports at the default logging level.

BUG=chromium:216691
TEST=Compile shill and run unit tests.

Change-Id: I4688a384e83fb8faefd6015413d4ca38444aa8a6
Reviewed-on: https://chromium-review.googlesource.com/293025
Tested-by: Samuel Tan <samueltan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/device_unittest.cc
8f254a17249abf206ad08c5bb17e4499f08ab5d2 16-Jul-2015 Peter Qiu <zqiu@chromium.org> shill: fix handling of IPv4 config failure

Do not disconnect network on IPv4 configuration failures
when the device already had an IPv6 connection setup.

BUG=chromium:510283
TEST=unittest

Change-Id: I9ef0b2063fdcad95e3d52910c93f7d3551f435fd
Reviewed-on: https://chromium-review.googlesource.com/286008
Trybot-Ready: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
3b30ca58d13cf66b75ba0729b222ddc42ae68b33 16-Jun-2015 Paul Stewart <pstew@chromium.org> shill: Top-level unit tests: Switch pointer/ref spacing

Switch to Chrome style spacing.

BUG=chromium:501026
TEST=Unit tests

Change-Id: I86c072b89281e0de18928b47860b99d779af061a
Reviewed-on: https://chromium-review.googlesource.com/278037
Reviewed-by: Rebecca Silberstein <silberst@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
60a922ee59d4764a03e83fe3d090016e2d47d019 16-Jun-2015 Paul Stewart <pstew@chromium.org> shill: DeviceTest: Fix DeviceTest.PrependIPv6DNSServers

This test was flaky due to (a) incomplete behavior added to
the mock expectation (b) an uninitialized integer variable
causing the side effect of (a) not to be deterministic.

BUG=chromium:462647
TEST=Unit test

Change-Id: Iec10273a8873897e75726356f0a99fdd7d683e5a
Reviewed-on: https://chromium-review.googlesource.com/278023
Reviewed-by: Garret Kelly <gdk@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
1ce231c71932200e4d02c71567f8e93788120781 13-Jun-2015 Paul Stewart <pstew@chromium.org> shill: Manager: Refactor command line setup

In anticipation of a new and different implementation of
shill::Daemon, this CL re-factors the interaction between
the main() function and shill::Daemon by passing a new
Daemon::Settings structure. This way the process of parsing
command line parameters is separated from the task of
delivering this configuration the Daemon object. While here,
the "default_technology_order" field of was unified with the
other parameters passed to the Manager from the Daemon.

However this change is somewhat dwarfed by the technical
debt that needed to be paid off in order to allow this new
change to be tested. The new Daemon::ApplySettings method
makes no new calls to the Manager object but none of these
methods were previously mocked in the MockManager object.
More troublingly the side-effects of these Manager methods
were depended on in MockManager, so a few tests (notably
DeviceTest) needed to be re-architected to deal with mock
functionality instead of assuming the Mock object did what
a real Manager would do.

Lastly, both the Device::PrependDNSServers and
Manager::FilterPrependDNSServersByFamily methods seemed
a bit hard to understand and difficult to test. Minor
changes to these APIs allowed the test changes above to
work a lot smoother, and also to separate the unit tests
to work on individually testing the functionality in each
object.

BUG=chromium:500991
TEST=Unit tests

Change-Id: I04c33c841024c102ff9658e5857236ab2e5bf32f
Reviewed-on: https://chromium-review.googlesource.com/278022
Reviewed-by: Garret Kelly <gdk@chromium.org>
Reviewed-by: Rebecca Silberstein <silberst@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
d48fa0c5531e2102d4f537e81b9f92afc2d60955 10-Jun-2015 Peter Qiu <zqiu@chromium.org> shill: command line support for DHCPv6

Add command line option "--dhcpv6-enabled-devices" to enable DHCPv6
for specific devices. The obtained DHCPv6 configuration is for
informational purpose only, will not be used to setup connection nor
update system configuration by shill.

Note: since shill does not use DHCPv6 configuration to setup any
connection, other IP configuration (DHCPv4 or IPv6 over RDNSS)
is required in order for the device to setup a connection for a
given network service.

BUG=chromium:492764
TEST=USE="dhcpv6 asan clang" emerge-$BOARD shill
TEST=USE="asan clang" emerge-$BOARD shill
TEST=Verify with new DHCPv6 client auotest
Manual Test:
1. Build/install IPv6 enabled dhcpcd and DHCPv6 enabled shill
2. Setup a virtual ethernet pair using:
"ip link add name veth_master type veth peer name slave"
2. Setup a DHCPv6 server on veth_master interface
"/usr/sbin/dhcpd -6 -cf /tmp/dhcp6.conf veth_master"
3. Start shill with DHCPv6 enabled for "slave" interface
4. Verify DHCPv6 configuration via
"/usr/local/lib/flimflam/test/list-ipconfigs slave"

Change-Id: Ic152400f61e5bb4cb02f237b97da971ed24da27f
Reviewed-on: https://chromium-review.googlesource.com/276713
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
8e0151e84f077cc9c0646d5bafd925ed235a1c12 04-Jun-2015 Peter Qiu <zqiu@chromium.org> shill: refactor DHCPConfig

To better support DHCPv6 configurations, move IPv4 specific code
from DHCPConfig to the newly created DHCP4Config. The idea is to
have the base class DHCPConfig supports the basic interaction with
dhcpcd daemon, and the derived class (IP specific) for processing
events and parsing IP configurations.

An upcoming CL will add a new class DHCP6Config for processing
IPv6 configurations.

BUG=chromium:496302
TEST=USE="asan clang" FEATURES=test emerge-$BOARD shill
TEST=Run network_Dhcp* client tests and wifi_matfunc suite

Change-Id: I1f23ec46a52b42fccf7bbc8906c5f5e506f2d1c8
Reviewed-on: https://chromium-review.googlesource.com/275274
Tested-by: Zeping Qiu <zqiu@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
675d0b0f04936050a357722f52dc078a3ab671d8 03-Jun-2015 Peter Qiu <zqiu@chromium.org> shill: move dhcp codes to dhcp directory

Number of files related to dhcp will increase significantly after
refactoring DHCPConfig and adding support for DHCPv6. So move
these files to a dedicated directory.

BUG=chromium:496302
TEST=USE="asan clang" FEATURES=test emerge-$BOARD shill

Change-Id: I7f47365158fc5e1d902946dc3403720402f9b6ad
Reviewed-on: https://chromium-review.googlesource.com/275019
Reviewed-by: Zeping Qiu <zqiu@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
208a97ed32c62bc11b0a20eaf01833482e8c0fbc 13-May-2015 Paul Stewart <pstew@chromium.org> shill: Device: Perform validation of accepted hostname

The hostname retrieved from the DHCP server may be too large.
Try to be smart about truncating the hostname so that one can
be successfully set.

BUG=chromium:475699
TEST=New unit tests + network_DhcpRequestHostname

Change-Id: Ic60c86919590f394de32a611296f9b9fbe454fb0
Reviewed-on: https://chromium-review.googlesource.com/270579
Reviewed-by: Zeping Qiu <zqiu@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
62abf31989c52dc1e4ee5aae71664ba81d6fe2db 05-May-2015 Peter Qiu <zqiu@chromium.org> shill: move ResolvePeerMacAddress to Device

It makes more sense to put ResolvePeerMacAddress in Device, which
will allow other devices to use this function in the future as well.

While there, move the hardware address conversion utility functions
(MakeHardwareAddressFromString and MakeStringFromHardwareAddress) to Device
class instead of WiFiEndpoint. These are generic device functions, not
specific to WiFi.

BUG=None
TEST=USE="asan clang" FEATURES=test emerge-$BOARD shill

Change-Id: I9ad47e02203ddd2124b249b1dd0c78a518d48197
Reviewed-on: https://chromium-review.googlesource.com/269396
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
a388fdb2e74717ba2440a605f208647dd7cd3e06 03-Apr-2015 Peter Qiu <zqiu@chromium.org> shill: suppress reassociate attempt when network is unreliable

A network is considered unreliable when encountering multiple link
failures in a short period of time (currently set to 60 minutes). When
a network is unreliable, reassociate attempts will be skipped when link
failures are detected.

The unreliable status of the network will be reset when the device
resumes from suspend, or selected network changes, or after a period
of time without link failures after reconnection.

This will avoid unnecessary disconnect/reconnect attempts when the
network is unreliable due to other unforeseen factors.

BUG=chromium:472828
TEST=unittest

Change-Id: I2037d08692a9abec48afdb974a1e028c85eb2ad0
Reviewed-on: https://chromium-review.googlesource.com/263953
Trybot-Ready: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
782cdcea789d76a7ad7802cf9410b14a2399c0a9 01-Apr-2015 Garret Kelly <gdk@chromium.org> shill: add minimum-mtu command-line parameter

Add the --minimum-mtu option to shill to allow clients to override small
MTU values set by DHCP servers. Any MTU value smaller than the provided
one is dropped.

BUG=chrome-os-partner:36886
TEST=FEATURES=test emerge-amd64-generic shill, ASAN profile

Change-Id: I8e79a18f335705887568e04050712d565d53c4f0
Reviewed-on: https://chromium-review.googlesource.com/263522
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Garret Kelly <gdk@chromium.org>
Tested-by: Garret Kelly <gdk@chromium.org>
/system/connectivity/shill/device_unittest.cc
d01b5cc35185e022b66e08832e12fe7f59b5aa24 12-Mar-2015 Garret Kelly <gdk@chromium.org> shill: don't override static nameservers

When using the prepend_dns_servers flag, do not override nameservers if
they have been provided as part of the static configuration.

BUG=chrome-os-partner:37737
TEST=FEATURES=test emerge-amd64-generic shill

Change-Id: I1166052470931818f51074f26688b1a47847fd1a
Reviewed-on: https://chromium-review.googlesource.com/260504
Commit-Queue: Garret Kelly <gdk@chromium.org>
Tested-by: Garret Kelly <gdk@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
84a90ce35c4319701fcb35ba7cf5eaddc8e0649f 25-Mar-2015 Garret Kelly <gdk@chromium.org> shill: prepend nameservers after static configuration

Make Device::OnIPConfigUpdated apply static IP parameters (if any exist)
before prepending DNS servers. In cases where the the actual address
comes from the static IP parameters the family isn't available until
after it's been applied to the incoming IPConfig.

BUG=chrome-os-partner:37730
TEST=FEATURES=test emerge-amd64-generic shill, ASAN profile

Change-Id: Ib0f009152bbb7cc852bafe80585802819171a0d3
Reviewed-on: https://chromium-review.googlesource.com/262435
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Garret Kelly <gdk@chromium.org>
Tested-by: Garret Kelly <gdk@chromium.org>
/system/connectivity/shill/device_unittest.cc
abe5c0e0b6ef2f318162e9effc0f1404ef9fcf3c 27-Feb-2015 Garret Kelly <gdk@chromium.org> shill: disable DeviceTest.PrependIPv6DNSServers

The shill_unittest binary as produced by the next_gcc compiler currently
fails to complete this test on the release buildbots. This is blocking
the release of the next_gcc toolchain, so the test will be disabled
temporarily until a solution found for the builders.

BUG=chromium:462647
TEST=FEATURES=test emerge-samus shill

Change-Id: I4ae2d3ce506e62e9f26c53670edf6b74f4759277
Reviewed-on: https://chromium-review.googlesource.com/254610
Commit-Queue: Garret Kelly <gdk@chromium.org>
Trybot-Ready: Garret Kelly <gdk@chromium.org>
Tested-by: Garret Kelly <gdk@chromium.org>
Reviewed-by: Luis Lozano <llozano@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
c5f89d131e5b03f448b73fd02d16cab30e438521 18-Feb-2015 Garret Kelly <gdk@chromium.org> shill: add new --prepend-dns-servers flag

The --prepend-dns-servers flag causes every Device to prepend resolvers
of the same address family as their local address to their list of
resolvers before setting it. It is guaranteed that the same resolver
will not appear more than once in the output list.

BUG=chrome-os-partner:36696
TEST=amd64-generic unit tests and ASAN profile unit tests
CQ-DEPEND=CL:250873

Change-Id: I052f6bb8bd222880e1b18097c72a96f11cd50559
Reviewed-on: https://chromium-review.googlesource.com/250877
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Garret Kelly <gdk@chromium.org>
Tested-by: Garret Kelly <gdk@chromium.org>
/system/connectivity/shill/device_unittest.cc
3c3c36a37a885d0a2e180998587af8390744f757 17-Dec-2014 Samuel Tan <samueltan@chromium.org> shill: do not report suspend readiness on gateway ARP

Pass a boolean from DHCPConfig::ProcessEventSignal to
IPConfig::UpdateProperties and Device::OnIPConfigUpdated that
indicates if a gateway ARP was received, and use this boolean
to determine whether or not to report suspend readiness when
WiFi::OnIPConfigUpdated is called in dark resume. This allows
us to accept both a Gateway ARP and BOUND event during dark
resume, and only report suspend readiness when the latter event
is received.

BUG=chromium:442610
TEST=Compile shill and run unit tests using:

P2_TEST_FILTER="shill::*" FEATURES="test" USE="clang asan" \
emerge-samus shill

Manual testing as follows:

1) Boot into a samus test image.
2) Run 'ff_debug +wifi; ff_debug --level -3'
3) Run 'echo 0 > /var/lib/power_manager/disable_dark_resume; restart \
powerd'
4) Enable all wake on WiFi features with the following command:
dbus-send --system --print-reply --dest=org.chromium.flimflam \
/device/wlan0 org.chromium.flimflam.Device.SetProperty \
string:WakeOnWiFiFeaturesEnabled \
variant:string:"packet_and_ssid"
5) Set the wake-to-scan frequency to 30 seconds with the
following command:
dbus-send --system --print-reply --dest=org.chromium.flimflam \
/device/wlan0 org.chromium.flimflam.Device.SetProperty \
string:WakeToScanFrequency variant:uint32:30
6) Connect samus to an AP.
7) Disable the AP. Verify that the samus is fully disconnected by the WiFi
icon state (a cross over empty WiFi bars).
8) Run 'powerd_dbus_suspend' to suspend the system.
9) Wait ~10 seconds for the system to fully suspend, then immediately re-enable
the AP.
10) Wait for another ~20 seconds for the system to enter dark resume (light bar
will turn on in dark resume).
11) After the dark resume concludes (~10 more seconds; light bar should turn
off), wait another 30 seconds and verify that the system does not enter
dark resume again (i.e. light bar does not light up again). This signifies
that the system has established a connection in the last dark resume. If
the system enters dark resume, repeat this step until the system no longer
enters dark resume again.
12) Wake the samus by pressing any way, and verify that the WiFi icon is in the
fully connected state.
13) Open /var/log/net.log
14) Search for the log messages containing "Gateway ARP received" and
"IPv4 DHCP lease obtained". Verify that the former is logged before the
latter, and that the two events are logged within the same second.
15) Verify that the log message containing the substring "OnDHCPLeaseObtained"
appears immediately after the "IPv4 DHCP lease obtained message".

Change-Id: I8185c8683ed1a5e65779d67cca100faafbad6654
Reviewed-on: https://chromium-review.googlesource.com/236099
Tested-by: Samuel Tan <samueltan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/device_unittest.cc
0951ccbfca977a9cf218b2e4308aa26fb4d06ef9 10-Dec-2014 Alex Vakulenko <avakulenko@chromium.org> Update libchrome to r307740 and fix build errors

Updated libchrome, libchrome_crypto, metrics, feedback to the
latest revisions from Chrome (r307740).

Fixed build breaks due to the changes in upstream code:

- scope_ptr no longer needs explicit PassAs<T>() calls.
- scope_ptr<T> no longer has implicit conversion to T*.
Must use scope_ptr<T>::get() instead.
- base/file_util.h moved to base/files/file_util.h
- ARRAYSIZE_UNSAFE() removed in favor of arraysize()
- base::AppendToFile() and base::WriteFileDescriptor() now
return bool instead of the number of bytes written.
- dbus::Bus::AddFilterFunction() now returns void.
- C++11 features are enabled in libchromeos, so all targets
linking with it now have to support C++11
- OVERRIDE macro is removed in favor of native C++11
'override' keyword.

BUG=chromium:416628, chromium:411508
TEST=Build the world on x86, x64, ARM. The following builders
were tried:
x86-generic-full amd64-generic-full arm-generic-full
amd64-generic-asan daisy-full nyan-full pre-cq-group
daisy-release-group sandybridge-release-group
pineview-release-group
CQ-DEPEND=CL:234450,CL:234980

Change-Id: I374bebe2211d533c4431c82efb8be1cdcb1f405d
Reviewed-on: https://chromium-review.googlesource.com/234440
Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
/system/connectivity/shill/device_unittest.cc
ff6be29bd74abd31640abcf9ad4332e0a9657196 25-Nov-2014 Paul Stewart <pstew@chromium.org> shill: Manager: Add ProhibitedTechnologies property

Add a Manager property for the list of technologies that should
be prohibited from enablement through D-Bus APIs. New devices
that appear will similarly start in the disabled state and cannot
be enabled. Removing a technology from the prohibited list does
not re-enable any devices that were previously disabled.

CQ-DEPEND=CL:231738
BUG=chromium:436336
TEST=Unit tests
Also manual:
dbus-send --system --print-reply --fixed \
--dest=org.chromium.flimflam / \
org.chromium.flimflam.Manager.SetProperty \
string:ProhibitedTechnologies \
variant:string:wifi

At this point, WiFi is disconnected and disabled, and cannot
be re-enabled via the UI. Changing "wifi" to "wimax" above
causes it to be possible to enable WiFi in the UI again.

Change-Id: I2e95cb5e95913739ccd54457bec778951af4dae6
Reviewed-on: https://chromium-review.googlesource.com/231739
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
2cb3fa7317cfa3248cff72d0b9d64c4f2f630472 13-Nov-2014 Paul Stewart <pstew@chromium.org> shill: Device: Support same-net multi-homing

When two interfaces are connected to the same subnet, two
components of ChromeOS system behavior conspire to produce
surprising results. First, the default Linux network behavior
induces the "ARP Flux" effect where the system replies to
ARPs interchangably for both interfaces. Secondly, reverse-
path filtering (setup by default in shill) causes only one
network interface to be able to receive packets for a given
subnet at a time.

This CL adds code to recognize situations where more than
one interface is connected to the same subnet. In such
situtations reverse-path filtering is disabled and ARP
filtering is enabled. This requires the driver to keep
track of the requested reverse-path filtering state.

BUG=chromium:430041
TEST=Unit tests + manual:

(1) Attach both WiFi and Ethernet, but to _different_ IP
networks (subnet addresses should be different). Run
"sysctl -a | egrep '(rp_filter|arp_announce|arp_ignore)'".
Output should be something like:

net.ipv4.conf.all.arp_announce = 0
net.ipv4.conf.all.arp_filter = 0
net.ipv4.conf.all.arp_ignore = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.arp_announce = 0
net.ipv4.conf.default.arp_filter = 0
net.ipv4.conf.default.arp_ignore = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.eth0.arp_announce = 0
net.ipv4.conf.eth0.arp_filter = 0
net.ipv4.conf.eth0.arp_ignore = 0
net.ipv4.conf.eth0.rp_filter = 1
net.ipv4.conf.lo.arp_announce = 0
net.ipv4.conf.lo.arp_filter = 0
net.ipv4.conf.lo.arp_ignore = 0
net.ipv4.conf.lo.rp_filter = 1
net.ipv4.conf.wlan0.arp_announce = 0
net.ipv4.conf.wlan0.arp_filter = 0
net.ipv4.conf.wlan0.arp_ignore = 0
net.ipv4.conf.wlan0.rp_filter = 1

In other words, rp_filter is enabled on all interfaces,
and arp_filter / arp_ignore are left as default.

(2) Attach both WiFi and Ethernet to the same router. Run
"sysctl -a | egrep '(rp_filter|arp_announce|arp_ignore)'".
Output should be something like:

net.ipv4.conf.all.arp_announce = 0
net.ipv4.conf.all.arp_filter = 0
net.ipv4.conf.all.arp_ignore = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.arp_announce = 0
net.ipv4.conf.default.arp_filter = 0
net.ipv4.conf.default.arp_ignore = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.eth0.arp_announce = 2
net.ipv4.conf.eth0.arp_filter = 0
net.ipv4.conf.eth0.arp_ignore = 1
net.ipv4.conf.eth0.rp_filter = 2
net.ipv4.conf.lo.arp_announce = 0
net.ipv4.conf.lo.arp_filter = 0
net.ipv4.conf.lo.arp_ignore = 0
net.ipv4.conf.lo.rp_filter = 1
net.ipv4.conf.wlan0.arp_announce = 2
net.ipv4.conf.wlan0.arp_filter = 0
net.ipv4.conf.wlan0.arp_ignore = 1
net.ipv4.conf.wlan0.rp_filter = 2

In other words, rp_filter is set to "loose mode" on WiFi
and Ethernet. arp_filter and arp_ignore are also enabled
on those interfaces.

Change-Id: Id19e5b7101ba70f94aaa51b3ad6cc163a4bc0005
Reviewed-on: https://chromium-review.googlesource.com/229696
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
8d6b59704591ba9fad57751858835dc332dbdd37 28-Oct-2014 Peter Qiu <zqiu@chromium.org> shill: export a shared library for RTNL interface.

Export a shared library "libshill-net-<(libbase-ver)" from shill, which
currently includes the RTNL interface and other codes that it depends on
(mainly ByteString, IPAddress, IOHandler, TimeStamp, and Sockets). All the
library codes are moved to under "shill/net/".

Upcoming changes:
- Remove dependency for "shill/error.h" which depends on dbus-c++.
- Add Netlink interface to the shared library.

BUG=chromium:427982
TEST=unittests
CQ-DEPEND=CL:226103

Change-Id: I7f5c183b8a347c02e80ffed5e3497f691dde517c
Reviewed-on: https://chromium-review.googlesource.com/226110
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
815a6fb99abf0e4921e43784dd1d6f3fcf6415ba 24-Oct-2014 Samuel Tan <samueltan@chromium.org> shill: add function to check time till DHCP lease renewal

Add public function IPConfig::TimeToLeaseExpiry to check the time
left before the current DHCP lease is due to be renewed.

BUG=chromium:426657
TEST='P2_TEST_FILTER="shill::*" FEATURES="test" USE="clang asan"
emerge-samus shill' succeeds.

Change-Id: I80a912e86c677a98b48a22494e7bbc36a936cf3b
Reviewed-on: https://chromium-review.googlesource.com/225278
Reviewed-by: Samuel Tan <samueltan@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
Tested-by: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/device_unittest.cc
cd47732488cd101eaf0d3558dde5a7d4e4fc260b 17-Oct-2014 Ben Chan <benchan@chromium.org> shill: Replace scoped_ptr with std::unique_ptr.

BUG=None
TEST=`USE='wimax' FEATURES=test emerge-$BOARD shill`
TEST=`USE='wimax clang asan' FEATURES=test emerge-$BOARD shill`

Change-Id: Id9737d9a9c75ecb6abb466b5559ff06dcf0751cd
Reviewed-on: https://chromium-review.googlesource.com/224138
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/device_unittest.cc
e8303eb267df8904623f16cba64e87df6e8a1563 09-Oct-2014 Paul Stewart <pstew@chromium.org> shill: Device: Destroy dangling connection

When we disconnect, the refcounted connection_ object in the
device must be destroyed. This object's destructor removes
routing table entries and IP addresses. Before this CL, the
connectivity tester created dangling references to this
connection, which caused a left-over connection object to
remain even after the system had re-connected.

This dangling connection would only finally be removed when
a new connectivity report was created in
Device::StartConnectivityTest(), which would then remove the
(current) connection state from the device, rendering the
system routeless and IP-less.

This CL removes the old connectivity tester at the same time
as other objects that reference the connection (like the
portal detector), and adds a unit test to make sure that
the connection is dereferenced when DestroyConnection is
called.

BUG=chromium:421722
TEST=New unit test + manual:
- Connect to a wireless network
- Browse to "chome://system" (triggering a connectivity test)
- Disconnect and re-connect to the network
- Refresh the "chrome://system" table (re-triggering the test)
- Ensure the system still has connectivity

Change-Id: I94c316f89bd3f0dc9c1c11cfa0e8bb197653d415
Reviewed-on: https://chromium-review.googlesource.com/222458
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
cc225ef3b77b5e098cc12c661a947e1737480777 30-Sep-2014 Ben Chan <benchan@chromium.org> shill: Replace NULL with nullptr.

BUG=None
TEST=`USE=wimax FEATURES=test emerge-$BOARD shill`

Change-Id: I30ab47ff32dcadad09ae7a2baf4d4123a6ef0d8e
Reviewed-on: https://chromium-review.googlesource.com/220657
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/device_unittest.cc
f4365a68767063e87dc7f68ff24b6c3955e88c5d 16-Sep-2014 Rebecca Silberstein <silberst@chromium.org> shill: add single connectivity test for feedback

Perform a single connectivity test per connected service when the
CreateConnectivityReport d-bus command is issued.

BUG=chromium:402888
TEST=ran unit tests and manually tested on peppy with dbus-send.

To test:
dbus-send --system --print-reply --dest=org.chromium.flimflam \
/ org.chromium.flimflam.Manager.CreateConnectivityReport

Some logging will appear with INFO. More detailed logging can be found
with:
ff_debug +portal
ff_debug --level -3

Change-Id: I198c63c6358d639eeb522aeed105826bf04fc3ba
Reviewed-on: https://chromium-review.googlesource.com/220414
Reviewed-by: Rebecca Silberstein <silberst@chromium.org>
Tested-by: Rebecca Silberstein <silberst@chromium.org>
Commit-Queue: Rebecca Silberstein <silberst@chromium.org>
/system/connectivity/shill/device_unittest.cc
a0572036bd4374282fb26e861e7a242fe55a54a3 26-Sep-2014 Peter Qiu <zqiu@chromium.org> shill: Report network signal strength when link is perceived as unreliable.

Link is perceived as unreliable when more than one link monitor failures are
detected on the same network within the last 5 minutes. AP usually performs
rekey operation every 60 minutes, so the consecutive failures are most
likely related to the quality of the link (bad signal or noisy env).

Signal strength reported here is the normalize value, (120 + -dbm) in the
case of WiFi.

BUG=chromium:416631
TEST=unit tests

Change-Id: I6e20eb48405eec77a3fafb123babfb9dd823a5c3
Reviewed-on: https://chromium-review.googlesource.com/220170
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
d49760e19d137f43df29e00265259d395b07994c 20-Sep-2014 Peter Qiu <zqiu@chromium.org> shill: Add support for disable/enable link monitoring through DBUS

This is a per-service setting, with default value set to false
(link monitoring enabled).

BUG=chromium:415367
TEST=unit tests, manual test
Manual Test
1. Get a chrome device, and turn up the logging with
"ff_debug +device" and "ff_debug --level -2".
2. Connect to "GoogleGuest", verify link monitor is enabled
(by default) by examing log file "/var/log/net.log" for following
message "Link Monitor starting".
3. Disable link monitor for "GoogleGuest" with command
"/usr/local/lib/flimflam/test/set-service-property GoogleGuest
LinkMonitorDisable true"
4. Connect to a different network, then connect back to "GoogleGuest".
Verify link monitor is disabled by examing log file
"/var/log/net.log" for following message
"Link Monitor is disabled for the selected service".
CQ-DEPEND=CL:219029

Change-Id: I83aabe035f66eeaa9547a486d4677c7292247561
Reviewed-on: https://chromium-review.googlesource.com/219117
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
3d49ea435a59436f762c2cc5e750ff27ece0d3c5 21-Aug-2014 Rebecca Silberstein <silberst@chromium.org> shill: Create ConnectivityTrial class to hold logic for connection tests

Create a new class, ConnectivityTrial, that contains the logic and handling
for each attempt in portal detection. This separates the higher level logic
of retries and maximum number of attempts from the individual connection tests.

This architectural change enables code-reuse for an upcoming feature for on
demand connection testing.

BUG=chromium:402888
TEST=ran shill unit tests and tested on peppy

Change-Id: I90d2bca4cd0778c3aeac82677b675247769a5597
Reviewed-on: https://chromium-review.googlesource.com/216505
Commit-Queue: Rebecca Silberstein <silberst@chromium.org>
Tested-by: Rebecca Silberstein <silberst@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
6862b38f4691f6f927a5efffa3f587846ff96c72 11-Sep-2014 Rebecca Silberstein <silberst@chromium.org> shill: Add methods for handling connectivity report requests

Add necessary methods to handle requests for a ConnectivityReport. This
is the overall plumbing to handle the request and is not activated at
this time.

BUG=chromium:402888
TEST=ran unit tests

Change-Id: I560ce64337a89cf3520331950d59a268785d0a4c
Reviewed-on: https://chromium-review.googlesource.com/217796
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Rebecca Silberstein <silberst@chromium.org>
Commit-Queue: Rebecca Silberstein <silberst@chromium.org>
/system/connectivity/shill/device_unittest.cc
300769ea57941a26bccfa7fe1e1cc4d9ad96b23e 27-Aug-2014 Peter Qiu <zqiu@chromium.org> shill: Add UMA stats for tracking IPv6 connectivity

When a device is connected, report the IP type of its connection and
existence of complete IPv6 configuration (contain both global scope
addresses and DNS servers) to UMA stats.

BUG=chromium:207192
TEST=unit tests, manual
Manual Test:
1. Connect a Chrome device to "GoogleGuest", then browse to
"chrome://histograms", and verify there is a histogram for
"Network.Shill.Wifi.NetworkConnectionIPType" with a hit for bucket 0
(IPv4 connection) and a histogram for
"Network.Shill.Wifi.IPv6ConnectivityStatus" with a hit for bucket 0
(no complete IPv6 configuration).

Change-Id: I91dc72255e56a9cf24eaa85d77e8d23dcfc01783
Reviewed-on: https://chromium-review.googlesource.com/214504
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
cc67c52a2c00f90e877971d552208dd99825d84e 03-Sep-2014 Ben Chan <benchan@chromium.org> shill: Include base/macros.h instead of base/basictypes.h

shill no longer uses the integer types from base/basictypes.h. It should
simply include base/macros.h for the DISALLOW_COPY_AND_ASSIGN macro
instead.

BUG=None
TEST=`USE='cellular wimax' FEATURES=test emerge-$BOARD platform2`

Change-Id: I9b350c1bd9eff88e2c87de2ef8d607e90049e102
Reviewed-on: https://chromium-review.googlesource.com/216055
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/device_unittest.cc
b25083f4ec00167ceed71a7f961e3f1435dbe070 25-Aug-2014 Peter Qiu <zqiu@chromium.org> shill: Support for using IPv6 connection.

Added support for IPv6 connectivity to the device. The device will prefer
IPv4 configuration over IPv6, and will only use IPv6 configuration if
IPv4 configuration doesn't exist.

BUG=chromium:394010
TEST=unit tests, manual
Manual Test:
1. IPv4 regression test
a. Conenct the DUT to "GoogleGuest", verify the DUT have internet
connectivity by browsing to different websites.
2. IPv4-IPv6 coexistence test
a. Manually update the code to use Google's IPv6 DNS servers as
DNS servers for IPv6 configuration.
b. Connect the DUT to "GoogleGuest", verify the device have both
IPv4 and IPv6 configuration by running
"./usr/local/lib/flimflam/test/list-ipconfigs <interface>"
c. Verity the DUT have internet connectivity by browsing to different
websites.
3. IPv6 only test
a. Manually update the code to use Google's IPv6 DNS servers as
DNS servers for IPv6 configuration, and reject all IPv4 configuration.
b. Connect the DUT to "GoogleGuest", and verify device only have
IPv6 address by running "ifconfig".
c. Verify the device have internet connectivity by browsing to "google.com".
Only few websites support pure IPv6 currently, and "google.com" is one
of them. To visit other websites, website gateway/proxy such as
https://www.sixxs.net/tools/gateway/ can be used.

Change-Id: I5a754e461529d4016ee094a7f7e0b3eab03eca0f
Reviewed-on: https://chromium-review.googlesource.com/214062
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
f3a8f9064976d12c4f8ed3c6a5cc9ea4655c686d 20-Aug-2014 Peter Qiu <zqiu@chromium.org> shill: Add IPv6 connection support.

Added support to shill for it to be able to complete portal detection
using IPv6 connection. The IPv6 support is added to AsyncConnection,
DNSClient, and HTTPRequest.

BUG=chromium:394010
TEST=unit tests, manual test with future CL that initiate IPv6 portal
detection.

Change-Id: I20b768211f3ecfcd53406805038c0490a488ee78
Reviewed-on: https://chromium-review.googlesource.com/213273
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
25f1be6cc1919da0af4564127db3a98ab5555c10 12-Aug-2014 Peter Qiu <zqiu@chromium.org> shill: Support of DNS server in IPv6 configuration

Add IPv6 DNS server addresses received from kernel's RTNL notification
to device's IPv6 configuration. Also actively monitor the life time of
the DNS server, and remove it from IPv6 configuration when it expires.

BUG=chromium:394010
TEST=unit tests, run updated network_Ipv6SimpleNegotiation test (CL:212121)

Change-Id: I3cb08dd139f8de983dc2a9f7606ae234e7563340
Reviewed-on: https://chromium-review.googlesource.com/212073
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
9b83c897f8e197ff7846e4fe7cec1d83d54e7b7b 10-Aug-2014 Peter Qiu <zqiu@chromium.org> shill: Export portal detection failure phase and status

When portal detection fails, report the failure phase and status
to the given Service. The Chrome can then retrieve this information from
Service property through DBUS, and inform the user appropriately.

BUG=chromium:399486
TEST=unit tests
CQ-DEPEND=CL:211763

Change-Id: I27ec85bc6bf73162b1214d35bc84084588c3a855
Reviewed-on: https://chromium-review.googlesource.com/211745
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
7fab89734d88724a288e96a9996b15548c5294c7 11-Aug-2014 Ben Chan <benchan@chromium.org> shill: Use integer types from stdint.h

This CL replaces the deprecated int* and uint* types from
'base/basictypes.h' with the int*_t and uint*_t types from 'stdint.h'.

BUG=chromium:401356
TEST=`USE='cellular gdmwimax wimax' FEATURES=test emerge-$BOARD platform2`

Change-Id: I3d4c195881203dd2a47dbb5af150b6c90b9c206e
Reviewed-on: https://chromium-review.googlesource.com/211770
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/device_unittest.cc
a41ab517725d036b63420f8445550246f8f50b99 23-Jul-2014 Alex Vakulenko <avakulenko@chromium.org> shill: Sort headers alphabetically (build/include_alpha)

We are going to enable build/include_alpha linter warning soon,
so in preparation for this, fixed the warnings in shill.

BUG=None
TEST=cpplint.py --filter=-build/include_order,+build/include_alpha shill/*

Change-Id: I113ed7f9dd3f465a3f660599320cdb434e7cc214
Reviewed-on: https://chromium-review.googlesource.com/209636
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
/system/connectivity/shill/device_unittest.cc
6f5618beb7e382b1b122e7a63b63f1bca7723417 06-Jun-2014 Peter Qiu <zqiu@chromium.org> shill: Switch back to configured DNS servers

Proactive test the configured DNS servers after switching to
fallback DNS servers. Switch back to the configured DNS
servers if the configured DNS servers are detected to be working again.

BUG=chromium:377056
TEST=unit tests, manual test
Manual Test:
1. Manually change the code to allow DNS auto fallback, and save the
config_dns_servers_ to "8.8.8.8".
2. Connect a chrome device to "GoogleGuest", set the DNS servers
for the network to an unknown IP address "192.168.1.1".
3. Browse to "chrome://net-internals/#dns", and verify the
nameservers changed from "192.168.1.1" to Google's DNS servers
(8.8.8.8 and 8.8.4.4), and then switch back to the "configured"
DNS servers (8.8.8.8).

Change-Id: Iff008628419f4090a0bfe246f95e73c1243e64bb
Reviewed-on: https://chromium-review.googlesource.com/207165
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
0d06119be3224788ba1aa65ed24bc8e46b56b949 08-Jul-2014 Samuel Tan <samueltan@chromium.org> shill: add disconnect reason to log messages

Allow logging of function/reason for triggering disconnect.

BUG=chromium:227295
TEST=unit tests

Change-Id: I92ea3cca664c060bc02bbb8d50d303ce11d1a7de
Reviewed-on: https://chromium-review.googlesource.com/207020
Tested-by: Samuel Tan <samueltan@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/device_unittest.cc
d670d03b90f4372bb085c7d2a128c6025e998d78 04-Jun-2014 Peter Qiu <zqiu@chromium.org> shill: Refactor DNS server testing code

Implement the DNSServerTester class for performing DNS server test
in shill. This class will be used for performing DNS test for fallback
DNS servers and configured DNS servers.

BUG=chromium:377056
TEST=unit tests, manual test
Manual Test:
1. Connect a chrome device to "GoogleGuest", set the DNS servers
for the network to an unknown IP address "192.168.1.1".
2. Browse to "chrome://histograms", and verify there is a histogram
for "Network.Shill.Wifi.FallbackDNSTestResult".

Change-Id: Iaf9c0322501ae273f4635f1d865d41f8f51b114f
Reviewed-on: https://chromium-review.googlesource.com/207136
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
a89154bfedfd8872242083ffe4f084fdc774c078 24-May-2014 Peter Qiu <zqiu@chromium.org> shill: Support of DNS auto fallback

Automatically switch to fallback DNS server when broken DNS setting
is detected. This feature is disabled by default (due to property
defaulting to "false").

BUG=chromium:377056
TEST=unit tests, manual test
1. Manually update the code to allow DNS auto fallback.
2. Connect a chrome device to GoogleGuest.
3. Update the name servers setting to an invalid
DNS server "192.168.1.1"
4. Browse to "chrome://net-internals/#dns", and verify
the nameserver changed from "192.168.1.1" to Google's
DNS servers "8.8.8.8" and "8.8.4.4" within a minute.
CQ-DEPEND=CL:201412

Change-Id: I31dbaf715b5b11dd2f736e0664ee432e55bdeeb9
Reviewed-on: https://chromium-review.googlesource.com/207155
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
b108318d9554032feee1249d51c961e4f90f4561 25-Jun-2014 Paul Stewart <pstew@chromium.org> shill: DHCPConfig: Remove use of minimal config

This reverts commit 397f1892a0f1042fba4b3d8e8fa5d57569deaab1,
but retains the DHCPArgs matcher in dhcp_config_unittest.cc.

BUG=chromium:360452
TEST=Unit tests

Change-Id: I18ab78a8e9e66a102a910a7116e80598a2892944
Reviewed-on: https://chromium-review.googlesource.com/205589
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
7b5cee92f29791ebd3867b858fc1d301b39d26bd 25-Jun-2014 Paul Stewart <pstew@chromium.org> shill: Service: Remove DHCP minimal config code

This code does not end up being very useful (as evidenced by
UMA stats) and can reduce functionality in infrastructures
that require the use of some DHCP options.

This reverts commit 26a997b04bd65a6252987ea6fdcbbb70785d1d8d,
except for the cleanup of "*service" in unit tests and the
setting of SelectedService in ethernet.cc.

BUG=chromium:360452
TEST=Unit tests

Change-Id: Ib2c49fc5639452bfffd5cd03c1bb69e32568cc60
Reviewed-on: https://chromium-review.googlesource.com/205588
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
8a5322984f2d81bcbfd8d44c59747a11bd9b904b 17-Jun-2014 Alex Vakulenko <avakulenko@chromium.org> shill: Fix most of warnings from cpplint

Fix most cpplinter's warnings. On a few occasisions, the warnings
produced were false-positives, so added explicit // NOLINT comment
overrides.

There were a few instances of disallowed non-const reference usage
(reported as runtime/reference error by cpplint) for
"DBus::Error &error" which should potentially be changed
to pointers to comply with C++ coding style but I will let Shill
owners do that since there is quite a few of those and the
change isn't brain-dead simple...

BUG=None
TEST=platform2 still compiles and all unit tests pass.

Change-Id: Ic2e31896aa13d20eeb1a85dee74f3db8cccfde2e
Reviewed-on: https://chromium-review.googlesource.com/204164
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
/system/connectivity/shill/device_unittest.cc
f18e7717c642dcfd6b4dbe1f01f50e2d9671f5ce 20-May-2014 Peter Qiu <zqiu@chromium.org> Update FallbackDNSTestResult metric.

Update the metric for FallbackDNSTestResult to be technology specific.

BUG=chromium:366301
TEST=unit tests, manaul
Manual Test:
1. Connect a chrome device to an AP with no internet access, then
browse to "chrome://histograms" and verify there is a histogram
for "Network.Shill.Wifi.FallbackDNSTestResult".

Change-Id: I12606d34bede86557d00e0cb5b32b0c12ad37710
Reviewed-on: https://chromium-review.googlesource.com/200573
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
dc335f81a9d0ffe8efd02a96d3cd17399a06e61e 15-May-2014 Peter Qiu <zqiu@chromium.org> UMA Metric for reporting network problem while connected.

Added a UMA metric for reporting network problem while connected to
a network. Network problem is detected by TrafficMonitor. Max of one
network problem will be reported per connection.

BUG=chromium:374274
TEST=unit tests, manual
Manual Test:
1. Connect a chrome device an AP without internet access.
2. Wait for few minutes, then browse to "chrome://histograms", and verify
there is a histogram for Network.Shill.Wifi.NetworkProblemDetected".

Change-Id: Iad019d147feebcd429445c687a7c37d8e1e281f9
Reviewed-on: https://chromium-review.googlesource.com/200469
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
b9256f3d485e4c6c5c301a0aa00554059473b41d 10-May-2014 Peter Qiu <zqiu@chromium.org> Add metric for broken DNS configuration.

Attempt a DNS test using Google's public DNS server if portal detection
failed due to DNS failure, and report the result of the DNS test
to UMA metric.

BUG=chromium:366301
TEST=unit tests, manual
Manual Test:
1. Connect a chrome device to an AP with no internet access,
then browse to "chrome://histograms" and verify there is a
histogram for "Network.Shill.DNSTestResult" with a hit for
value 1 (Failure).
2. Manually update the code to perform DNS test when portal detection
succeed. Connect a chrome device to "GoogleGuest", and verify
there is a hit for value 0 (Success) for the histogram
"Network.Shill.DNSTestResult".

Change-Id: I8cb22f7664fcfa7fd08d3d3dd24902f7896a4e3e
Reviewed-on: https://chromium-review.googlesource.com/199174
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/device_unittest.cc
d4f26486b237fae831d4b682481de785fc99c66e 26-Apr-2014 Paul Stewart <pstew@chromium.org> shill: Device: Report IPv6 address

Have the Device query DeviceInfo for the primary IPv6 address
every time DeviceInfo notifies it of a change. Use the output
of this to add another IPConfig object to the list reported if
this address exists.

While here, emit a property change event from the "IPConfigs"
property if either the IPv4 or IPv6 ipconfigs change.

BUG=chromium:365883
TEST=Unit tests, upcoming change to network_Ipv6SimpleNegotiation
(CL:197394). Manual: list-ipconfigs while connected to a network
that supplies IPv6 global prefixes.

Change-Id: I28771acd3e990a9bea7f5988cc382a5cd9e91f1f
Reviewed-on: https://chromium-review.googlesource.com/197304
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
1793c3169f7e29ec6f2b9bfab278c48608351da3 26-Apr-2014 Paul Stewart <pstew@chromium.org> shill: IPConfig: Don't persist data

IPConfig objects in shill are only useful for reporting state
over the RPC API. They are read-only, and no state is loaded
or used. At the start of shill development an effort was made
to have IPConfigs save their "Type" property as well as for
the Device object to save an "IPConfigs" property that
referred to them. This may have been in order to maintain
some level of file-compatibility with flimflam, but even this
is no longer necessary.

This CL removes the Load and Save methods from IPConfigs, and
rips away everything that depended on it.

BUG=None
TEST=Unit tests, manual: start shill

Change-Id: I5b5aa562c015d1f9b069dd28dd662022bb1e7240
Reviewed-on: https://chromium-review.googlesource.com/197160
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
1f916e4adae8f937b9023e74307bde8ef8743282 23-Dec-2013 Paul Stewart <pstew@chromium.org> shill: DhcpConfig: Vacate lease if it expires

If the DHCP client fails to renew a lease, we should disconnect
the service, and stop using the IP address. We implement this
by adding a timer to the DHCPConfig that re-starts the DHCP
instance if the lease is not renewed before the lease expires.
This covers a variety of situations where the DHCP client was
unable to acquire a lease in time:

- The DHCP server was actively denying a renewal
- The DHCP server stopped responding responding
- The DHCP client encountered some failure but didn't exit

By restarting the DHCP instance, we start a fresh DHCP process
with a new acquisition timer. If this acquisition process times
out the service will disconnect with a DHCP failure.

BUG=chromium:216710
TEST=Unit tests; modified network_DhcpRenew autotest (CL:181069)

Change-Id: I63037246f9fefca65a4c0f5ca30a29ac39a51662
Reviewed-on: https://chromium-review.googlesource.com/181133
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
c5099532b82fe201fe2510c43b529944a0930d2e 12-Dec-2013 Paul Stewart <pstew@chromium.org> shill: IPConfig: Don't reset StaticIP on failure

If the IP address associated with an IPConfig is provided by
StaticIP, the entire configuration should be retained even if
the automatic configuration method fails. Otherwise,
configuration parameters provided outside of the automatic
configuration mechanism will be lost.

To accomplish this cleanly, we need to change the contract
between IPConfig and Device objects. The failure and success
events are now split into separate callbacks. Intead of
passing a bool parameter to OnIPConfigUpdated, failure cases
are handled by a separate method. Further, there is no
expectation in the failure case that the IPConfig resets
itself, so the IPConfig provides a public method for the
Device to call if it chooses.

BUG=chromium:318290
TEST=Unittest, new autotest network_DhcpFailureWithStaticIP (CL:179783)
All other network_Dhcp* unit tests run.

Change-Id: I55ed5a7adfc5d97e45ce832e25caab97ff39cea6
Reviewed-on: https://chromium-review.googlesource.com/179786
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
fa11e28ddb81dab93971d5433a5274a1dc5c8283 03-Dec-2013 Paul Stewart <pstew@chromium.org> shill: Service: Provide "Tethering" property

Present a service property that indicates whether the service's
connectivity is likely to be provided via a cellular backhaul.

BUG=chromium:323010
TEST=Unit tests; autotest at https://chromium-review.googlesource.com/178577
Manual: list-services with both an iPhone and Nexus in tethering mode. Note
that both are listed with "Tethering: Suspected". After connecting to the
Android phone, the "list-services" shows "Tethering: Confirmed".
CQ-DEPEND=CL:178563

Change-Id: Iefde3a71008a0a3d7e452d740cfa3bbb610b502b
Reviewed-on: https://chromium-review.googlesource.com/178575
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
c6fbad96f565fda1caae9cd80569314685c99b90 13-Nov-2013 Paul Stewart <pstew@chromium.org> shill: WiFi: Add TDLS operations to Device RPC API

Add a "PerformTDLSOperation" method to the Device API. This is
only implemented in WiFi, which dispatches to the various TDLS
methods available on the supplicant proxy.

CQ-DEPEND=CL:176670
BUG=chromium:316758
TEST=Unit tests

Change-Id: I9c2179111fe61d5f520ced5f1f6561c01d9aeeb7
Reviewed-on: https://chromium-review.googlesource.com/176720
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
bcc6e016d71c396feefa1ace75b5dcfcd116c659 04-Nov-2013 Ben Chan <benchan@chromium.org> shill: cellular: Temporarily disable IPv6 support on cellular devices.

BUG=chrome-os-partner:22302
TEST=Tested the following:
1. Build and run unit tests.
2. Manually verify that no IPv6 address is acquired on the modem in Spring.

Change-Id: Ia67f5a91819dba73af9e1807559a588fd20e6fe3
Reviewed-on: https://chromium-review.googlesource.com/175613
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
/system/connectivity/shill/device_unittest.cc
43ce4d428d619bda64eea6d37534f02c179a1756 05-Oct-2013 Thieu Le <thieule@chromium.org> cellular: Improve out-of-credits detection

Refactor out-of-credits detection from cellular, service and capability
into its own class. Add support for detecting out-of-credits using
subscription state.

BUG=chromium:273849
TEST=Unit tests, Manually exhaust SIM data on Pixel and verify
out-of-credits warning is displayed in UI

Change-Id: I31b1d4d2fac31c31bf509787f7edb86cff29f9f6
Reviewed-on: https://chromium-review.googlesource.com/171909
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
/system/connectivity/shill/device_unittest.cc
dded00702cf33f15b1f2eaafbbaccc13231e08d8 24-Oct-2013 Paul Stewart <pstew@chromium.org> shill: Service: Track DHCP failures and inform ShouldUseMinimalDHCPConfig()

The default DHCP configuration used by ChromeOS requests a
large number of options in order to support features like
Web Proxy Auto-Discovery. Unfortunately this practice
sometimes runs afoul of issues in some network topologies.
In some networks, a large number of option values in the
DHCP response can cause MTU problems with proxies or other
network elements. This may prevent the reply from being
forwarded back to the client.

Although the problem may not lie with the outgoing request,
it may be possible to mitigate this issue by modifying these
requests. This CL provides a means for the Service to track
such failures and infer from a series of experiments whether
it is likely to be due to an MTU issue. To do this, the
Device informs the selected Service of each DHCP success and
failure, and queries the Service before starting each DHCP
session to inquire whether it should request an extensive or
minimal DHCP options from the server.

In order to detect and respond to such issues, this CL
maintains state in the Service about how DHCP has been
performing. If there have been a spate of recent DHCP
failures, we should suspect that this may be due to the
number of options we are requesting from the DHCP server.

We should confirm that this is in fact the issue by testing
whether a request for a smaller response succeeds. If this
request succeeds we can consider the hunch confirmed and the
client should switch to using small requests for some period
of time. If our test request fails, we can assume for now
that the problem isn't realated to a DHCP response size and
return to the default behavior.

If we have confirmed our hunch earlier and the time period
expires, we should try again to use a more comprehensive
DHCP request. If this succeeds, we can assume either the
network infrastructure has repaired itself or that the
previous hunch was in error, and return to the "not
detected" state. If it fails, we should confirm whether
this is the identical problem to before by re-testing a
small DHCP request size. Since the "confirmed" state did
not pay attention to DHCP failures, it's possible that they
have been failing across the board as of late. If indeed
both large and small DHCP responses fail to reach us, we
should put off our re-test until we start receiving DHCP
replies again.

The state machine implemented for DHCP failures is
illustrated in state machine diagram below (all events not
shown do not cause a state change):

[ Not Detected (send full request) ] <------------
| ^ |
| | |
n * failure failure |
| | |
V | |
[ Suspected (send minimal request) ] |
| |
success |
| |
V |
[ Confirmed (send minimal request) ] |
^ | |
| hold timer elapsed |
| | |
success V |
| [ Retest Full Request ] ----success--/
| | ^
| failure |
| | |
| V |
[ Retest Minimal Request ] |
| success
failure |
| |
V |
[ Retest With No Reply (send minimal requests) ]

The Service only persists two states: "Not Detected" and
"Confirmed". This is done via the presence or absence of
the stored "LastDHCPOptionFailure" property, which is the
time the system last entered the "Confirmed" state. A
third state, "Reset Full Request" is implicitly persisted
if this timestamp is old enough that the hold timer has
expired.

BUG=chromium:297607
TEST=Unit tests

Change-Id: I1ee83debf4d11f25678fe3586574ec04f254a83f
Reviewed-on: https://chromium-review.googlesource.com/174634
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
75a68b9f230c7715cc24feee8a713e75e6e7f231 24-Oct-2013 Paul Stewart <pstew@chromium.org> shill: DHCPConfig: Optionally use minimal config

Add another argument to the DHCPConfig constructor to specify
whether a cut-down minimal set of options should be requested
from the DHCP server. This adds a command line argument to
the startup of the DHCP client. Propagate this upwards to the
Device, and add a placeholder Device::ShouldUseMinimalConfig()
method which will decide whether to enable this feature in the
DHCPConfig in a later CL.

A few ancillary changes went into this CL:

- The DHCPProvider needed another argument to CreateConfig
since it constructs DHCPConfig objects.
- Added a unit test for the Device::ShouldUseArpGateway()
superclass function next to Device::ShouldUseMinimalConfig()
test.
- Fixed the DHCPConfigTest::Start* tests to use the IsDHCPCDArgs
matcher. For some reason that matcher sat unused and
atrophied. Added a new test that exercises the minimal config
flag.

BUG=chromium:297607
TEST=Unit tests. Run network_DhcpNegotiationSuccess autotest.

Change-Id: If0dcaf328ca6dfac7127a6badd409a4138c95760
Reviewed-on: https://chromium-review.googlesource.com/174531
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
9f3dcf80a84c07701b7c224fca5ed637c966fa3e 26-Sep-2013 Ben Chan <benchan@chromium.org> shill: cellular: Disable modem before system goes into suspend.

This CL changes the termination action in cellular code to disable the
modem, instead of simply disconnecting from network, before the system
goes into suspend mode. The modem is re-enabled, and conditionally
auto-connected back to network, after the system resumes from suspend
mode.

BUG=chromium:298403
TEST=Tested the following:
1. Build and run unit tests.
2. Run the following autotest tests with E362, E396, ALT3100, MU736:
- network_3GSmokeTest
- network_3GModemControl
- network_MobileSuspendResume
3. Manually verify the following:
- When auto-connect is enabled, suspend the system for 20s and then
resume it. Verify from /var/log/net.log that the modem is disabled
before the system goes into suspend mode, and re-enabled and
reconnected to network after the system is resumed.
- When auto-connect is disabled, suspend the system for 20s and then
resume it. Verify from /var/log/net.log that the modem is disabled
before the system goes into suspend mode, and re-enabled but not
reconnected to network after the system is resumed.

Change-Id: Id60eb7bc25b6484c13f28331062d7b67c726a0ad
Reviewed-on: https://chromium-review.googlesource.com/171374
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/device_unittest.cc
923a5025a5e1138b052cbeffa60ea387d479696f 20-Sep-2013 Ben Chan <benchan@chromium.org> shill: Deprecate flimflam namespace.

CL:170123 moves all DBus service constants from the flimflam namespace
to the shill namespace. This CL removes the use of the flimflam
namespace in device, manager, metrics, service and technology code.

BUG=chromium:295425
CQ-DEPEND=CL:170123
TEST=Unit tests and trybot runs on release builders.

Change-Id: Ic9a853cbb623ec7e996dfc7590039dbe2d245db9
Reviewed-on: https://chromium-review.googlesource.com/170205
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/device_unittest.cc
2f352e606bbe6074eeca93eb457837e501420be7 29-Aug-2013 Arman Uguray <armansito@chromium.org> shill: Enable/Disable should return error if opposite operation pending.

Device::SetEnabledPersistent will now return an error, if the device is
already in the requested state but there is a pending operation trying
to achieve the opposite. This is to work around a problem where the user
might try to enable a technology immediately after disabling it but
before the disable ends. Since shill doesn't return an error in this
case, the UI doesn't get informed that the enable request it recently
issued won't succeed and incorrectly assumes that the device is still
enabling, which in turn prevents the user from ever enabling that
technology without restarting the UI.

BUG=chromium:280902
TEST=Build and run unit tests. Through the status tray UI:
1. Disable cellular, and then quickly enable.
2. The toggle should soon update to show that cellular is disabled.

Change-Id: I405a10e5ca366415e805f6c909da30c5d856b4b7
Reviewed-on: https://chromium-review.googlesource.com/167417
Reviewed-by: Arman Uguray <armansito@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Arman Uguray <armansito@chromium.org>
/system/connectivity/shill/device_unittest.cc
d30df3c55b46e19686188e359d052ccfbffe8e4f 31-Jul-2013 mukesh agrawal <quiche@chromium.org> shill: remove unused method DeviceAdaptorInterface::UpdateEnabled

I'm not sure what this method was supposed to do, but it looks like
it's been empty since time immemorial. Let's nuke it.

BUG=None
TEST=unit tests

Change-Id: Ief487561c826b57a365f2e5013dee204c3b7f1c0
Reviewed-on: https://gerrit.chromium.org/gerrit/63974
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/device_unittest.cc
bb2231c2d6e39267a3f9e55e74efd9a1ea8e4c98 18-Jul-2013 mukesh agrawal <quiche@chromium.org> shill: accelerate link monitoring after a suspend/resume event

When going into suspend, devices using the ath9k chipset do not disassociate
from the AP. Consequently, on networks like GoogleGuest, we are often able
to re-use the prior-to-suspend association following resume.

For some APs, however, this leads to the AP ending up in a confused state.
In particular, the Airport Extreme 802.11ac (A1521) sends DEAUTH frames
while we're sleeping, but it acknowledges our Nullfunc frames when we resume.
In fact, the AP even answers our ADDBA request with a Successful ADDBA respone.
When in this state, however, the AP does not deliver our frames to the IP
stack. E.g. ARPs fail.

Improve our post-suspend-resume behavior on these APs by running LinkMonitor
immediately on resume, and with a lower timeout. We use a per-probe timeout
of 200ms, which is at the 98.48%-ile of ARP response time observed in the
field last week. The total timeout is 1 second, and I believe we accept
late replies, so if the first ARP probe is replied too slowly, we'll still
accept it. A one-second ARP reply is at the 99.24%-ile.

Note that after LinkMonitor fails, it still takes ~10 seconds to establish
connectivity to this AP. That's because the Reassociate attempt times out.

While there:
- clarify a log message in Device::StopPortalDetection
- fix bad indent in LinkMonitor::StartInternal
- add some diagnostic infomation in cases where the IsArpRequest
matcher fails to match expected values

BUG=chromium:244920
TEST=unit tests, manual (see below)

Manual testing
--------------
1. grab a device which has an atheros wifi chip (e.g. lumpy, link)
2. connect to "cros airport extreme wpa2", with password "chromeos"
3. suspend device (e.g. close lid)
4. wait >5 minutes.
5. resume device (e.g. open lid)
6. verify that the device detects a link failure in < 5 seconds
"Link monitor has reached the failure threshold" should occur
less than 5 seconds after "OnAfterResume" in /var/log/net.log
7. wait 15-20 seconds
8. verify that the device reconnects to the AP
9. wait 45 seconds
10. verify that the device does not detect another link failure
11. switch to GoogleGuest.
12. suspend device
13. wait >5 minutes
14. resume device
15. check that device does not detect a link failure

Change-Id: I900ba45714875f5785bba3d47c73f37b863553fb
Reviewed-on: https://gerrit.chromium.org/gerrit/63126
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/device_unittest.cc
ba99b598d3f399a41e57f49dccac5f988e653126 18-Apr-2013 Prathmesh Prabhu <pprabhu@chromium.org> shill: Create an IPAddress store in Manager for ConnectionHealthChecker

(1) Added class IPAddressStore
(2) Added an IPAddressStore object to Manager
(3) ConnectionHealthChecker uses this object so that the store persists
across Device resets.

BUG=chromium:232883
TEST=(1)build and run unit-tests.
(2)Check that DHCP renewal works -- connect the device to the same
wifi network twice and verify wifi is connected.

Change-Id: Ia5ee314db46c3de2e037f59c1f99a248c80e4ef9
Reviewed-on: https://gerrit.chromium.org/gerrit/49487
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
/system/connectivity/shill/device_unittest.cc
41a071e432b09ab1945f5c9ae74c998726142810 26-Apr-2013 Paul Stewart <pstew@chromium.org> Revert "shill: Create an IPAddress store in Manager for ConnectionHealthChecker". This breaks all DHCP networks.

This reverts commit d8468b4fc2a7e071f3d4aff05b65ac8aa84ebdd4

Change-Id: Ic6ab705a6699039336e2407a87e48180b0cefffb
Reviewed-on: https://gerrit.chromium.org/gerrit/49316
Reviewed-by: Philipp Neubeck <pneubeck@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
d8468b4fc2a7e071f3d4aff05b65ac8aa84ebdd4 18-Apr-2013 Prathmesh Prabhu <pprabhu@chromium.org> shill: Create an IPAddress store in Manager for ConnectionHealthChecker

(1) Added class IPAddressStore
(2) Added an IPAddressStore object to Manager
(3) ConnectionHealthChecker uses this object so that the store persists
across Device resets.

BUG=chromium:232883
TEST=build and run unit-tests.

Change-Id: I0d4f6de7c2c4d3b92bff76a4de3c663a42b9389f
Reviewed-on: https://gerrit.chromium.org/gerrit/48445
Reviewed-by: Arman Uguray <armansito@chromium.org>
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
/system/connectivity/shill/device_unittest.cc
ade9b9a914efaeac3b2f4d4888ffdfb3e76b76f6 23-Apr-2013 Prathmesh Prabhu <pprabhu@chromium.org> shill: Make multiple TCP connections in ConnectionHealthChecker and
decide based on the whole sample

BUG=chromium:232136
TEST=(1) Build and run unit-tests
(2) Test that there aren't many false positives in out-of-credit
detection.

Change-Id: I3fa9d926536a2085dcdd8e6f7f92363e437a0b9f
Reviewed-on: https://gerrit.chromium.org/gerrit/48860
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
/system/connectivity/shill/device_unittest.cc
f84a4242b4218dc375449ab2d68085226f43ce5b 10-Apr-2013 Arman Uguray <armansito@chromium.org> shill: cellular: Use ConnectionHealthChecker for out-of-credit detection

Added code to trigger active connection monitoring using
ConnectionHealthChecker to detect out-of-credit scenarios, when:

1. TrafficMonitor detects congestion and thus a possible out-of-credit
situation;

2. Portal detection fails after Cellular connects.

BUG=chromium:225912,225915
TEST=1. Build and run unit tests.
2. While using a link device, run it out of credit. An
out-of-credit dialog should pop up and the service should
disconnect,
3. While on a link device with an out-of-credit SIM, try to connect
to Cellular. If it successfully connects and the connection
does not drop, an out-of-credit dialog should pop up and the
service should disconnect.

Change-Id: If70069c3630757b74099a4cefdfe6c67d8d308de
Reviewed-on: https://gerrit.chromium.org/gerrit/47717
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: Arman Uguray <armansito@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
/system/connectivity/shill/device_unittest.cc
b061f89e7088c7fba50b49ee5ac876619c9e8a7e 28-Feb-2013 Ben Chan <benchan@chromium.org> Add a traffic monitor to detect abnormal scenarios.

This CL implements a traffic monitor to detect abnormal scenarios on an
network connection. The traffic monitor can be conditionally enabled on
a device. It starts periodically sampling the receive and transmit byte
counts on a enabled device after the device establishes a connection.
When it sees that there is outgoing traffic but no incoming traffic for
some sampling periods, it invokes a callback to notify such a scenario.

BUG=chromium-os:39433
TEST=Built and ran unit tests.

Change-Id: I22b43fae53365544f595a630bff1b8d90b478e95
Reviewed-on: https://gerrit.chromium.org/gerrit/44403
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/device_unittest.cc
6c1e3bbca64d642cb30ed9952203626942bc1451 07-Feb-2013 Thieu Le <thieule@chromium.org> shill: cellular: Add Network.Shill.Cellular.DropsPerHour.

BUG=chromium-os:38557
TEST=Unit tests, manually lose LTE signal and check chrome://histograms

Change-Id: I82aa1edabd21c5dfde4834cd36a34a12b629ba8f
Reviewed-on: https://gerrit.chromium.org/gerrit/42813
Reviewed-by: Arman Uguray <armansito@chromium.org>
Commit-Queue: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
/system/connectivity/shill/device_unittest.cc
ad663e146042b80fcaaaa4902e6ddc156140a356 08-Jan-2013 Ben Chan <benchan@chromium.org> shill: Add a 'Reset' DBus method to Device interface.

BUG=chromium-os:37678
TEST=Build and run unit tests.

Change-Id: I252ef14ff0b7e89e6e09e3590b270c346fd6a9da
Reviewed-on: https://gerrit.chromium.org/gerrit/40590
Commit-Queue: Ben Chan <benchan@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/device_unittest.cc
abd3b50b0c3b6cde124892134091328d2b6dd5e3 26-Sep-2012 Christopher Wiley <wiley@chromium.org> shill: Disconnect a service on DHCP lease failure

Fix a bug where failing to acquire a DHCP lease would result in
permanent device offline state. This happens because marking a service
as disconnected doesn't work through any of the logic to trigger an
actual disconnect from the actually fully associated service. For
instance, in WiFi's case, this leaves the service associated in the
eye's of wifi.cc, but in some state outside of the typical state machine
for connecting services. Thus shill does nothing, leaving users to
wonder.

device.cc should ask the service to disconnect itself rather than
changing its state unbeknownst to the service. However, there does not
seem to be a path to disconnect a service without marking the disconnect
as user initiated. Create such a path. I've gone over the callsites
and looked for places where they might assume that the service won't be
autoconnected again, and not found problems on inspection. At worst,
we'll just be auto connecting some services we didn't used to. In some
places, like cellular, it seems like we Disconnect when we find we are
roaming, which doesn't seem like a permanent/non autoconnectable
offense.

TEST=Unit tests
BUG=chromium-os:32279

Change-Id: I34b60f3c009c276efac5d7e51495dc5681bf4b5f
Reviewed-on: https://gerrit.chromium.org/gerrit/34195
Commit-Ready: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Tested-by: Christopher Wiley <wiley@chromium.org>
/system/connectivity/shill/device_unittest.cc
c8860617a9a9478934c00668ebd4c120a9d38986 28-Sep-2012 Paul Stewart <pstew@chromium.org> shill: Device: Stop LinkMonitor on selected Service transition

Just as we destroy the current Connection when the selected
Service changes, we should also destroy the current LinkMonitor,
since the previous connection no longer exists. Do the same
for PortalDetection since they are in the same boat.

BUG=chrome-os-partner:14886
TEST=Unit tests

Change-Id: Ia9754e4d4b18ae76e4a889a097229ab266877a23
Reviewed-on: https://gerrit.chromium.org/gerrit/34280
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
d176092734304a3ec5ca74d3f4f8e4da3ddaa1fb 11-Sep-2012 Thieu Le <thieule@chromium.org> shill: Fix crash when service is disabled after receiving IP config.

BUG=chromium-os:34127
TEST=Unit tests, network_3GSmokeTest

Change-Id: Ie3cfdcfec4906b089248a357826473e1ec237941
Reviewed-on: https://gerrit.chromium.org/gerrit/32973
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
/system/connectivity/shill/device_unittest.cc
036dba0c6641acdbe02d52260c6fa6dca84b1af2 07-Aug-2012 Paul Stewart <pstew@chromium.org> shill: Device: Add LinkMonitor

Start link monitoring for technologies for which it is enabled.
Add facilities in the manager and default profile to determine
and persist a list of technologies for which link monitoring
is enabled. Provide a means for the Device to report the current
rolling average LinkMonitor response time.

BUG=chromium-os:32600
TEST=Unit tests

Change-Id: I39dcc8ce2332d7be3c95d9953b4ae7d7172d7df1
Reviewed-on: https://gerrit.chromium.org/gerrit/29731
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
784566d196431b97657760cab5d805a020b2712a 09-Aug-2012 mukesh agrawal <quiche@chromium.org> shill: renew DHCP on resume

When the system resumes, we should renew our DHCP lease. This is
because the alarm that dhcpcd uses for DHCP renewals doesn't
advance to reflect time spent suspended.

We could modify dhcpcd to use alarms that do include time spent
suspended, but that's a bigger change than I'd really like to make.
(We'd need to use create_timerfd/set_timerfd, and modify the kernel
to allow a timerfd to be bound to CLOCK_BOOTTIME.)

Renew-on-resume is implemented by having Manager call an event handler
on each Device, as the system resumes. The Device is responsible for
poking its IPConfig object to actually renew the DHCP lease.

While there, I added a call from Manager to Devices for suspend events
as well.

BUG=chromium-os:33219
TEST=new autotests, manual (see below)

Manual testing:
- Connect WiFi to GoogleGuest.
- "echo > /var/log/messages"
- Suspend the device.
- Resume the device 60 seconds later.
- Check that /var/log/messages includes "dhcpcd[<pid>]: wlan0:
rebinding lease", and that WiFi did not disconnect before that
message showed up.
- NB: Testing on Ethernet did not work, because the link went down
during suspend. (Thus, on resume, there was no ipconfig set, and
Device could not renew.)

Change-Id: I76e29c68882415ebb34759aba98a40ecb5e1694b
Reviewed-on: https://gerrit.chromium.org/gerrit/29766
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/device_unittest.cc
6ff27f578d3a4474d82dc3881441fc365e813ec9 11-Jul-2012 Paul Stewart <pstew@chromium.org> shill: Device: Add receive / transmit byte count properties

Create "RecieveByteCount" and "TransmitByteCount" properties for
Devices, which increment persistently across shill instances. Also
create a "ResetByteCount" method on Devices to set these counters
back to zero.

BUG=chromium-os:31584
TEST=New unit tests; list-devices on a real machine. Restart shill,
and ensure byte counts are persisted to disk. Write a "reset-counters"
test script and ensure that this resets the counters and the on-disk
values are set to 0 as well.

Change-Id: I8d285310d153e1e219ef523528b575e2c600de01
Reviewed-on: https://gerrit.chromium.org/gerrit/27300
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
e7c6ad35cafed32a0fd1390487c74e66eae1961d 29-Jun-2012 Darin Petkov <petkov@chromium.org> shill: Add Profile and Manager UpdateDevice support.

UpdateDevice persists Devices into profiles. It's similar to UpdateService,
however, only the topmost DefaultProfile handles UpdateDevice. Use UpdateDevice
to persist Device's Enabled and Cellular's AllowRoaming properties. Remove now
unused Manager::SaveActiveProfile method to avoid confusion.

BUG=chrome-os-partner:10178,chromium-os:32230
TEST=unit tests

Change-Id: I1d293fa84e0bce3156943e8e9d313fc98facbde1
Reviewed-on: https://gerrit.chromium.org/gerrit/26405
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Ready: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/device_unittest.cc
da798623389b981130cd1922f880736f1e0e36ba 05-Jun-2012 Joshua Kroll <joshkroll@chromium.org> Remove the the TechnologyIs method from Device, associated classes, and everything else.

BUG=chromium-os:29696
TEST=Ran unit tests.

Change-Id: I581f1b0062a2a171705bc3a72e72f13d2157bf24
Reviewed-on: https://gerrit.chromium.org/gerrit/24538
Commit-Ready: Joshua Kroll <joshkroll@chromium.org>
Tested-by: Joshua Kroll <joshkroll@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
ad43cc647162e06a957e70dcbdbc33ac5dd3b509 12-Apr-2012 Jorge Lucangeli Obes <jorgelo@chromium.org> Launch dhcpcd using Minijail.

dhcpcd runs as root and listens on the network. Launch it using Minijail
so that we can run it as a regular user, mitigating the risk of an eventual
compromise.

Add a mock Minijail wrapper for unittesting.

BUG=chromium-os:28336
TEST=dhcp_config_unittest
TEST=network_netperf2
TEST=Manual connection to ethernet, GoogleGuest, Google-A.
CQ-DEPEND=I243e02c82f70c6a3469ca712e539ec9fb6e3e4d4

Change-Id: I14c4e843eba478ed39b10fa4fcb0e25eb3186c1a
Reviewed-on: https://gerrit.chromium.org/gerrit/20414
Commit-Ready: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Tested-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
/system/connectivity/shill/device_unittest.cc
cc0fded2a80c2c6c7fb46cbd7eee578e7a78c50a 09-May-2012 mukesh agrawal <quiche@chromium.org> shill: implement timeout for DHCP requests

BUG=chromium-os:30689
TEST=new unit tests, manual (see below)

Manual testing:
- Start shill.
- ff_debug +dhcp
- Plug USB-Ethernet into a switch (to get carrier), but without
an upstream connection for the switch. Plug dongle into USB
port.
- Wait 30 seconds.
- Check log file, find "Timed out waiting for DHCP lease on eth0",
and "Service Ethernet state Configuring -> Disconnected".

Change-Id: Ifc27539ec7191b060f615eb9dec61c9fdab07267
Reviewed-on: https://gerrit.chromium.org/gerrit/22302
Commit-Ready: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/device_unittest.cc
baeefdf544bfcfe2895e4e15c348db3f7ce4d45b 30-Apr-2012 Gary Morain <gmorain@chromium.org> shill: Fix cellular PIN unlock

There were three problems. 1) The properties of the modem were not
being parsed when the modem was first started, and so the lock status
of the modem was not known, which prevented the GUI from asking the
user to enter a PIN. 2) When the modem is locked, it cannot be
started successfully, but the software state of the modem was being
changed to "enabled", preventing it from being enabled when the PIN
was entered (you can't enable an already enabled modem). 3) When
enabling a modem failed, the asynchronous enable function still
thought the enable operation was in progress, preventing the
enabling of the modem once the PIN is entered.

BUG=chromium-os:29847
TEST=manual. Try to enable a PIN-locked GSM modem. Also added new
unittests.

Change-Id: I72258586c3ba59abbcc40e03b47d4b7b9e4b73da
Reviewed-on: https://gerrit.chromium.org/gerrit/21562
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Jason Glasgow <jglasgow@chromium.org>
Commit-Ready: Gary Morain <gmorain@chromium.org>
Tested-by: Gary Morain <gmorain@chromium.org>
/system/connectivity/shill/device_unittest.cc
8c116a90d3a3536430b808b15e73275060918434 03-May-2012 Paul Stewart <pstew@chromium.org> shill: device_info: Revamp address/route flushing

The route flushing for devices ended up floating around in the device
code with a number of changes and lodged itself in a place where it
might not even be called in some situations. The address flush code
was only being called on connection close, and only applied to
addresses that were active before the system started up.

Implemented the following fixes:

- Move FlushRoutes out of Device to the initialization code in
DeviceInfo.

- Add Address flushing code in the same place.

- Capture the list of IP addresses per-interface earlier at startup
so they can be flushed at device discovery. This involved re-ordering
the RTNL "Dump" path to dump addresses before links, and adding code
in DeviceInfo to capture these addresses in its Info structures before
the actual link was discovered. This way, when the link is discovered,
it's possible to flush the old addresses.

- Use the NLM_ECHO flag when creating and deleting IP addresses in RTNL,
so RTNL events are generated even for operations that originate from
shill, and the tables are better kept up to date, so when Connections
flush IP addresses on disconnect, this properly includes those that
were created locally.

- Break apart DeviceInfo::AddLinkMsgHandler so it can be tested.

BUG=chromium-os:30358
TEST=New unit tests + plug/unplug between different networks / kill/restart
shill.

Change-Id: Ie1a38e0e86ba3a52aaaaf9c3f0e0dfcb3c8fc276
Reviewed-on: https://gerrit.chromium.org/gerrit/21719
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
d215af6f72d012f43057c34f17a12506baa21e66 25-Apr-2012 Paul Stewart <pstew@chromium.org> shill: service: Do active checks on PortalCheck and ProxyConfig

Change both properties to be derived strings. Validate the various
values of the PortalCheck parameter. Force a restart of portal
detection if either parameter changes, so that we can switch from
Portal to Online or vice vesa if by changing this parameter we are
changing the behavior of portal check.

BUG=chromium-os:29745
TEST=New unit tests. Manual: Set Proxy configuration on a service
in portal state while on the login screen.

Change-Id: I86c386e61396a23103f99382c568372b4774f452
Reviewed-on: https://gerrit.chromium.org/gerrit/21027
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
4a4907904affddc3cf6f88ce3b4662d66a9e18eb 10-Apr-2012 Jason Glasgow <jglasgow@chromium.org> shill: device: require a non NULL error pointer be passed to Start

Require that a non NULL error pointer be passed to Start function so
that it is clear that the Start function can return an error. Add
DCHECKs to the code so that coding errors can be caught by unit tests.

BUG=none
TEST=run unit tests, and run shill using the new modem manager
Change-Id: Ie5e50eb15a041a17357adcef7a9d95e16e2bb222
Reviewed-on: https://gerrit.chromium.org/gerrit/19912
Commit-Ready: Jason Glasgow <jglasgow@chromium.org>
Reviewed-by: Jason Glasgow <jglasgow@chromium.org>
Tested-by: Jason Glasgow <jglasgow@chromium.org>
/system/connectivity/shill/device_unittest.cc
9a24553461df7036755060423f90804011612249 07-Mar-2012 Eric Shienbrood <ers@chromium.org> Make Enable/Disable work using new callbacks for async support.

Use new-style callbacks to implement the Manager EnableTechnology
and DisableTechnology operations asynchronously. This allows
devices to be enabled and disabled from the UI ,and for the UI
to display available networks once the device is enabled.

Removed the behavior whereby setting the Device.Powered property
had the side effect of enabling or disabling the device. To
replace this, I added new Device.Enable and Device.Disable calls
for enabling and disabling individual devices.

Also separated the in-memory value of the Powered property from
the persisted value. Whenever a client requests that a device
be enabled or disabled, the desired power state is immediately
saved in the profile, but the in-memory value isn't updated until
the operation completes. On startup, shill now automatically
starts any devices for which the persistent Powered property
is set, and does not start devices for which it is not set.

BUG=chromium-os:23319,chromium-os:27814
TEST=Manual testing on device + unit tests passing.

Change-Id: Id676be3fc662cfd5efb730c67687edfd16b2dc6b
Reviewed-on: https://gerrit.chromium.org/gerrit/18123
Commit-Ready: Eric Shienbrood <ers@chromium.org>
Reviewed-by: Eric Shienbrood <ers@chromium.org>
Tested-by: Eric Shienbrood <ers@chromium.org>
/system/connectivity/shill/device_unittest.cc
85e050b4923878a57aec1415314d2b39ff233e00 13-Mar-2012 Thieu Le <thieule@chromium.org> shill: Add portal metrics

Add support for Network.*.PortalAttempts,
Network.*.PortalAttemptsToOnline and Network.*.PortalResult.

BUG=chromium-os:27670
TEST=Unit tests

Change-Id: I0589c0f811a46f249ebb97540fc9d8a6ed7293ad
Reviewed-on: https://gerrit.chromium.org/gerrit/18036
Commit-Ready: Thieu Le <thieule@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
/system/connectivity/shill/device_unittest.cc
3e20a2341d0aeb7681e4ee0f89eae6817ade2b3b 16-Feb-2012 Eric Shienbrood <ers@chromium.org> shill: Convert code to use the newest version of libchrome.

The biggest change is a switch from using the deprecated
Task and CallbackN mechanisms to using the new Callback
mechanism.

Note: Original CL was https://gerrit.chromium.org/gerrit/16156.
This is logically another patch to that CL, but since the
latter was already merged, and is considered closed by
Gerrit, it's necessary to create a new CL.

BUG=chromium-os:15330
TEST=Build shill and run it on a zgb with a modem. Build and
run unit tests.
CQ-DEPEND=I37628863370323d30cac493764ea28f8ffd42637

Change-Id: I3ae78a3aa44ec167b79f2170d07650ece888254f
Reviewed-on: https://gerrit.chromium.org/gerrit/18030
Reviewed-by: Eric Shienbrood <ers@chromium.org>
Tested-by: Eric Shienbrood <ers@chromium.org>
Commit-Ready: Eric Shienbrood <ers@chromium.org>
/system/connectivity/shill/device_unittest.cc
b5c8940ae68f85c8c822936f41f4993c51624dcf 13-Mar-2012 Eric Shienbrood <ers@chromium.org> Revert "shill: Convert code to use the newest version of libchrome."

This reverts commit ffebe0c489e0ecccf497547d7078c30cbc8072e2

Unit tests ran on local machine, but wouldn't run on CQ because of some kind of environment difference.

Change-Id: Ia876c0c17f4cd84bca5e2f1bacd7e24a81832d4d
Reviewed-on: https://gerrit.chromium.org/gerrit/17969
Reviewed-by: Eric Shienbrood <ers@chromium.org>
Tested-by: Eric Shienbrood <ers@chromium.org>
/system/connectivity/shill/device_unittest.cc
08a4ffb4ecf5893eb55c523d528bf3e52c66facf 16-Feb-2012 Eric Shienbrood <ers@chromium.org> shill: Convert code to use the newest version of libchrome.

The biggest change is a switch from using the deprecated
Task and CallbackN mechanisms to using the new Callback
mechanism.

This cannot be submitted until vapier submits his CL that
slot-enables the libchrome build
(https://gerrit.chromium.org/gerrit/15415).

BUG=chromium-os:15330
TEST=Build shill and run it on a zgb with a modem. Build and
run unit tests.
CQ-DEPEND=Ic24bb16aac3e1d130a784f34e848e308719a43be

Change-Id: I081a7aa66bee391b867a43e08db2eacdff760945
Reviewed-on: https://gerrit.chromium.org/gerrit/16156
Tested-by: Eric Shienbrood <ers@chromium.org>
Commit-Ready: Eric Shienbrood <ers@chromium.org>
Reviewed-by: Eric Shienbrood <ers@chromium.org>
/system/connectivity/shill/device_unittest.cc
fb46caf4f23a41e73dfd87547121b5fb0230295a 08-Mar-2012 Thieu Le <thieule@chromium.org> shill: Delete existing routes when the device is started.

BUG=chromium-os:27358
TEST=Unit tests, network_WiFiManager, manually add foreign routes and
ensure they are deleted, also test to make sure default route remains
after DHCP renewal

Change-Id: Ic26b70d685491f31699ff4684ed289e76af8a9ca
Reviewed-on: https://gerrit.chromium.org/gerrit/17640
Commit-Ready: Thieu Le <thieule@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
/system/connectivity/shill/device_unittest.cc
79d74c9bdb654be48765c1e7aa416126ffd2ae5e 07-Mar-2012 Darin Petkov <petkov@chromium.org> shill: vpn: Associate VPN device with service and update IP configuration.

BUG=chromium-os:27384,chromium-os:27385
TEST=unit tests

Change-Id: I5b35bebeadd25f50f7044d2e4ec5bc121a56835e
Reviewed-on: https://gerrit.chromium.org/gerrit/17488
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/device_unittest.cc
c681fa0742cabc686ccabaf0fdf6ce12dd7046b2 03-Mar-2012 Paul Stewart <pstew@chromium.org> shill: portal: Recheck portal state

Introduce a retry interval for automatically retrying portal
checks. Also provide a Manager API method for immediately
re-checking portal status.

BUG=chromium-os:27335
TEST=New unit tests, tested on real machine, including setting
PortaCheckInterval over DBus, and using Jason's addition to
test-flimflam for 'recheck-portal'.
Change-Id: Idc7def18c6f863859e94f4d4e9f266ab2670679c
Reviewed-on: https://gerrit.chromium.org/gerrit/17367
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
20088d860631a67c151a12783fbbee63c708792f 16-Feb-2012 Paul Stewart <pstew@chromium.org> shill: Perform Portal Detection in Device

When a connection completes, start a portal detection request, which
may change the state of the selected service. Bonus changes: removed
Service::kStateReady, since Service::kStateConnected maps directly
to flimflam::kStateReady. Also, move technology list parsing over
to technology.cc.

BUG=chromium-os:23318
TEST=New unit tests

Change-Id: I2fad724165af6914c8f83bc123f07db5af223a05
Reviewed-on: https://gerrit.chromium.org/gerrit/16117
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
6bb9e7c2c068fc15333babea8e66f02332683e33 30-Jan-2012 mukesh agrawal <quiche@chromium.org> shill: rename DispatchOnType to SetProperty

I think this name is clearer. While the function does
have to dispatch based on type, what the caller is trying
to do is to set a property.

BUG=None
TEST=unit tests
Change-Id: I7eedd5a74de7f465310d07271e61cff320645fd8
Reviewed-on: https://gerrit.chromium.org/gerrit/15538
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/device_unittest.cc
8abd2f67616c3d138346781a49a40d4ae2bc7019 30-Jan-2012 mukesh agrawal <quiche@chromium.org> shill: teach dbus_adaptor (and appropriate subclasses) how
to clear properties

BUG=chromium-os:24814
TEST=new unit tests

Change-Id: Ifad5ad0ad6c00d906bade7e1293540a58ac15625
Reviewed-on: https://gerrit.chromium.org/gerrit/15291
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/device_unittest.cc
d32f484b91ab583ccc9a14b2a6b5182fda6958f0 12-Jan-2012 Paul Stewart <pstew@chromium.org> shill: Pass a parameter to dhcp client to request a hostname

This will enable dynamic DNS, or at the very least allow DHCP
requests to be identified and distinguished at the server side.

BUG=chromium-os:23741
TEST=New unit tests monitor hostname arg passed to dhcpcd,
and to assure values are being loaded/saved. Also double
checked on real system by doing a dbus-send to set manager.HostName
and checked that the name was persisted, and that the next
DHCP server we connected to stored this hostname.
CQ-DEPEND=Ic807a2235e0cdcb32a08f9c2c760a86c3579431c

Change-Id: Ic127b65d8563b15e55549a0f029385d0632eaf6c
Reviewed-on: https://gerrit.chromium.org/gerrit/14045
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
3426c8fc7a3943f2d8fcb2ec78f0593088b42bed 12-Jan-2012 Thieu Le <thieule@chromium.org> shill: Move Metrics from singleton to Shill daemon

While implementing chromium-os:24810, it was discovered that Metrics is
cleaner if it is passed around like ControlInterface, Dispatcher,
Manager, etc. This approach also makes Metrics more testable.

BUG=chromium-os:24810
TEST=Unit tests, network_WiFiManager suite

Change-Id: I556a1bd11f21f0b93ecfeaae8855dfb99ed5e5f9
Reviewed-on: https://gerrit.chromium.org/gerrit/14099
Commit-Ready: Thieu Le <thieule@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
/system/connectivity/shill/device_unittest.cc
c1dec4d5cad7c6ee2cd8dbc4f47e4d30403dcca1 09-Dec-2011 Paul Stewart <pstew@chromium.org> shill: Assign "Default" status to the best connection

Set the highest-ranked connection to be the "Default".
As a result, the highest priority default route will
move with the highest-ranked connection in the service
list.

Bonus changes:
* Service now formally holds a reference to the Connection
object, so call a "SetConnection" method instead of a
Create/Destroy of the HTTPProxy.
* Actually start the routing table service, and do a couple
minor fixes due to how the kernel actually accepts metric
changes.

BUG=chromium-os:7607,chromium-os:23993
TEST=New Unit Test + Manual (watch routes while inserting
USB-Ethernet on a machine connected to WiFi)

Change-Id: Iddf1ed766238d9e8adc97bb54fc12b527f86239f
Reviewed-on: https://gerrit.chromium.org/gerrit/12685
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
be5f5b341ba4b85d45ffb6c0430ef5ab84c7b961 08-Dec-2011 Paul Stewart <pstew@chromium.org> shill: Create HTTPProxy for connected services

When an a Connection is created on a Device, ask the
Service to create an HTTPProxy. The Service will
then expose the port number for the proxy as an RPC
property. Whenever the Service is unselected by
the Device, or the connection terminates, ask the
Service to destroy the proxy.

The Service owns the HTTPProxy so that it can report
the proxy port in its properties.

BUG=chromium-os:21664
TEST=Add expectations for DestroyProxy in unit tests.
Manual: Ensure that "list-services" shows the proxy
port on a successful connection, and "curl -x" to
this proxy succeeds.

Change-Id: I24a1f7a23c0fc4577b48aed7bec370fba6edc342
Reviewed-on: https://gerrit.chromium.org/gerrit/12625
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
2bf1d356e76564adb64b8bc8bc1049e74bf8e4d8 07-Dec-2011 Paul Stewart <pstew@chromium.org> shill: Enable and disable IPv6 with interface events

Move device IP flag setting to a generic private method device.cc.
Use this to export the IPv6 address privacy flag setter. Also use
this to enable and disable IPv6 at the same time that IPv4 address
configs are created and destroyed. This will ensure that IPv6
kernel addrconfig starts and stops at the correct time.

BUG=chromium-os:23570
TEST=WiFiManager.050IPv6Basic: Passed during initial
connection, but failed due to some sort of DBus introspection
error in the second pass. Manual: Monitor flags file for correct
operation on ethernet plug/unplug. Manually verify the various
IPv6 addresses and routes being created and removed.

Change-Id: Id358b33dbf9faa602a181938ad524290b59a08b0
Reviewed-on: https://gerrit.chromium.org/gerrit/12577
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
435de2cd55a95836381b53acbce8cbbad98ec04d 18-Nov-2011 Gaurav Shah <gauravsh@chromium.org> Implement {Available|Connected|Enabled}Technolgies and DefaultTechnology

This is Part 1 of a series of changes required for the Manager to generate
the right set of DBus events allowing shill to properly tell Chrome about
connectivity.

Some other side-effects in the change (needed to implement the above):
- Emit these manager properties over DBus everytime we re-sort the Service
vector.
- Add a technology data member to Device, this allows easy enumeration of
technologies.
- Add interface for getting a handle to the selected service on a device.
- Map connected state to online instead of ready state. This is needed for
so that Chrome doesn't wait for the portal detection code to switch the
state from ready->online.
- Default set the ethernet service as connectable.

BUG=chromium-os:14887
TEST=1) manual test to verify shill properly configures the ethernet
device and Chrome correctly detects that.
2) new unit tests

Change-Id: Ib10f2f0836f8d4aacaad1491f58ed9b3b5d37e7d
Reviewed-on: https://gerrit.chromium.org/gerrit/12019
Tested-by: Gaurav Shah <gauravsh@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/device_unittest.cc
26b327e559583d5a84b7e1605c29a4dcbc87d2a9 19-Oct-2011 Paul Stewart <pstew@chromium.org> shill: A couple of naming cleanups

Rename shill_event.* -> event_dispatcher.*. This is more
consistent with correct style. Also rename IOInputHandler ->
InputHandler.

BUG=None
TEST=Rerun unit tests

Change-Id: I13d56b857c85b32ba1418e894de68afc5a23f00d
Reviewed-on: http://gerrit.chromium.org/gerrit/10326
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
fdd1607e26db6c10585f7eefa0e02546274ea8f5 16-Sep-2011 Paul Stewart <pstew@chromium.org> shill: Add Technology class

Move Technology enum out into its own class, and create static
functions for converting between these and strings.

BUG=chromium-os:20114
TEST=Rerun unit tests

Change-Id: I9e3aea44e5d0b14d844328f023b01d7f8ea04c42
Reviewed-on: http://gerrit.chromium.org/gerrit/8204
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
5c4dd0b0886fb10deae0d3b40628fb2c521aff99 14-Sep-2011 mukesh agrawal <quiche@chromium.org> shill: clear more state on calls to Device::Stop and WiFi::Stop

BUG=chromium-os:20333
TEST=unittests, WiFiManager/000_SSID_Length_Limit

in addition to the main change, this CL
- moves some common code out of derived classes into Device
- adds some debugging messages (at VLOG(3)) to track down
unexpected live references
- eliminates TestEventDispatcher (in cellular_unittest.cc),
in favor of using the MockRTNLHandler

note that the 000_SSID_Length_Limit test was run with the
"Test MAX+1 ssid length" step disabled, because that requires
support for Manager.GetService.

Change-Id: I852d984a3af92e2c18e4a6e8d1dd5e4714069fdc
Reviewed-on: http://gerrit.chromium.org/gerrit/7734
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/device_unittest.cc
de29fa8d95092f28548b5e4537a6c61e21ae760b 17-Sep-2011 mukesh agrawal <quiche@chromium.org> shill: tighten up constness of PropertyStore

BUG=chromium-os:20543
TEST=unittest

Change-Id: Ifa86f82a883b3c3ec61ce10f8d82564b9a036b04
Reviewed-on: http://gerrit.chromium.org/gerrit/7901
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/device_unittest.cc
2176a88f197d802924d2a83d368e3efab7a6be4b 15-Sep-2011 Chris Masone <cmasone@chromium.org> [shill] Get rid of protected data members in PropertyStoreTest

BUG=chromium-os:19573
TEST=unit
STATUS=Verified

Change-Id: Ib3a2f19abb8cc4aa0e8410fc26bbb60891e35da7
Reviewed-on: http://gerrit.chromium.org/gerrit/7762
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
9d779936d8f8c2d74b30883e2a2622c4207fe797 26-Aug-2011 Chris Masone <cmasone@chromium.org> [shill] Add code for persisting profiles and services to disk.

BUG=chromium-os:17253
TEST=unit

Change-Id: Ic6dbbcb10543da3f4615cb305a77f6b9b301e8bc
Reviewed-on: http://gerrit.chromium.org/gerrit/7633
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/device_unittest.cc
03dba0bccc3a39cded5083212e56713a6d349e01 23-Aug-2011 Paul Stewart <pstew@chromium.org> shill: Start assigning service state

Service state is usually controlled by the associated Device. Devices
select a single Service to reflect current connection state. All other
Services remain in an idle or whatever Failure state they ended up with
at the end of their last attempt.

When Service state changes, the service notifies the Manager of its new
state. This will be used by the Manager to update service priority and
selection of default routes.

For unit-tests, add a "State" test for service_unittest which which
tests for state changes and up-calls to the Manager. Add
"SelectedDevice" test to device_unittest to ensure proper down-calls
to the service.

BUG=chromium-os:19523
TEST=New unit tests

Change-Id: Ic253cc1dd77821a74176346521aff5948ad59660
Reviewed-on: http://gerrit.chromium.org/gerrit/6495
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/device_unittest.cc
34af218abe6a99144ffe01332ce36fbad94f2628 22-Aug-2011 Chris Masone <cmasone@chromium.org> [shill] Use flimflam-esque storage ids

Devices:
device_<MAC>

IPConfig:
ipconfig_<MAC of associated device>_0

Services:
ethernet_<MAC of associated device>
wifi_<MAC of associated device>_<SSID>_<mode>_<security>
cellular_<MAC of associated device>_<Network_name>

BUG=chromium-os:17744
TEST=unit

Change-Id: Ibf061f9c184e7c86f5afcf97d48e321fc74bde1c
Reviewed-on: http://gerrit.chromium.org/gerrit/6412
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/device_unittest.cc
626719f89881a949d8b5a8fa808beb924496489f 19-Aug-2011 Chris Masone <cmasone@chromium.org> Re-land "[shill] Add hardware address to Device objects."

Forgot some headers...

BUG=chromium-os:17744
TEST=unit

This reverts commit 0fda552b0fec3498403336acb9e89dd7799cac74.

Change-Id: I1cd05e47d29bc7ea2a065cabf1d81dd37f74c0f8
Reviewed-on: http://gerrit.chromium.org/gerrit/6270
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/device_unittest.cc
0fda552b0fec3498403336acb9e89dd7799cac74 19-Aug-2011 Chris Masone <cmasone@chromium.org> Revert "[shill] Add hardware address to Device objects."

This reverts commit 1f694d095374fddb9a258b376cffb54ed73981d5

forgot some files

Change-Id: Ifcf5e6551b993354f91fab1e4ef8d337917dfc15
Reviewed-on: http://gerrit.chromium.org/gerrit/6269
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/device_unittest.cc
b17d42d5743f7b9bf4d5f1d77d3eedd3a1edbab5 19-Aug-2011 Chris Masone <cmasone@chromium.org> [shill] Add hardware address to Device objects.

BUG=chromium-os:17744
TEST=unit

Change-Id: I78bf578aa1ebf3151c33c357b0cbc0b1bfd75d75
Reviewed-on: http://gerrit.chromium.org/gerrit/6260
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/device_unittest.cc
5dec5f4e469a24f1ad508a210d1d23f228bc09a3 22-Jul-2011 Chris Masone <cmasone@chromium.org> [shill] Enable Device objects to persist themselves to disk

BUG=chromium-os:17254
TEST=unit

Change-Id: Ia00bc2658e0fe03e13e399d7afab81cc09aa0195
Reviewed-on: http://gerrit.chromium.org/gerrit/5309
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/device_unittest.cc
e9d12e0c5ac2ff59803d808d4785700b4cc0583f 28-Jul-2011 Darin Petkov <petkov@chromium.org> shill: Enable the ModemManager.Modem on Cellular device start.

Also, move DBus.Object/Connection properties to the Cellular device,
initializing them to the right values.

BUG=chromium-os:18315
TEST=unit tests, tested on device

Change-Id: I5788ca7aa375afee757fbd96edf96f9d07f29ded
Reviewed-on: http://gerrit.chromium.org/gerrit/4947
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/device_unittest.cc
19e30406a1d3123892007d20438527dc4b2f92c3 20-Jul-2011 Chris Masone <cmasone@chromium.org> [shill] Continue fixing sloppy naming stuff

We were using some illegal dbus paths. Stop :-)

BUG=chromium-os:17744
TEST=unit tests, run on device and list-devices, list-services

Change-Id: I812f0f4d3d663e2af50477d46900ea885ee69e21
Reviewed-on: http://gerrit.chromium.org/gerrit/4349
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/device_unittest.cc
8a56ad63b73d221a0f20fd61d1f27bcc443eec50 03-Jul-2011 Chris Masone <cmasone@chromium.org> [shill] Move some simple unit tests to property_store_unittest.cc

BUG=None
TEST=unit tests

Change-Id: Ib5ee4b3c2654c193227a3b789cbb6f40e5222b85
Reviewed-on: http://gerrit.chromium.org/gerrit/3617
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/device_unittest.cc
27c4aa55b33d3a3836cf70c8f7094bce1c5ead8c 02-Jul-2011 Chris Masone <cmasone@chromium.org> [shill] Use composition instead of inheritance with PropertyStore

Instead of having Device, Manager, etc all inherit from PropertyStore
and have it be difficult to follow the getting/setting property code,
have each include a PropertyStore as a data member. Provide an
accessor so that RPC adaptor classes can get and set properties
directly and continue to handle any necessary type conversion
themselves.

BUG=None
TEST=unit tests

Change-Id: I34781bde4de0e152550ca636e28d472abde756af
Reviewed-on: http://gerrit.chromium.org/gerrit/3616
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/device_unittest.cc
4e85161f12699d8eb2116ae24766676ed8227a71 01-Jul-2011 Chris Masone <cmasone@chromium.org> [shill] Wire up derived properties in the Device class

BUG=chromium-os:16343
TEST=unit tests

Change-Id: Ib35efbc00133b6ffc9352e52c0413be4bd984e12
Reviewed-on: http://gerrit.chromium.org/gerrit/3559
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/device_unittest.cc
95207da4b896bd0a4186163f6f9ebda044a5a7b9 30-Jun-2011 Chris Masone <cmasone@chromium.org> [shill] Enable objects to query an opaque RPC-system ID from Adaptors

This is needed for some properties. For example Service has a property called Device, which is expected
to return a (in the current impl) a DBus path for the associated Device object.

BUG=chromium-os:16343
TEST=unit tests

Change-Id: I8bd32ab483331efabbfee05dbdeba045c7cb20da
Reviewed-on: http://gerrit.chromium.org/gerrit/3417
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/device_unittest.cc
a8a2c25df27d77f278511769f0c9029b03dff053 28-Jun-2011 Chris Masone <cmasone@chromium.org> [shill] Enable the getting of properties, and wire to dbus.

PropertyStore exposes getters for iterators pointing to the beginning
and end of its property maps, and a static utility method in DBusAdaptor
uses these to iterate through all the properties in the PropertyStore and build
up a map of property name -> DBus::Variant-wrapped value.

BUG=chromium-os:16343
TEST=unit tests

Change-Id: I85ebbaee167ab2feed0fcf8fe654274de352aca0
Reviewed-on: http://gerrit.chromium.org/gerrit/3359
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/device_unittest.cc
853b81b19ddcd39561df2bde9c61b7106a9ee9d6 24-Jun-2011 Chris Masone <cmasone@chromium.org> [shill] move wifi properties into WiFi from Device

Also, ensure that properties in leaf classes (WiFi, Cellular, etc) are
private, not protected.

BUG=chromium-os:16956
TEST=unit tests

Change-Id: I1b94e7dd5fb12a741a7a3a1220678c2d24d6c543
Reviewed-on: http://gerrit.chromium.org/gerrit/3188
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/device_unittest.cc
b925cc8f481d21fddd9569fc68861f6e5b6e3eae 23-Jun-2011 Chris Masone <cmasone@chromium.org> [shill] Add properties to Manager, Device and subclasses. Clean up unit tests

1) Pull much of the properties stuff (the maps, Register*(), Contains()) up
into PropertyStore, and make it a class, not an interface.
2) Add proper property stuff to Manager and Device. Move Cellular- and Wifi-
specific properties to Cellular, CellularService, WiFi, WiFiService as
appropriate.
3) clean up unit tests.

BUG=chromium-os:16343
TEST=unit tests

Change-Id: Iba88f384a5fbe383608cb79fa2134d978f1b81e8
Reviewed-on: http://gerrit.chromium.org/gerrit/3136
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/device_unittest.cc
3bd3c8c33917221d1074f1aa19272e45c0ce2793 13-Jun-2011 Chris Masone <cmasone@chromium.org> [shill] Add support for setting properties.

This CL adds a framework for supporting RPC-exposed properties in Shill.
It also plumbs the code for setting properties on Service objects to prove
the approach. Device and Manager settings will follow.

BUG=chromium-os:16343
TEST=build shill, run unit tests.

Change-Id: I55869453d6039e688f1a49be9dfb1ba1315efe0a
Reviewed-on: http://gerrit.chromium.org/gerrit/3004
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/device_unittest.cc
afa6fc4d31e884af8710deb14798c69b9c9a898e 22-Jun-2011 Darin Petkov <petkov@chromium.org> shill: Connect Ethernet Device to DHCPConfig.

Most of the implementation is in the base Device class.

BUG=chromium-os:16794
TEST=unit test

Change-Id: I583761f7e54c88b043ce4343cb43f8298aaedf8b
Reviewed-on: http://gerrit.chromium.org/gerrit/2949
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/device_unittest.cc