History log of /system/connectivity/shill/manager.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
c1d447354db29b83262c7db0857baa84e05e0c2a 15-Jan-2016 Christopher Grant <cjgrant@google.com> shill: add a whitelist invocation option

To compliment the blacklisting approach, add a whitelist option. If
specified, shill will manage only device specified by the whitelist.
Allow only one of blacklist, whitelist or passive mode to be specified.

Bug: 26424002
TEST=Manual testing, new unit tests.

Change-Id: I9149543b56f6bcb464a1ba09da56abcdd9a34b2e
/system/connectivity/shill/manager.h
e569b214bad42ec2be75ac1db2ca9b15563fdc61 15-Jan-2016 Samuel Tan <samueltan@google.com> shill: wrap manager AP/Station mode methods in preprocessor conditionals

Wrap the definitions and all callsites of Manager methods
SetupApModeInterface(), SetupStationModeInterface(), and
OnApModeSetterVanished() with preprocessor conditionals\
so that these methods will only be present and used in
Brillo builds that do not disable WiFi.

BUG: None
Change-Id: I2a4bef5142bedd6fa70163ebb9ea6121e7cbff1e
TEST: shill compiles and unit tests pass.
/system/connectivity/shill/manager.h
8a3f68edbcf7fe59380609588787baa54cbd9bdd 11-Jan-2016 Samuel Tan <samueltan@google.com> shill: make remote service monitoring RPC-mechanism-specific

Code that monitors remote RPC endpoints is RPC-mechanism-specific,
so it should live in RPC-mechanism-specific source files.

Move all code that creates D-Bus service watchers from Manager
into ChromeosManagerDBusAdaptor, and remove expectations for
service watcher creation/deletion from Manager unittests. Remove
CreateRPCServiceWatcher from ControlInterface, since we leave the
details of creating the RPC service watcher to the RPC adaptors.

Also, create a ChromeosManagerDBusAdaptor unittest, along with the
classess necessary to support these unittests (DBusServiceWatcherFactory,
MockDBusServiceWatcherFactory, MockDBusServiceWatcher), to test for the
creation/deletion of D-Bus service watchers that is now done in
this adaptor.

While there, remove an unnecssary comment from icmp_session_factory.cc.

BUG: 26489902
TEST: Unit tests pass when shill is built with SHILL_USE_BINDER=true
TEST: Unit tests pass when shill is built with SHILL_USE_BINDER=false
Change-Id: I31be9ead90e0e538247401042c5b5012a924c0dd
/system/connectivity/shill/manager.h
91b7150819b785f36c2c094ae4aa102336bd6f71 09-Nov-2015 Peter Qiu <zqiu@google.com> Do not claim/release blacklisted devices

This prevents the device claimer from unintentionally removing
blacklisted devices (specified through command line) from the
blacklist.

Any attempt to claim/release blacklisted devices will results in
an error.

Bug: 25448373
TEST=Verify p2p0 interface is not managed by shill after device setup
on Brillo devices
TEST=Run newly added unit tests

Change-Id: I14323de2f125d92dc6207d2a4768b7dd4735b850
/system/connectivity/shill/manager.h
d13249c35eb0c5281c422a3c17a252b5cc8c865d 27-Oct-2015 Peter Qiu <zqiu@google.com> Restore interface mode back to station when AP mode setter vanished

This allows shill to manage the WiFi interface when AP mode setter
(apmanager) crashed.

While there, hide the code under WiFi compiler flag as well. Since
these two APIs are only applicable when WiFi is enabled.

Bug: 25111635
TEST=Manual test on Brillo devices:
TEST=1. bootup device in WiFi bootstrapping mode (interface in AP mode)
TEST=2. kill apmanager, verify WiFi interface is set to station mode
TEST=newly added unit tests

Change-Id: I83a8d3916eb6cb006631a607957aff34ed5809ff
/system/connectivity/shill/manager.h
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/manager.h
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/manager.h
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/manager.h
95522afb22e28fdf981ac9161e4400df909ff3e3 29-Sep-2015 Peter Qiu <zqiu@google.com> dbus: expose APIs for configuring WiFi interface mode

The new APIs are added to org.chromium.flimflam.Manager interface,
and they're supported on Brillo devices only.

Bug: 25111635
TEST=Manual test on Brillo board

Change-Id: I04e8854e1842a25f59a1d1e4dc5cab31f1916aca
/system/connectivity/shill/manager.h
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/manager.h
d48e8140b17d9f04e9848e1e638c483450a5dcfc 22-Sep-2015 mukesh agrawal <quiche@google.com> shill: Profile: change ctor arg type from string to FilePath

The |user_storage_directory| argument to the Profile ctor
is stored inside the Profile object as a FilePath, and the
DefaultProfile ctor takes its path argument as a FilePath.

Both of these facts argue for |user_storage_directory| to
be passed in as a FilePath, rather than a string.

Make it so.

Bug: None
TEST=unit tests

Change-Id: I6094aeb44de96ccd0312c5311bdd195ee64cf510
/system/connectivity/shill/manager.h
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/manager.h
b0d2f64a672a970a7dc1f846c36c0cd411177662 18-Sep-2015 Rebecca Silberstein <silberst@google.com> shill: do not persist disable for prohibited technologies

When technologies are disabled or enabled, they should explicitly be
stored in the profile to make the selection persistent across restarts.
Prohibited technologies should be disabled only when the technology is
prohibited. This should not persist across shill restarts, especially
when the technology is no longer prohibited. Updated existing unit
test and added new unit test to check for correct persist/nonpersist calls.

Bug: 24142276
TEST=ran unit tests and checked manually with:
1 - check /var/cache/shill/default.profile for Powered=true on wifi device
2 - dbus-send --system --print-reply --fixed --dest=org.chromium.flimflam / \
org.chromium.flimflam.Manager.SetProperty string:ProhibitedTechnologies \
variant:string:wifi
3 - dbus-send --system --print-reply --fixed --dest=org.chromium.flimflam / \
org.chromium.flimflam.Manager.SetProperty string:ProhibitedTechnologies \
variant:string:""
4 - check /var/cache/shill/default.profile for Powered=true on wifi device

Change-Id: I286e140641e9be4785a55f300c746e9d93a4b889
/system/connectivity/shill/manager.h
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/manager.h
9b6f8b8cdeb0c9e925fad635cc52a467c82741d0 26-Aug-2015 Peter Qiu <zqiu@google.com> shill: emit "Devices" property change for non-primary connectivity devices

This allows the remote client to get notified whenever a non-primary
connectivity device (e.g. PPP device) gets added/deleted.

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

Change-Id: Ife37ea536e7e73b81c3c7210fe12b8d109efb93d
Reviewed-on: https://chromium-review.googlesource.com/295680
Commit-Ready: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
Reviewed-by: Zeping Qiu <zqiu@chromium.org>
/system/connectivity/shill/manager.h
c00d1fa87127a33bd1e1a7cf049a54a9cca49d68 14-Aug-2015 Peter Qiu <zqiu@chromium.org> shill: update chromeos dbus adaptors

Following are the changes to the adaptor:
- Remove the support for ObjectManager for now to avoid any testing
complications.
- Register adaptor to the bus synchronously to avoid possible race
conditions.
- Unregister adaptor on its destruction to allow object path to be
reusable and prevent memory leak on the bus.

While there, update Manager interface xml to provide raw message
in the method handler. This allows the handler to be synchronous,
since we don't need to verify claimer's name via DBus watcher
anymore (message sender is used as claimer name). Also update
Manager's usage of DeviceClaimer.

BUG=chromium:517680
TEST=unittests, wifi_matfunc tests

Change-Id: Ia1f306227cae3b27285d80fc7931538e59978e4a
Reviewed-on: https://chromium-review.googlesource.com/293562
Commit-Ready: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
8e60d61b13fedf9cb75f1d4f1762605375837d98 21-Aug-2015 Peter Qiu <zqiu@chromium.org> shill: include non-primary devices in the enumerated devices list

The devices are included in the enumerated devices list without being
persist to the profile storage.

This allows remote client to easily retrieve IP configurations for
such devices.

BUG=chromium:523416
TEST=USE=pppoe emerge-$BOARD shill

Change-Id: Ia6b5d225f75a8514102ca43e01f60a6decd293d1
Reviewed-on: https://chromium-review.googlesource.com/295042
Commit-Ready: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
69b6a95f893d2b21d66ca66a068ae9b1f3cd5470 02-Jul-2015 Peter Qiu <zqiu@chromium.org> shill: add chromeos DBus adaptor for Manager

Add RegisterAsync method to ManagerAdaptorInterface to allow
DBus service daemon to request the ownership of the DBus service
only after Manager interface registration is completed. The same
requirement is not needed for other DBus adaptors.

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

Change-Id: I7f5e6fe58014dd20187897cb230a210b9b0b22e4
Reviewed-on: https://chromium-review.googlesource.com/283150
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
/system/connectivity/shill/manager.h
8ae18741780300de3126826b72593391f2d00313 16-Jun-2015 Paul Stewart <pstew@chromium.org> shill: Top-level files f-m: Switch pointer/ref spacing

Switch to Chrome style spacing.

BUG=chromium:501026
TEST=Unit tests

Change-Id: I107e2f78ca2e3edb3e8b333e2c1792a924361eb3
Reviewed-on: https://chromium-review.googlesource.com/278039
Reviewed-by: Rebecca Silberstein <silberst@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
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/manager.h
1897afaeb89003f5cc75a256f6fd7528e6abd54f 21-May-2015 Samuel Tan <samueltan@chromium.org> shill: report dark resume wake reason to powerd via DBus

Report the wake reason for the current dark resume to powerd via
powerd's ReportDarkResumeWakeReason DBus method. shill needs to
report the wake reason to powerd, so that powerd can log wake
duration metrics separately for different wake reasons. (powerd
cannot identify the wake reasons itself, since the reasons come
from the kernel's wireless subsystem.)

CQ-DEPEND=CL:270514
BUG=chromium:485315
TEST=Compile shill and run unit tests.

Change-Id: I6d160a3ab2efdf95dd3e50ffc6c3de66be6f80b7
Reviewed-on: https://chromium-review.googlesource.com/270553
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
Tested-by: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
2b35cfb222200f9d7bac73f68038e9126146ae5e 01-May-2015 Roshan Pius <rpius@chromium.org> shill: Notify upstart when shill is connected.

Add an upstart event whenever shill is connected.

BUG=brillo:970
TEST=`P2_TEST_FILTER="shill::ManagerTest.RefreshConnectionState"
FEATURES=test emerge-${BOARD} shill`

Change-Id: I5fdf980da5067bf9a77cfb4e47b4e38b026c8b27
Reviewed-on: https://chromium-review.googlesource.com/268895
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Roshan Pius <rpius@chromium.org>
Commit-Queue: Roshan Pius <rpius@chromium.org>
/system/connectivity/shill/manager.h
08add488849f90600a5657a6f54f4dbc34701b8f 20-Apr-2015 Matthew Wein <mattwein@chromium.org> shill: Allow hostname setting via DHCP

Allow shill to optionally allow a Device to (a) request the hostname
parameter and (b) accept this hostname from a dhcp config and
apply it locally.

BUG=chromium:475699
TEST=None
CQ-DEPEND=CL:266519

Change-Id: I56140831768255b04c6f5c558feec4a9119f349b
Reviewed-on: https://chromium-review.googlesource.com/266647
Reviewed-by: Matthew Wein <mattwein@chromium.org>
Tested-by: Matthew Wein <mattwein@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
18213652e2ce4c6e4354951e5b665097b7a7aa6b 22-Apr-2015 Peter Qiu <zqiu@chromium.org> shill: remove dependency for ProfileDBusPropertyExporter

Currently, Profile.GetEntry uses ProfileDBusPropertyExporter to
retrieve entry settings for a service entry that's not registered to the
manager or loaded from a different profile. ProfileDBusPropertyExporter
duplicates logics from Service and its subclasses for loading settings
from the profile.

Instead, create a temporary service for profile to load entry settings
into for such service entry, and then retrieve the service settings
(properties) directly. When creating a temporary service, the profile entry
will be validated for fields required by the corresponding service type.

Also added couple test scripts for testing purpose.

BUG=chromium:208736
TEST=USE="asan clang wimax" FEATURES=test emerge-$BOARD shill
Manual Test:
1. Bootup a DUT (wolf) without logging in, connect to a wifi network
WiFi-A.
2. Logged in with an user account, connect to a different managed wifi
network WiFi-B.
3. Invoke command "/usr/local/lib/flimflam/test/list-profiles", verify
there is an entry in both default profile "/profile/default" and
user profile "/profile/chronos/shill".
3. Use the get-profile-entry command to retrieve entry from both default
and user profile, verify entries are retrieved successfully.
"/usr/local/lib/flimflam/test/get-profile-entry default <entry_name>"
"/usr/local/lib/flimflam/test/get-profile-entry shill <entry_name>"

Change-Id: If6c22fbca0e4e47dd42761b047d57fff14c2e658
Reviewed-on: https://chromium-review.googlesource.com/266751
Tested-by: Zeping Qiu <zqiu@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
/system/connectivity/shill/manager.h
1a72f5444e077ed21b8e085b17d7f9f1bc44fa5e 15-Apr-2015 Peter Qiu <zqiu@chromium.org> shill: compiler option support for wifi and wired 802.1x

This allows shill to be compiled without wifi and wired 802.1x independently.
The supplicant related code will not be compiled when both wifi and wired
802.1x compiler option are disabled.

BUG=chromium:475665
TEST=USE="asan clang -wifi" FEATURES=test emerge-$BOARD shill
USE="asan clang -wired_8021x" FEATURES=test emerge-$BOARD shill
USE="asan clang -wifi -wired_8021x" FEATURES=test emerge-$BOARD shill
USE="asan clang" FEATURES=test emerge-$BOARD shill
Default shill (including both wifi and wired 802.1x):
Passes wifi_matfunc test suite
shill without wifi
No wifi connectivity
Have ethernet connectivity
Passes network_8021xWiredAuthentication test
shill without wired 802.1x
Have wifi and ethernet connectivity
Fail network_8021xWiredAuthentication test
shill without both wifi and wired 802.1x
No wifi connectivity
Have ethernet connectivity
Fail network_8021xWiredAuthentication test
CQ-DEPEND=CL:265614

Change-Id: I6abaa150657f6ca0f6d5c37229fde9a2c0bb36aa
Reviewed-on: https://chromium-review.googlesource.com/265774
Tested-by: Zeping Qiu <zqiu@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
/system/connectivity/shill/manager.h
babfe5a5e1f7b11a70fdf616b8479166416810c9 14-Apr-2015 Garret Kelly <gdk@chromium.org> shill: expose Manager.ClaimedDevices property

Expose a ClaimedDevices property on Manager which contains a list of the
names of every device claimed by the current DeviceClaimer. If no
DeviceClaimer exists, then returned list will be empty.

BUG=chrome-os-partner:39112
TEST=FEATURES=test emerge-amd64-generic shill
CQ-DEPEND=CL:265737

Change-Id: I0f534dade7006fcb92492a425511703377fc1094
Reviewed-on: https://chromium-review.googlesource.com/265739
Reviewed-by: Zeping Qiu <zqiu@chromium.org>
Commit-Queue: Garret Kelly <gdk@chromium.org>
Tested-by: Garret Kelly <gdk@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
a900f4a4b94d852e2a52a59f59ede4261d48ad80 19-Mar-2015 Peter Qiu <zqiu@chromium.org> shill: configure preferred device for wifi services

When a system has multiple wifi devices, it is desirable to allow users to
be able to configure wifi services to use specific wifi device for connecting.
A new wifi service configuration parameter "WiFi.PreferredDevice" is added for
this purpose.

With multiple wifi devices, a wifi endpoint will be created/added for each
BSS detected on each wifi device. So when a wifi service tries to select an
endpoint to "use", it will select the endpoint with the best signal that's
associated with the preferred device if one exist, otherwise the endpoint with
the best signal overall. This endpoint selection is mainly for determining
the device to use to connect to that service (meaning the device on which
"ConnectTo()" is performed if the service is connected), and the estimate of
the signal strength when connected. wpa_supplicant is in charge for deciding
which endpoint to actually connect to.

There will be no side effect if the specified device is not an enabled
WiFi device.

BUG=chromium:467027
TEST=USE="asan clang" emerge-$BOARD shill
Manual Test:
1. Grab a ath9k device (wolf), and setup one additional wifi interface with:
"iw phy phy0 interface add wlan1 type managed"
2. Change the MAC address of wlan1 to be different from wlan0:
"ifconfig wlan1 hw ether [MAC]"
then bring up the interface using "ifconfig wlan1 up"
3. Verify shill is managing wlan1 with:
"/usr/local/lib/flimflam/test/list-devices
4. Configure the service with WiFi.PreferredDevice set using:
"/usr/local/lib/flimflam/test/configure-service [ssid] ..."
5. Connect to the service using:
"/usr/local/lib/flimflam/test/connect-service [ssid]"
6. Verify the device is connected to the service on the specified
wifi interface.
CQ-DEPEND=CL:261049

Change-Id: I55838515b6f154d069ab5d02ded46e2f6148840c
Reviewed-on: https://chromium-review.googlesource.com/261210
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
/system/connectivity/shill/manager.h
381a0bb9927ded7963004fcd6793a77a3fca327b 20-Feb-2015 Samuel Tan <samueltan@chromium.org> shill: add flag to suppress auto-connects in Manager

Add flag that explicitly suppresses autoconnect attempts in Manager, and use
it to ensure that no autoconnect attempts are attempted between the triggering
of a passive scan in dark resume and the completion of that scan.

Also, force WPA supplicant to flush its BSS cache before launching scans in
dark resume to ensure that shill and WPA supplicant have an accurate view of
what endpoints are available while in dark resume.

BUG=chrome-os-partner:36839, chromium:439193
TEST=Compile shill and run unit tests.

Change-Id: Ic199bfe9d536fc7970172d20c398c81167e29a4e
Reviewed-on: https://chromium-review.googlesource.com/252572
Reviewed-by: Samuel Tan <samueltan@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
Tested-by: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/manager.h
2d36a6e266deb96db1d3cf4b18dcc9d863795f28 19-Feb-2015 Samuel Tan <samueltan@chromium.org> shill: check if in dark resume before launching periodic scan

Check if we are in in a suspending/dark resume state (i.e.
PowerManager::suspending()) before launching a periodic scan in
WiFi::ScanTimerHandler. This ensures that we do not launch shill-initiated
scheduled scans while in dark resume.

Also add unit tests for WiFi::StartScanTimer.

BUG=chromium:459821, chromium:439193
TEST=Compile shill and run unit tests.

Change-Id: Ie727e068e1c48692e270b8c44662f10fb1299aaf
Reviewed-on: https://chromium-review.googlesource.com/252571
Tested-by: Samuel Tan <samueltan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/manager.h
d51b24406ed78691abe1c8110029a197c351a6e9 23-Feb-2015 Peter Qiu <zqiu@chromium.org> shill: expose DBus method to enable/disable scheduled scan

Add a DBus method "SetSchedScan" to org.chromium.flimflam.Manager interface
for enabling/disabling scheduled scan. This is useful for testing purposes,
where we want to disable scheduled scan to prevent driver's scheduled scan
from interfering with user-initiated scans.

BUG=chromium:460756
TEST=Use dbus-send command to disable scheduled scan, and confirm it is
disabled through log messages. Then reenable scheduled scan using
dbus-send command, and confirm it is enabled through log messages.
CQ-DEPEND=CL:251733

Change-Id: Idfdaf8e397dca7b9044c17a53934cc629eb1d45e
Reviewed-on: https://chromium-review.googlesource.com/252220
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
5a2097c0f4db1704dd5b7b0b874b669bb21c42ad 11-Feb-2015 Jason Simmons <jsimmons@google.com> shill: Add a command line option that controls the default technology order

This can be used to configure a preference for a particular network on a given
device. For example, a device may want to use the mobile network for all
traffic even if an open wifi network is available.

BUG=chromium:453607
TEST=Added the flag via /etc/init/shill.override and confirmed that dbus GetServiceOrder returned the new order

Change-Id: Ifac0baa4feeaae4a780d4d74f2bd195b4e4dd31d
Reviewed-on: https://chromium-review.googlesource.com/248610
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Jason Simmons <jsimmons@chromium.org>
Commit-Queue: Jason Simmons <jsimmons@chromium.org>
/system/connectivity/shill/manager.h
220ae4e84acc9c7edead58c719b727b5fea925ff 12-Feb-2015 Paul Stewart <pstew@chromium.org> shill: Manager: Limit log messages for service state changes

At the normal debug log level, only report service state in
Manager::UpdateService under 2 conditions:

- An inactive service becomes active
- An active service changes states (including to an inactive
state).

Notably, this removes log messages when other attributes of the
service change (for example signal strength of WiFi services).
To do this, track the states of all watched (active) services, and
use this to decide whether to output at the normal INFO log level
or at a debugging level.

BUG=chromium:458224
TEST=New unit test.

Change-Id: Id2fb7075854c34d8f1d08095d573c5e5e66d39fb
Reviewed-on: https://chromium-review.googlesource.com/249420
Reviewed-by: Rebecca Silberstein <silberst@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
83d625655edbc7c35fc436b8b8fe744886d0aae1 10-Feb-2015 Paul Stewart <pstew@chromium.org> shill: DeviceInfo: Optionally ignore unknown Ethernet

Before CL:224422, any unknown network devices (ones that did not
report a driver symlink) were treated as "Unknown" and were not
managed by shill. However some broken Ethernet drivers do not
report this. This change allows a command-line option to revert
this workaround so virtual network interfaces and other such
non-reported devices can be ignored by the manager again.
Additionally, explicitly ignore all devices that appear with a
"veth" prefix.

BUG=chromium:457043,chromium:456104,chromium:451714
TEST=Unit tests

Change-Id: I513c7014c2159d7fea608eed85c0e33b02a893ba
Reviewed-on: https://chromium-review.googlesource.com/247904
Reviewed-by: Zeping Qiu <zqiu@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
1d499ed2d5eede24f55c7f6b8aaba06136ef4f22 31-Jan-2015 Peter Qiu <zqiu@chromium.org> shill: add passive mode support

Add a command line option to enable passive-mode. When this option
is enabled, shill will not manage any devices by default. Remote
application can specify the devices for shill to manage through
org.chromium.flimflam.Manager::ReleaseInterface/ClaimInterface APIs.
All devices claims will go through the default device claimer, with
claimer name of empty string ("").

While there, update the ReleaseInterface API to also take claimer
name as an argument, so that the claimer name will be check before
releasing a device. This is to avoid devices being released by
other unknown claimers.

BUG=chromium:454007
TEST=USE="asan clang" FEATURES=test emerge-$BOARD shill apmanager
Manual Test:
1. Start shill with passive mode enabled, verify
"/usr/local/lib/flimflam/list-device" does not return any device.
2. Use dbus-send command to release "eth0" device from default
claimer, and verify "/usr/local/lib/flimflam/list-device"
does return eth0 device.
3. Use dbus-send command to claim "eth0" device from default claimer,
and verify "/usr/local/lib/flimflam/list-device" does not return
any device.
4. Regression test with apmanager.

Change-Id: I2b79a13e8aea0d07e9d7923ba3c26adb19237e1a
Reviewed-on: https://chromium-review.googlesource.com/245123
Reviewed-by: Zeping Qiu <zqiu@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
Trybot-Ready: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
59a8cba0d9763ffd5199fba4dc898e5c16aae871 10-Jan-2015 Paul Stewart <pstew@chromium.org> shill: Notify upstart when shill is offline

Add an Upstart proxy, which can ask the upstart process to emit
events. Invoke this event whenever the shill manager becomes
idle.

BUG=chromium:447796
TEST=Unit tests + manual:
Create a dummy "offline.conf" file in /etc/init which starts
with "start on shill-disconnected", and ensure that this script
is invoked if we disconnect the network.

Change-Id: Ide473098b7b93fd3da57b820e78b0a710c287cba
Reviewed-on: https://chromium-review.googlesource.com/241033
Reviewed-by: Zeping Qiu <zqiu@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
a9f5dfe4a8db01a2da09ada36d494bec93c6d69f 16-Dec-2014 mukesh agrawal <quiche@chromium.org> shill: fix bug in Manager::GetEnabledDeviceWithTechnology

When looking for an enable device for a technology, we first
filter the devices by technology, then return the first enabled
device (if any).

Due to a typo in a refactor, these two steps were not tied together.
We would filter by technology, and place the results in the
local variable |devices|. Then we would return the first enabled
device from the member variable |devices_|.

Resolve this by simplifying the interface of FilterByTechnology.

While there: fix ordering of FRIEND_TEST declaration in device.h.

BUG=chromium:397763
TEST=new unit test

Change-Id: I990b09398a096bee07ce38aab15a42976a78b54d
Reviewed-on: https://chromium-review.googlesource.com/236072
Trybot-Ready: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
7e8b8ee34816575b9059dd041ef29f91fe1d15c8 25-Nov-2014 Peter Qiu <zqiu@chromium.org> shill: add support for allowing remote dbus service to claim/release devices

Add method ClaimInterface and ReleaseInterface to DBus interface
org.chromium.flimflam.Manager to allow remote DBus service to claim
the ownership of network interfaces from shill.

To reduce complexity, this service will only support one DBus service at a
time, which means disallow a DBus service from claiming interface from shill
if another DBus service currently had ownership to one or more interfaces
from shill.

When an interface is claimed by a remote DBus service, shill will stop any
activities on that interface, deregister it from the manager if it is
registered, and put it in the blacklist to avoid any further usage. Once the
interface is released by the remote DBus service, it will be removed from the
blacklist and a new device will be created/registered when it is detected
through RTNL.

BUG=chromium:435704
TEST=unittests, manual test will be done using apmanager.

Change-Id: Ie01945f083910345d4cbe9e1d2e64711b5d60891
Reviewed-on: https://chromium-review.googlesource.com/231930
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
d6a8b519e3057f52313e502f502a4819a942e089 18-Nov-2014 Ben Chan <benchan@chromium.org> shill: wifi: Move wifi code to its own sub-directory.

This CL is part of a series of CLs, which aim to reorganzie shill's flat
source code structure into a more modular form by moving technology
specific code into their own sub-directories.

BUG=chromium:433419
TEST=`FEATURES=test emerge-$BOARD shill`
TEST=`USE='clang asan' FEATURES=test emerge-$BOARD shill`

Change-Id: Ic6bf64e7fe263fd0b2277877d78cf776f179e7d7
Reviewed-on: https://chromium-review.googlesource.com/230460
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
c54afe521739065a5d77e7c049acdb5e603f0592 05-Nov-2014 Ben Chan <benchan@chromium.org> shill: cellular: Move cellular code to its own sub-directory.

This CL is part of a series of CLs, which aim to reorganzie shill's flat
source code structure into a more modular form by moving technology
specific code into their own sub-directories.

BUG=chromium:433419
TEST=`USE='cellular' FEATURES=test emerge-$BOARD shill`
TEST=`USE='cellular clang asan' FEATURES=test emerge-$BOARD shill`

Change-Id: I783e85d8c606426ce2ded093588c1243fd0eef97
Reviewed-on: https://chromium-review.googlesource.com/229799
Reviewed-by: Thieu Le <thieule@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/manager.h
c3d707d1ae4198d5538ff4deccd729a83f1bc805 31-Oct-2014 Ben Chan <benchan@chromium.org> shill: wimax: Move wimax code to its own sub-directory.

This CL is part of a series of CLs, which aim to reorganzie shill's flat
source code structure into a more modular form by moving technology
specific code into their own sub-directories.

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

Change-Id: I6b2be3550026cb2e176c0107d10da1e29d2606b0
Reviewed-on: https://chromium-review.googlesource.com/229798
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/manager.h
96bdaecf58097e1cc54c5459e3c165de25c82134 06-Nov-2014 Samuel Tan <samueltan@chromium.org> shill: move Lucid sleep DBus API to Device

BUG=chromium:430683
TEST=Compile and run unit tests with the following commands:

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

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

Manual testing as follows:

1) Build a test image for samus and boot into it.

2) Run the following command:

dbus-send --system --print-reply --dest=org.chromium.flimflam \
/device/wlan0 org.chromium.flimflam.Device.SetProperty \
string:WakeOnWiFiFeaturesEnabled variant:string:packet

3) Ensure that no error is printed in response to step 2.

4) Run the following command:

dbus-send --system --print-reply --dest=org.chromium.flimflam \
/ org.chromium.flimflam.Manager.AddWakeOnPacketConnection \
string:"1.1.1.1"

5) Verify that the follow error is printed in response to step 4:

"Error org.freedesktop.DBus.Error.UnknownMethod: Method \
"AddWakeOnPacketConnection" with signature "s" on interface \
"org.chromium.Manager" doesn't exist"

6) Run the following command:

dbus-send --system --print-reply --dest=org.chromium.flimflam \
/device/wlan0 \
org.chromium.flimflam.Device.AddWakeOnPacketConnection \
string:"1.1.1.1"

7) Verify that no error is printed in response to step 6.

Change-Id: If87ad465cae6663982855f86dcad3def191697f3
Reviewed-on: https://chromium-review.googlesource.com/228221
Tested-by: Samuel Tan <samueltan@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/manager.h
96e35cf43e6d5aa2378cdae6fea507e5335d12bb 29-Oct-2014 Samuel Tan <samueltan@chromium.org> shill: move shill WakeOnWiFiEnabled Manager DBus API to Device

Move WakeOnWiFiEnabled Manager DBus API to the Device DBus API so
that it is directly associated with a corresponding WiFi device.

Also rename all instances and variations of the substring "WakeOnWiFiEnabled"
to "WakeOnWiFiFeaturesEnabled" in variables and constant names. This is
to ensure consistency when referring to the run-time wake on WiFi enable
flag (i.e. "features"), so as to prevent confusion with the compile time
enable flag (i.e. DISABLE_WAKE_ON_WIFI).

CQ-DEPEND=CL:226302
BUG=chromium:427613
TEST=Run unit tests using the follow commands:

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

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

Verify that all unit tests pass in both cases.

Manual testing as follows:

1) Build a test image for samus and boot into it.

2) Run the following command:

/usr/local/lib/flimflam/test/list-devices

3) Note the wireless NIC device name (should be /device/wlan0). Also
verify that the value of WakeOnWiFiFeaturesEnabled is "ssid".

4) Run the following command:

dbus-send --system --print-reply --dest=org.chromium.flimflam \
/device/wlan0 org.chromium.flimflam.Device.GetProperties

where /device/wlan0 is the wireless NIC device name from step 3.
Verify that "WakeOnWiFiFeaturesEnabled" is printed with a value of
"ssid".

5) Run 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"

Verify that no error message is returned.

6) Repeat step 4 and verify that the "WakeOnWiFiFeaturesEnabled" property is
now "packet_and_ssid".

7) Run the following command:

dbus-send --system --print-reply --dest=org.chromium.flimflam \
/device/wlan0 org.chromium.flimflam.Device.SetProperty \
string:WakeOnWiFiFeaturesEnabled variant:string:"blahblah"

8) Verify that the following error message is returned:

Error org.chromium.flimflam.InvalidArguments: Invalid Wake on WiFi feature

Change-Id: I16129800ddcee3113c3bc8407297522e8747be49
Reviewed-on: https://chromium-review.googlesource.com/226334
Tested-by: Samuel Tan <samueltan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/manager.h
22ce765226cfdcf267b7dc80c22892e6b29065ea 16-Oct-2014 Paul Stewart <pstew@chromium.org> shill: Service: Move ManagerTest::SortServices to ServiceTest::Compare

We have long considered the SortServices test to be misplaced.
Finally move this to the Service unit tests, since after all,
this is testing the Service::Compare static method.

While here, mock EnableAndRetainAutoConnect() in MockService since
the move of SortServices was blocking this change.

BUG=chromium:206367
TEST=Unit tests

Change-Id: I4ec7d5a098edfb938d1ffd0ae78116f8004646c9
Reviewed-on: https://chromium-review.googlesource.com/223615
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
68b73d232e8a03ed55401f36ea1a72a2b69cf912 29-Oct-2014 Samuel Tan <samueltan@chromium.org> shill: make Manager::OnDarkSuspendImminent asynchronous

Use a ResultAggregator to make Manager::OnDarkSuspendImminent
asynchronous. This mirrors the approach used to make
Manager::OnSuspendImminent asynchronous in CL:218551.

Also:
- Add appropriate metrics for DarkResume actions.
- Added calls to SuspendAction metrics in the suspend actions
code path, and modified some calls that wrongly collected
termination action metrics.

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

Change-Id: I7b0a0e32a708479a4f1127ff1f587fd7ce3e803f
Reviewed-on: https://chromium-review.googlesource.com/226123
Tested-by: Samuel Tan <samueltan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/manager.h
cb3ecf321c52de1e72cdf037a459cd893b7c51db 25-Oct-2014 Samuel Tan <samueltan@chromium.org> shill: allow wake on SSID and packet to be enabled/disabled

Add and use flag that will allow wake on WiFi features (i.e.
wake on packet and wake on SSID) to be individually enabled and
disabled. This flag can be get or set via the Manager
DBus API.

The wake on SSID feature currently only enables wake on disconnect.
Wake on SSID is currently enabled by default on boards that support
wake on WiFi. On all other boards, wake on WiFi features are disabled
by default.

Also:
- Modify wake_on_wifi.cc check this flag to determine which
wake on WiFi features to enable before suspend.
- Modify wake_on_wifi_unittest.cc to work with the new flag
checks and to check if the flag correctly affects program
behavior.

CQ-DEPEND=CL:225484
BUG=chromium:426978
TEST=Compile and run unit tests using the following commands:

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

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

Manual testing on samus as follows:

1) Build a test image for samus

2) Connect samus to an AP. Ensure that ethernet is not connected
(i.e. only use WiFi).

3) Run the following command:

dbus-send --system --print-reply --dest=org.chromium.flimflam \
/ org.chromium.flimflam.Manager.AddWakeOnPacketConnection \
string:"1.2.3.4"

4) Verify that the following error is received in response to the dbus-send
command:

"Wake on Packet feature disabled, so do nothing"

5) Suspend the samus using the following command:

powerd_dbus_suspend

6) Disable or turn off the AP.

7) Verify that the samus wakes upon disconnecting from the AP.

8) Run the following command:

dbus-send --system --print-reply --dest=org.chromium.flimflam \
/ org.chromium.flimflam.Manager.SetProperty \
string:WakeOnWiFiEnabled string:none

9) Re-enable or turn on the AP again and connect the samus to it.

10) Repeat steps 5-6 and verify that the samus does not wake up upon
disconnecting from the AP.

Change-Id: I8e00b48de743cdd5511fe483ddebc3814323388e
Reviewed-on: https://chromium-review.googlesource.com/225515
Tested-by: Samuel Tan <samueltan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/manager.h
a757752df1b85d8af4590b64d0946b7b2bb0779f 21-Oct-2014 Samuel Tan <samueltan@chromium.org> shill: Manager: Allow wake on WiFi to be disabled

Add a Manager property with all WiFi devices check to test
whether or not Wake on WiFi functionality should be enabled.
This flag will determine if the AddWakeOnPacketConnection,
RemoveWakeOnPacketConnection, and RemoveAllWakeOnPacketConnections
will execute, and if shill will attempt to program the NIC
before suspend and after resume.

Add a utility script for changing Wake on WiFi behavior.

CQ-DEPEND=CL:224544
BUG=chromium:424821
TEST=Unit tests and Manual testing (see below)
1) Build a test image for swanky

2) Connect the swanky to an AP. Ensure that ethernet is not connected
(i.e. only use wifi).

3) Run the following command:

dbus-send --system --print-reply --dest=org.chromium.flimflam \
/ org.chromium.flimflam.Manager.AddWakeOnPacketConnection \
string:"1.2.3.4"

where "1.2.3.4" should be replaced with the AP's IP address.

4) Verify that no error is received in response to the dbus-send
command.

5) Suspend the swanky by running the following command:

powerd_dbus_suspend

6) Ping the suspended swanky from the AP.

7) Verify that swanky wakes on suspend upon receiving the ping.

8) Run the following command:

dbus-send --system --print-reply --dest=org.chromium.flimflam \
/ org.chromium.flimflam.Manager.SetProperty \
string:WakeOnPacketEnabled variant:boolean:false

9) Repeat step 3 with a different IP address and verify that the
following error message is received in response:

"Wake on Packet functionality disabled, so do nothing"

10) Repeat steps 5-6 and verify that swanky does not wake from suspend
upon receiving the ping.

11) Run 'restart shill', repeat step 2-7, and verify that wake on WiFi
functionality is working again (because it is enabled by default).

Change-Id: Ib40a50a6ef980c4c033d99dd8a72bb2e90ce46e6
Reviewed-on: https://chromium-review.googlesource.com/224527
Reviewed-by: Samuel Tan <samueltan@chromium.org>
Tested-by: Samuel Tan <samueltan@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
3a1bf99b484ad8a9a054518f49046221251d5612 24-Sep-2014 Samuel Tan <samueltan@chromium.org> shill: add separate WakeOnWiFi object

Make WakeOnWiFi an object instead of a namespace,
and move all functions, and members related to wake on
wireless functionality into this object. Each WiFi device
will now create a WakeOnWiFi object, save wake on wireless
state in it, and call its functions to carry out relevant
tasks.

Also update DBus Manager API with more accurate descriptions.

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

Change-Id: Ife1e9a9eac5c2ade8a0fa8576eccd868fb7a825a
Reviewed-on: https://chromium-review.googlesource.com/219882
Reviewed-by: Samuel Tan <samueltan@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
Tested-by: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/manager.h
fbe8d2b361a51e89fcf1207050729be86a961f5f 16-Sep-2014 Samuel Tan <samueltan@chromium.org> shill: use ResultAggregator for device suspend actions

Use ResultAggregator to have manager asynchronously execute each device's
suspend actions before a system suspend takes place. The previous
implementation executed these suspend actions synchronously and used
a HookTable for other termination/suspend actions. This implementation does
not change the use of the HookTable for termination action, but
uses only a ResultAggregator to wait for asynchronous suspend actions.

Manager now creates a ResultAggregator in OnSuspendImminent() and passes
a callback to every device as an argument to OnBeforeSuspend(). Each
device then performs synchronous actions and/or posts asychronous tasks
in OnBeforeSuspend(), and is responsible for running the received
callback after completing these actions.

Also:
- rename RetrySetWakeOnPacketConnection to RetryApplyWakeOnWiFiSettings
for consistency.
- add detailed documentation to result_aggregator.h explaining and
stating the conventions to be followed when using ResultAggregator.
- remove TerminationActionReason from metrics and add separate
Termination action and Suspend action metrics in preparation for
complete splitting of termination and suspend action codepaths.

BUG=chromium:390668
CQ-DEPEND=CL:223098
TEST='P2_TEST_FILTER="shill::*" FEATURES="test" USE="clang asan"
emerge-samus shill' succeeds.

Change-Id: I5a9d9039669a822e0cb82bf6784522f1ce86a966
Reviewed-on: https://chromium-review.googlesource.com/218551
Reviewed-by: Samuel Tan <samueltan@chromium.org>
Tested-by: Samuel Tan <samueltan@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/manager.h
9842441bbfae81053a6c08045f1d7b831e5101b2 01-Oct-2014 mukesh agrawal <quiche@chromium.org> shill: improve handling of profiles in WiFiProvider

Sometimes, WiFiProvider uses a default profile. Other times, WiFiProvider
uses a user profile. This is all well and good, but it's hard to follow
which case is which.

Resolve this problem, by giving WiFiProvider explict default_profile_ and
user_profile_ fields. Most existing tests were updated to explicitly use
the default_profile_.

While there:
- Clean up how default profiles are identified. (Do this via
a method in Profile, rather than a method in Manager.)
- Fix a whitespace issue in wifi_provider.cc.
- Remove some unused local variables in wifi_provider_unittest.cc.

BUG=chromium:419152
TEST=unit tests (on peppy)

Change-Id: Id1d04ad8f112ff4ee6e8d31b10413dbc1dc94350
Reviewed-on: https://chromium-review.googlesource.com/220670
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
94d18aff4f9f26e08929add6f5376f3df546d89e 12-Sep-2014 Peter Qiu <zqiu@chromium.org> shill: Add new metrics for tracking device presence status per technology

The new metrics will track the presence or absence of a device of
each technology type.

BUG=chromium:411510
TEST=unit tests, manual test
Manual Test:
1. Log in to a peppy device, wait around 3 minutes.
2. Browse to "chrome://histograms", verify histogram
"Network.Shill.Ethernet.DevicePresenceStatus" with a hit for
bucket 1 (present), "Network.Shill.Wifi.DevicePresenceStatus"
with a hit for bucket 1 (present),
"Network.Shill.Cellular.DevicePresenceStatus" with a hit for
bucket 0 (not present), and "Network.Shill.Wimax.DevicePresenceStatus"
with a hit for bucket 0 (not present).

Change-Id: I1571bdbaf2abf7d2fc909389638105e4213dce5a
Reviewed-on: https://chromium-review.googlesource.com/217786
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
8e6b8ef22e185310480c13aa3a6e89184cce62d1 15-Jul-2014 Ben Chan <benchan@chromium.org> shill: Add 'NoAutoConnectTechnologies' manager DBus property.

This CL adds a 'NoAutoConnectTechnologies' property to the manager DBus
interface, which is a comma-separated list of technologies for which
auto-connect is disabled. This property will be used by cellular tests
to temporarily disable auto-connect for a cellular device under test.

BUG=chromium:403164
CQ-DEPEND=CL:217813
TEST=Tested the following:
1. `FEATURES=test emerge-$BOARD platform2`
2. Manually test the following on a DUT:
- Plug in a cellular modem over USB.
- Verify that shill auto-connects the cellular service.
- Unplug the modem.
- Disable auto-connect on cellular via:
dbus-send --system --dest=org.chromium.flimflam \
/org/chromium/flimflam \
org.chromium.flimflam.Manager.SetProperty \
string:'NoAutoConnectTechnologies' string:'cellular'
- Plug in the modem again.
- Verify that shill no longer auto-connects the cellular service.

Change-Id: Ib09e7593695b0436c72717bc9463ce0c714185ee
Reviewed-on: https://chromium-review.googlesource.com/217825
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/manager.h
64ad2383c4555a99f4f09fe8f5faa088f99f5b90 26-Aug-2014 Prathmesh Prabhu <pprabhu@chromium.org> shill: Add dark resume methods to PowerManager client object.

This CL updates the PowerManagerProxy API in response to updated DBus API of
powerd. It also updates PowerManager to allow shill to register
DarkSuspendDelay with powerd, and handle DarkSuspendImminent message from it.
Finally, it adds stub (synchronous) functions in Manager/Device/Service base
objects to handle this message.

BUG=chromium:397346
TEST=(1) shill unittests.
(2) On a device supporting dark resume, test powerd/shill interaction
manually across a dark resume.
Change-Id: I872615a8a68d4e02b35aa50a165c06e9d034f0e4
Reviewed-on: https://chromium-review.googlesource.com/215371
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
9fdb84ba0ac2eb56961c90bba592481af493a10f 22-Aug-2014 Prathmesh Prabhu <pprabhu@chromium.org> shill: Simplify suspend delay handling.

shill::PowerManager currently supports multiple suspend delays at the cost of
added complexity. This CL simplifies this code by
- Supporting only one suspend delay registered at the |Start|.
- Hiding information about |suspend_id| from the rest of shill, because it is
safe to ignore |suspend_id| in our interaction with powerd: powerd ignores
messages sent to it with incorrect suspend_id's.

BUG=chromium:373348
TEST=(1) shill unittests.
(2) Manually tested a suspend-resume cycle for shill with and without a
cellular device.
(3) Ran power_SuspendStress.bare and power_SuspendStress.idle.

Change-Id: I2da6be38e6ad0de91d38101e4e28eb4e46b578c0
Reviewed-on: https://chromium-review.googlesource.com/213740
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
/system/connectivity/shill/manager.h
c863d062043b8eb096904e3a4920b2826bd752c0 15-Aug-2014 Samuel Tan <samueltan@chromium.org> shill: change variable name ip_endpoints to ip_endpoint

Change all occurences of variable ip_endpoints to ip_endpoint
to reflect the fact that only a single IP address representing
a singular endpoint is being accepted and passed around by the
relevant functions in shill. Also removed unnecessary IP
construction functions in wake_on_wifi_unittest.

BUG=none
TEST='emerge-squawks platform2' succeeds; unit tests

Change-Id: I93c1f389c1a37fb7ebea56da5f2f686e426a3aab
Reviewed-on: https://chromium-review.googlesource.com/212350
Tested-by: Samuel Tan <samueltan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/manager.h
fe734676357045eab81ab62fc3ea7ae1a40ed905 08-Aug-2014 Samuel Tan <samueltan@chromium.org> shill: add Lucid Sleep DBus API to Manager and Device

Added skeleton implementation and documentation of Lucid Sleep DBus API.

Extended IPAddressStore to allow removal of IPAddresses and access to
the underlying set.

BUG=chromium:399137
TEST='emerge-squawks platform2' succeeds; unit tests

Change-Id: I5ab41dc17d0e95f2291b3d1dd4287dec9d31c9bc
Reviewed-on: https://chromium-review.googlesource.com/211510
Tested-by: Samuel Tan <samueltan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Samuel Tan <samueltan@chromium.org>
/system/connectivity/shill/manager.h
8e9e41cedee1a6be89ebc027afab62c9a52cb574 07-Aug-2014 Paul Stewart <pstew@chromium.org> shill: Manager: Allow Wake on LAN to be disabled

Add a Manager property which all Ethernet devices check to test whether
Wake on LAN should be enabled. When bringing up link on an Ethernet
device, this flag will be used to enable or disable wakeup on magic
packet. This change preserves the default behavior which is to enable
Wake on LAN by default. This property in the Manager is not persisted.

Add a utility script for changing Wake on LAN behavior.

CQ-DEPEND=CL:211477
BUG=chromium:398277
TEST=Manual (see below)
1. On a system with a connected USB-to-Ethernet adapter, run:

ethtool eth0 | grep -e '^.Wake'

and observe that by default the output is:

Wake-on: g

as a result of https://chromium-review.googlesource.com/192665

2. Run the following command:

dbus-send --system --print-reply --dest=org.chromium.flimflam \
/ org.chromium.flimflam.Manager.SetProperty string:WakeOnLanEnabled \
variant:boolean:false

3. Repeat step 1 and note that the output is still "Wake-on: g"

4. Detach and re-attach Ethernet and not the output from step 1 i snow "Wake-on: d"

5. Run "restart shill" and note the output from step 1 is back to "Wake-on: g"

Change-Id: I99e645f7e96fafcb19524a3355673d16f6bf5c15
Reviewed-on: https://chromium-review.googlesource.com/211495
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
700de6400c18f8cba77821f8cd2a1935b96999a6 15-Jul-2014 Peter Qiu <zqiu@chromium.org> shill: Reporting of device's connection status

Report device's connection status to UMA stats periodically. Possible status
are offline (not connected to an AP), connected (connected to an AP), and
online (connected to an AP with internet connectivity). When the device is
in online state, it will report both connected and online to UMA stats.

This data will allow us to determine the percentage of time when the device
have internet connectivity, also the percentage of time when the device is
connected to an AP but without internet connectivity.

While at it, update the old IsOnline function in manager.cc to IsConnected
to be more semantically correct, since that function return true if there is a
service that's in connected or above state. And Add a new IsOnline function
which will return true only if there is a service that's in online state.

BUG=chromium:392990
TEST=unit tests, manual
Manual Test:
1. Boot up a chrome device without any network connectivity.
2. Wait for 3 minutes, and browse to "chrome://histograms", veriyf
there is a histogram for "Network.Shill.DeviceConnectionStatus"
with a hit for bucket 0 (offline).
3. Connect the chrome device to an AP without internet connectivity.
4. Wait for 3 minutes, and browse to "chrome://histograms", verify
there is a hit for bucket 1 (connected) for histogram
"Network.Shill.DeviceConnectionStatus".
5. Connect the chrome device to an AP with internet connectivity.
6. Wait for 3 minutes, and browse to "chrome://histograms", verify
there sia hit for bucket 1 (connected) and 2 (online) for
histogram "Network.Shill.DeviceConnectionStatus".

Change-Id: I1a949b17398214d745ca1d5a37e35202e087181a
Reviewed-on: https://chromium-review.googlesource.com/207960
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/manager.h
6eb4f2ccd75db01286b5f7b028b73b53b0f48e0a 01-Jul-2014 mukesh agrawal <quiche@chromium.org> shill: always register for SuspendDone events

In CL:195690, we updated shill to work with the new API for
org.chromium.PowerManager. Unfortunately, that change had
the side-effect that Manager would only receive SuspendDone
(aka Resume) events if some object in shill had set a termination
action.

The consequence of this is that, unless a device had a
cellular modem, Manager wouldn't ask PowerManager for
SuspendDone events. That means that WiFi (in particular)
wouldn't know when the system resumed.

Without knowing that the system had resumed, WiFi would
not restart or LinkMonitor (if connected), or start scanning
immediately (if disconnected). This meant that users could
experience longer delays before getting back online after
suspend/resume.

Fix this by always registering for SuspendDone events,
regardless of whether or not there are registered termination
actions.

Note: the lack of resume events could also have led to
Chromebooks retaining leases longer than they should have.
(The clock used to trigger DHCP renewals doesn't advance
during suspend. To accomodate this, we renew DHCP on every
resume event. But without the SuspendDone event, this code
wouldn't be triggered.)

BUG=chromium:390294
TEST=unit tests, manual

Manual test
-----------
- configure DUT to connect to GoogleGuest
- install modified shill on DUT
- restart shill on DUT
- echo > /var/log/net.log
- suspend DUT
- resume DUT
- egrep 'wifi.+OnAfterResume' /var/log/net.log
-> there should be a matching line

Change-Id: I927d34bb6615c72d672cf63880c3946c8e8696b5
Reviewed-on: https://chromium-review.googlesource.com/206596
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
3fbf8bd4508f35cc3aec35e8ec562dd37eeb282c 08-Jun-2014 Ben Chan <benchan@chromium.org> shill: Clean up HookTable implementation.

This CL cleans up the HookTable implementation as follows:
1. Replace base::Callback<void(const Error &)> with shill::ResultCallback.
2. Make HookTable::AllActionsComplete() a const method.
3. Add verbose logging to HookTable::Add() and HookTable::Remove().
4. Remove iterator-based for-loop with range-based for-loop.
5. Simplify HookTable::Remove() by calling std::map::erase() to remove
an entry by key.
6. Fix some typos.
7. Rename some callback variable names to be more consistent with other
shill code.
8. Use std::map::emplace() instead of std::map::insert().

BUG=None
TEST=Tested the following:
1. `FEATURES=test emerge-$BOARD platform2`
2. Verify that shill executes the termination action upon suspend on a
DUT with a cellular device.

Change-Id: I5bec3c53ba7cdb9ac5a3f7a5d1f3d765e6402865
Reviewed-on: https://chromium-review.googlesource.com/203191
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/manager.h
19a14db2ad2ea381ec30074fe2e53a619a97cd0c 30-May-2014 Paul Stewart <pstew@chromium.org> shill: Manager: Emit property-change messages for ServiceCompleteList

Chrome will now depend on PropertyChange events for this Manager
property.

BUG=chromium:379231
TEST=Unit tests

Change-Id: If2f0502db141761d4634a3b800e76c7e864b13d7
Reviewed-on: https://chromium-review.googlesource.com/202223
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
/system/connectivity/shill/manager.h
0a59a5a484634f798222ad077dbbfa7faa76651d 25-Apr-2014 mukesh agrawal <quiche@chromium.org> shill: stop passing around format strings for profiles

Prior to this CL, shill passed around format strings, to specify
where the user profiles should be stored. While this makes things
more configurable, it also a) makes things more complex, and
b) causes g++ to emit warnings that some format strings can't be
checked statically.

The location of user profiles doesn't need the full power of
printf-format style configurability. We really only need the
ability to specify which directory the user profiles are
stored in.

Note that this changes requires updating some unit tests,
which actually did take advantage of the flexibility. In
particular, some of the Manager and Profile unit tests placed
user profiles directly in a user profile directory, rather
than creating a user-specific sub-directory first. Creating
the user-specific directories seems like the right thing to
do, since that it what the normal (non-test) code does.

BUG=chromium:293668
TEST=unit tests

Change-Id: Ic1afeec84a7797105c9a49b8261a9677e17d91ee
Reviewed-on: https://chromium-review.googlesource.com/197061
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
fac0953b10f3c13f47ecd588c0f9a0382bc32776 18-Apr-2014 Daniel Erat <derat@chromium.org> shill: Use SuspendDone signal instead of PowerStateChanged.

PowerStateChanged will be removed from powerd soon; clients
should use SuspendImminent and SuspendDone instead.

Also simplify the interface exposed by PowerManager for
adding and removing suspend delays.

BUG=chromium:359619
TEST=updated tests

Change-Id: I7f96774570170591c2e5944245c368e165aaf972
Reviewed-on: https://chromium-review.googlesource.com/195690
Reviewed-by: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>
/system/connectivity/shill/manager.h
9d58193108f55edf0f06cd54f44464da633cb8aa 15-Apr-2014 Peter Qiu <zqiu@chromium.org> Services network reporting.

Added a network ID to each services object, to identify the network
(gateway) that the service is connected to. Network ID is generated by
hashing a random salt value, together with gateway's IP and MAC address.
At the time when the device is connected to a network, report the number
of services that are connected to the same network.

BUG=chromium:359302
CQ-DEPEND=CL:194942
TEST=unittest, manual
Manual Test
1. Configure airport extreme router with two BSSes bss1 "cros airport extreme wpa2"
and bss2 "cros aiport extreme wpa2 5GHz".
2. Connect a peppy device to bss1, then connect it to bss2.
3. Verify the ip address stays the same when connected to bss2.
4. Verify the ConnectionId for both BSSes is the same in
"/var/cache/shill/default_profile".
5. Verify histogram for Network.Shill.ServicesOnSameNetwork
exist in "chrome://histogram", and there is 1 entry for value 2.

Change-Id: I01c446b58be96cb0613a7d5336248838a6e865a9
Reviewed-on: https://chromium-review.googlesource.com/194857
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/manager.h
574996af8ed3e3c2fe2bc16970f73c665296cfcc 04-Apr-2014 Peter Qiu <zqiu@chromium.org> Add metrics for effectiveness of wifi network selection.

Report number of auto connectable wifi services available when
auto connect is started for wifi.
Report number of BSSes associated with a wifi service when connecting
to that service.

BUG=chromium:230884
TEST=unittest, manual
1. Connect a peppy to GoogleGuest.
2. Browse to "chrome://histograms", and verify histogram for
Network.Shill.wifi.AvailableBSSesWhenConnect existed.
3. Verify GoogleGuest is in Preferred Network
4. Restart shill to start auto connect.
5. Browse to "chrome://histograms", and verify histogram for
Network.Shill.wifi.AutoConnectableServices existed.

Change-Id: I5315210944e8f5a5a2253562f680de8217963024
Reviewed-on: https://chromium-review.googlesource.com/193226
Reviewed-by: Peter Qiu <zqiu@chromium.org>
Tested-by: Peter Qiu <zqiu@chromium.org>
Commit-Queue: Peter Qiu <zqiu@chromium.org>
/system/connectivity/shill/manager.h
a0ddf46e466bd4ba3d20952f0a6988c680c1af14 06-Feb-2014 Ben Chan <benchan@chromium.org> shill: Update to build against libchrome-242728.

BUG=chromium:341521
CQ-DEPEND=CL:193660
TEST=Tested the following:
1. `FEATURES=test USE='cellular wimax' emerge-$BOARD platform2`
2. Run the following tests:
- network_3GSmokeTest
- network_VPNConnect.*
- network_WiMaxSmoke
- wifi_matfunc

Change-Id: Ic1553c182ab7a833a68c45f012f646b8930cb095
Reviewed-on: https://chromium-review.googlesource.com/193606
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/manager.h
92496a43b023b912f7f251d0167be360b3335690 09-Apr-2014 mukesh agrawal <quiche@chromium.org> shill: improve out-of-disk handlng

At present, shill deals poorly with the case where no default profile
exists, and no default profile can be created. In particular, it aborts
in this case. Consequently if the disk is full, and no default profile
is present, shill gets in to a crash loop.

Remedy this by adding a StubStorage class, and using this to back
the DefaultProfile, if we can't back the DefaultProfile with a file
on disk.

One of the alternatives considered was to back the DefaultProfile
using a file in /tmp. This approach seems simpler, in that we don't
need to worry about securing the file in /tmp, or about the
possibility that /tmp is also full.

While there:
- Add DISALLOW_COPY_AND_ASSIGN to the Manager class.
- Make Manager::LoadProperties and Profile::LoadManagerProperties
return void instead of bool. Previously, Profile::LoadManagerProperties
would always return true. That would cause Manager::LoadProperties
to always return true. Seems simpler to return void.
- Fix a grammar nit in profile.cc.
- Fix a typo in profile.h.

BUG=chromium:355140
TEST=network_DiskFull, unit tests

Note that the network_DiskFull may report failures due to
metrics_daemon not running. However, the test should not show
any errors related to shill or flimflam.

Change-Id: Ic081a40d7680ce035ead1459a08bf63e7989f0d6
Reviewed-on: https://chromium-review.googlesource.com/193693
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
9d97b7deda3ae604d718873207a951f62d418b34 14-Mar-2014 Paul Stewart <pstew@chromium.org> shill: WiFi: Set disable_vht parameter

Provide a run-time Manager property which sets the WiFi
provider's "disable_vht" field. This will be used to enable or
disable VHT in wpa_supplicant.

CQ-DEPEND=CL:189960,CL:189941
BUG=chromium:352260
TEST=Unit tests

Change-Id: Id380ce15982418dea2845f722460c612aee565db
Reviewed-on: https://chromium-review.googlesource.com/189961
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
66174a16342457c5e733292425fda13d6704779d 09-Jan-2014 Ben Chan <benchan@chromium.org> shill: cellular: Replace g_bus_watch_name with DBusNameWatcher.

This CL changes the ModemManager class to use DBusNameWatcher, instead
of g_bus_watch_name, to monitor the presence of modem manager DBus
service daemons. Glib::BusWatchName and Glib::BusUnwatchName are also
removed.

BUG=chromium:214475
TEST=Tested the following:
1. Build and run unit tests.
2. Manually verify, via /var/log/net.log, that shill can observe and
handle the scenarios when cromo and ModemManager appear on and vanish
from DBus.

Change-Id: I57257f076a05101d9c38d5ff3044884378e91337
Reviewed-on: https://chromium-review.googlesource.com/182052
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/manager.h
5742b24ab984464701fef0cc7024af2637357b04 19-Dec-2013 Ben Chan <benchan@chromium.org> shill: Completely exclude ModemInfo when built with USE=-cellular.

Instead of having a shallow implementation of ModemInfo, this CL
completely excludes ModemInfo when building shill without cellular
support. This addresses the following compilation issues when building
shill with USE=-cellular:

modem_info.cc:35:12: error: unused variable 'kCromoService'
modem_info.cc:36:12: error: unused variable 'kCromoPath'
modem_info.cc:38:12: error: unused variable 'kCellularOperatorInfoPath'
mock_modem_info.cc:32: error: undefined reference to shill::ModemInfo::set_pending_activation_store(shill::PendingActivationStore*)'
mock_modem_info.cc:36: error: undefined reference to shill::MockCellularOperatorInfo::MockCellularOperatorInfo()'
mock_modem_info.cc:36: error: undefined reference to shill::ModemInfo::set_cellular_operator_info(shill::CellularOperatorInfo*)'
mock_modem_info.cc:66: error: undefined reference to 'mobile_provider_open_db'

BUG=chromium:329715
TEST=Tested the following with {x86,amd64,arm}-generic:
1. `FEATURES=test emerge-${BOARD} platform2`
2. `USE='-debugd -cellular' emerge-${BOARD} platform2`
3. Run network_3GSmoke test with shill built with cellular support.

Change-Id: I348486604ceaaca5e90dd15df40edeaa6e6b6d68
Reviewed-on: https://chromium-review.googlesource.com/180800
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Gaurav Shah <gauravsh@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/manager.h
520eb176ecc8548a9eb6a340fb46c06618ee8308 31-Oct-2013 Ben Chan <benchan@chromium.org> shill: Disable WiMAX support when built with USE='-gdmwimax -wimax'.

BUG=chromium:313512
CQ-DEPEND=CL:175208,CL:175219,CL:175218,CL:*147371
TEST=Tested the following with lumpy and daisy with a WiMAX module:
1. `USE='gdmwimax wimax' FEATURES=test emerge-$BOARD platform2`
2. `USE='-gdmwimax -wimax' FEATURES=test emerge-$BOARD platform2`
3. When built with WiMAX support, verify that shill detects and supports
the WiMAX module properly. Run network_WiMaxSmoke to confirm.
4. When built without WiMAX support, verify that shill ignores the WiMAX
module.

Change-Id: Ia38f0ac0aa04c06facaf3016716b700efb466976
Reviewed-on: https://chromium-review.googlesource.com/175204
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/manager.h
b113666ed22ca4d18a1a628b4d35750da3c5a3ae 15-Oct-2013 mukesh agrawal <quiche@chromium.org> shill: cleanups and logging

Fix a few small issues I noticed while working on suspend-resume
issues with PPP dongles, and add some logging that helps understand
the suspend/resume process.

More specifically:
- Add some override annotations to cellular.h
- Fix a typo in device.h
- Update a stale comment in device.h
- Add some logging for termination actions. This uses scope Manager
for HookTable. It's conceivable that some other component will
use HookTable as well. But let's worry about that when it happens.
- Remove obsolete headers (FRIEND_TEST_ALL_PREFIXES)
- Add comment for Cellular::ModemState

BUG=None
TEST=unit tests

Change-Id: I94761c2e5e8df304d1d32794bbf7069c359a1cda
Reviewed-on: https://chromium-review.googlesource.com/173755
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
03e29f77413e978ecfbd46e51979916f6e7ebff8 26-Sep-2013 Paul Stewart <pstew@chromium.org> shill: Manager: Create and emit signals for the ConnectedState property

As opposed to the "State" property of the Manager which is strictly
"offline" or "online", this new property returns the connected state
of the highest-ranked service. This allows observers to tell whether
or not to expect to have wider network connectivity by waiting for
this property to be "online", with the assurance that portal detection
has completed successfully.

CQ-DEPEND=CL:170701
BUG=chromium:298568
TEST=New unit test + manual: run "dbus-monitor --system" and restart
shill. Expect to see updates to the "ConnectionState" of the manager;
initially "idle" as the manager starts:

signal sender=:1.20 -> dest=(null destination) serial=11 path=/; interface=org.chromium.flimflam.Manager; member=PropertyChanged
string "ConnectionState"
variant string "idle"

then ultimately if the connection succeeds:

signal sender=:1.20 -> dest=(null destination) serial=62 path=/; interface=org.c
hromium.flimflam.Manager; member=PropertyChanged
string "ConnectionState"
variant string "online"

Change-Id: I2c34e33c6742cbe7516af7208131e76344b2f690
Reviewed-on: https://chromium-review.googlesource.com/170704
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
7de7e02e14074989757a4f9f220de2310cc05236 28-Aug-2013 Paul Stewart <pstew@chromium.org> shill: Manager: Cache Geolocation Info

Instead of polling devices for their current scan information when
Manager::GetNetworksForGeolocation() is called, instead have devices
notify the Manager when they have new (and complete) geolocation
information to share. At this point in time the Manager caches this
information in a per-technology map which it will return to callers
asking for geolocation information. As a result, callers receive the
most complete information from the last scan.

The task of ensuring that this geolocation information is maintained
at a desired "freshness" is left as a separate exercise.

BUG=chromium:236418,chromium:217247
TEST=Unit tests; connect to AP and allow scan cache to expire
("list-services" only shows connected AP), call
manager.GetNetworksForGeolocation() and ensure the data from the
most recent scan is still available.

Change-Id: I67316656168173ad3ed6c19a3368c9f75b7322f3
Reviewed-on: https://chromium-review.googlesource.com/167310
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
d3d0388d4c93e0f1f526671f3826c219cf438886 30-Aug-2013 Paul Stewart <pstew@chromium.org> shill: Clean up Service::Remove()

This method used to leave the service in an inconsistent state
(unloading the service while still linking it with a profile that
contained its configuration). This CL adds a real implementation
which disassociates the service from its current profile and
unloads the service if no other profile supports it. It also
supports removing the service from the Manager's list if the
service should no longer exist.

BUG=chromium:281655
TEST=Unit tests + manual:
Call RemoveService on a visible, remembered service and note that
the service is unloaded and no longer associated with a profile.
Call RemoveService on a remembered but non-visible service and
note that the service is unloaded, the configuration no longer
exists and the service is removed from the Manager ServiceCompleteList.

Change-Id: I985c4498b5acf55b8f3d78ee570d30597a2c5384
Reviewed-on: https://chromium-review.googlesource.com/167530
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
bc14fb7e10919a39d8e82d5981d94961aa5d4be7 30-Jul-2013 Paul Stewart <pstew@chromium.org> shill: *Provider: Flesh out inherited classes

Implement CreateTemporaryService and FindSimilarService for all
remaining service subclasses. Now that this is done, change
Provider into a pure-virtual ProviderInterface and remove its
implementation and tests.

BUG=chromium:265592
TEST=Unit tests

Change-Id: I4b74ad7b8602d90908b7596bbbb08eddb01e1c17
Reviewed-on: https://gerrit.chromium.org/gerrit/63650
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
b87d22b774fe15b6580d13638d5f0514bde031fd 29-Jul-2013 Paul Stewart <pstew@chromium.org> shill: Manager: Map between Technology and Provider

Create a map between Technology::Identifier and the Provider, so
most operations on provders are done either by iterating through
the map or by selecting the provider by its technology. There
are some exceptions remaining, namely the methods called in
ConfigureServiceForProfile, which will be fixed in an upcoming
CL, and a few methods where the Manager explicitly calls
non-generic methods on the WiFiProvider.

BUG=chromium:265518
TEST=Unit tests

Change-Id: I43f217c6050d68d1f94800d08b06a7dcf1e5bafc
Reviewed-on: https://gerrit.chromium.org/gerrit/63605
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
46c27cc8f83428ce6b290c4d92e73fbcad899457 11-Jul-2013 mukesh agrawal <quiche@chromium.org> shill: fix DisableTechnology with multiple devices of a technology

For some Devices (e.g. Cellular), EnableTechnology and DisableTechnology are
asynchronous operations. Previously, shill would invoke the completion
callback for these operations, as each Device completed its work.
Unsurprisingly, this would fail on the second device.

Fix this by introducing ResultAggregator, which aggregates the results from
multiple asynchronous operations. Now, if the Devices process
EnableTechnology or DisableTechnology asynchronously, then we will return
only after the final Device has completed the request.

While there: merge the code for EnableTechnology and DisableTechnology,
since the methods were symmetric, but non-trivial.

Note that one ugly case remains: if one or more Devices fails immediately,
but others all succeed asynchronously, we will not report any failure.

BUG=chromium:258206
TEST=new unit tests, manual

Manual testing
--------------
- grab a device with two cellular modems (e.g. on-board and usb)
- disable cellular from the ash tray
-> shill should not crash
- enable cellular from the ash tray
-> shill should not crash

Change-Id: I09f94326342900e4cee6929d9edbe5cf735c92d7
Reviewed-on: https://gerrit.chromium.org/gerrit/62016
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
ad0e598399c224cfed6fc90464d3022fa8c067ef 02-Jul-2013 Paul Stewart <pstew@chromium.org> shill: Service: Implement "SetProperties" DBus call

Configure multiple Service properties at once in a single call.
This method differs from Manager::ConfigureService in two important
ways: Firstly, since this is a service method, the service is
found via its RPC identifier as opposed to its GUID or other
properties. Secondly, only the service properties are set -- it
is not assigned a profile like ConfigureService -- in fact the
"Profile" property is silently ignored if provided to this call.

BUG=None
TEST=Unit tests

Change-Id: Ied4b75184bc4c27d88652dc14d14ef3f49b1574e
Reviewed-on: https://gerrit.chromium.org/gerrit/60775
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
00752534b439078333ce6cefe23cbef3467d1b51 04-May-2013 mukesh agrawal <quiche@chromium.org> shill: fix default settings for new profiles

While fixing chromium:221021, I broke portal detection (and a couple other
features). This happened because, in the absence of an existing default
profile, shill would create a default profile, and save it immediately. This
circumvented the logic in DefaultProfile::LoadManagerProperties, which
initializes the default profile with default values for some properties.

Fix this by restoring the call to Manager::LoadProperties, in
Manager::InitializeProfiles.

BUG=chromium:237927
TEST=new unit tests, manual

Manual test
-----------
- # stop shill
- # rm /var/cache/shill/default.profile
- # start shill
- # grep 'CheckPortalList=ethernet,wifi,cellular' /var/cache/shill/default.profle
-> should show a line exactly matching the pattern

Change-Id: I4696ce445b45cad05a167d91c41e8f5eb486fe0c
Reviewed-on: https://gerrit.chromium.org/gerrit/50081
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
cdde79fe1eeae3274ab343e32d87c7ba4c0ef4de 01-May-2013 Christopher Wiley <wiley@chromium.org> shill: Enable configured destination reconfiguration

Allow Chrome to pass down SSID and BSSID parameters which indicate that
the destination in question is already configured and we should not
expect to be connected to it as a AP.

BUG=chromium:237048
TEST=Unit tests.

Change-Id: Id8cfee78582f195cbdb7f49d7694ed0b6d26efd1
Reviewed-on: https://gerrit.chromium.org/gerrit/49818
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>
/system/connectivity/shill/manager.h
bebf1b8bce52b88c2cc2d93200b9405f9c19cf21 24-Apr-2013 mukesh agrawal <quiche@chromium.org> shill: make setting a property to its current value a no-op

Before this change, setting the EAP authentication properties
on a WiFiService would cause the connection to be dropped.
The connection would drop even if the new values were the same
as the old.

With this change, the connection is only dropped if the new
values differ from the old.

Overview of changes:
- AccessorInterface: have property setters return a bool (rather
than void). Setters should return true to indicate the value was
changed, and false otherwise.
- PropertyAccessor and derived classes:
- Implement the new AccessorInterface.
- Add tests that we implement the new AccessorInterface.
- Custom property setters (various classes):
- Update existing custom setters to return true if the value was
changed, and false otherwise.
- Add tests that custom setters implement the desired behavior.
- DBusAdaptor
- Change SetProperty to propagate the return value of
PropertyStore's setters, rather than Error::IsSuccess().
- In combination with other changes, this means
DBusAdaptor::SetProperty now returns false if the new value is
the same as the old.
- This also suppresses some spurious change notifications from
IPConfig, Manager, and Profile objects.
- Add tests that DBusAdaptor::SetProperty implements the desired
behavior.
- PropertyStore
- Add a change callback. This optional argument to the ctor is
invoked if a setter or clearer modified its property. This
is so that classes don't have to depend on their RPC adaptors
to inform them of a change. (See changes in Service.)
- Have setters pass through the return value of the Accessor,
rather than returning Error::IsSuccess(). In
combination with other changes, this means that setters
now returns false if the new value is the same as the old.
- Add tests that PropertyStore invokes the change callback
appropriately.
- ClearPropertyNonexistent, SetPropertyNonexistent: no callback
- ClearProperty: callback
- SetProperty: callback if and only if property changed
- Service
- Register OnPropertyChanged with PropertyStore, instead of relying
on a callback from ServiceDBusAdaptor. Two reasons for the change:
1) The RPC adaptors should be as trivial as possible, and
2) We can't test code in the RPC adaptors.
3) If we can't test code in the RPC adaptors, go to 1.
- ServiceDBusAdaptor: remove OnPropertyChange callback in SetProperty.
See Service for the rationale.
- Update existing SetProperty tests (various classes)
We now use values that differ from the current value of the property.
This ensures that the setter returns true.
- WiFiServiceTest: add a case to test that EAP authentication property
changes caused cached credentials to be cleared appropriately. This is
redundant given some of the other tests. But given that this was the
original problem in the bug, it seems worth testing specifically.
- HACKING: add some guidelines for what to do when adding properties.

While there:
- Change some HelpRegister... functions to HelpRegisterConst...
- Update some tests to check error.is_set() before reading
error.name(). This avoids a stray pointer dereference.
- Add SetStringmapsProperty to PropertyStore. This is needed because
PropertyStoreTypedTest now tests setters.
- Remove duplicate kAutoConnectProperty test case in ServiceTest.SetProperty
- Remove unused local in WiFiServiceTest.SetPassphraseRemovedCachedCredentials
- Remove unused method Device::HelpRegisterDerivedStrings
- Remove KeyValueStore from the set of types exercised by
PropertyStoreTypedTest. We only use KeyValueStore for const
properties, and PropertyStoreTypedTest tests setting and
clearing.
- Add PropertyChanges test to EthernetEapServiceTest.
BUG=chromium:233681
TEST=new unit tests

Change-Id: I9bdd89fbe6f19101dfcd5f126f2ba9c81533ff97
Reviewed-on: https://gerrit.chromium.org/gerrit/49733
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
d142fd64e818027815377f5b7d2fc4679db08aa5 02-May-2013 mukesh agrawal <quiche@chromium.org> shill: fix hidden networks in default profiles

When shill starts up, Manager::InitializeProfiles restores the
profile stack. This includes the default profile, as well as any
necessary user profiles. (User profiles are necessary if shill
aborted with user profiles on the stack.)

In the process of restoring the profiles, Manager normally asks
each technology Provider to examine the profile for Services
that need to be instantiated. Of particular relevance to this
bug is that WiFiProvider instantiates hidden WiFiServices from
the profile(s).

In order to automatically connect to hidden networks that are
stored in the default profile, Manager:InitializeProfiles needs
to hand the default profile to the WiFiProvider. This didn't
happen before, because the default profile was special-cased.

Fix this by using PushProfileInternal for the default profile,
just like we do for user profiles.

BUG=chromium:221021
TEST=new unit test, manual

Manual test
-----------
- log in
- # stop shill
- # rm /var/cache/shill/default.profile
- # start shill
- log out
- while logged out, connect to a hidden network
- reboot
- observe that shill reconnects to the hidden network

Change-Id: I5b0e517d003522cc8da63d5502cad173ef1afe04
Reviewed-on: https://gerrit.chromium.org/gerrit/49838
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
967eaebb63aac3b9679dc4b2dca0565292e3af03 26-Apr-2013 Paul Stewart <pstew@chromium.org> shill: Service: Return profile entries that can configure

Add a Service DBus method that can provide the set of
(profile, entry) pairs that contain configuration for the
Service. This can be used to figure out what profile
entries other than the one currently associated with the
service contain configuration entries relevant to this
service.

BUG=chromium:235674
TEST=Unit tests + manual: call GetLoadableProfileEntries
on a remembered service from python returns something like:
dbus.Dictionary({dbus.ObjectPath('/profile/default'): dbus.String(u'wifi_any_beef_managed_psk')}, signature=dbus.Signature('os'))

Change-Id: Id94f98b98e5cb5c98c32c765e707125f53dae2d9
Reviewed-on: https://gerrit.chromium.org/gerrit/49279
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
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/manager.h
0b1ebf11b58cbb23abc0d5b1c914dfadcbae7669 12-Apr-2013 Wade Guthrie <wdg@chromium.org> shill: Makes netlink message logging finer-grained.

Logs netlink message headers at a more permissive log level than the
bodies of those messages.

While I was in there, I changed a couple comments.

BUG=None
TEST=unittest.

Change-Id: I7d6e415dd5a7d3ec86e260a0a6664b8be813f42a
Reviewed-on: https://gerrit.chromium.org/gerrit/48015
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
Commit-Queue: Wade Guthrie <wdg@chromium.org>
/system/connectivity/shill/manager.h
e6c44440f5cf102c14581c961028a7830cc6448f 19-Apr-2013 Paul Stewart <pstew@chromium.org> shill: Remove "--push" argument parsing

Now that init no longer uses this argument in vain, remove the
"--push" argument from shill's command-line parsing.

CQ-DEPEND=CL:48604
BUG=chromium:231858
TEST=Unit tests

Change-Id: I3838057b2127f271a23ec40d27b248a91a840bcf
Reviewed-on: https://gerrit.chromium.org/gerrit/48607
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
78af94ce5ff7c3f22bda6148c6115ec8591129a5 18-Apr-2013 Paul Stewart <pstew@chromium.org> shill: Manager: Track loaded profiles internally

Before this change, the list of logged-in profiles was passed to
shill by the shill.conf init script. This change allows shill to
track the list of profiles (and the hashes assigned to them)
internally, ignoring the "--push" flag. A follow-on change will
remove the --push flag entirely.

BUG=chromium:231858
TEST=Unit tests + manual: Restart shill while logged in and make
sure "list-profiles" shows the user profile is loaded. Reboot
while logged in and make sure "list-profiles" only shows the default
profile. Log in and make sure /var/run/shill/loaded_profile_list
contains the user profile name.

Change-Id: Ib3d8cd6d78eeeec532cf876a38da6986587403aa
Reviewed-on: https://gerrit.chromium.org/gerrit/48582
Tested-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
35eff134fd95fdf1918803c4966f8b790914b3d4 12-Apr-2013 Paul Stewart <pstew@chromium.org> shill: Ethernet: Create shared credentials provider

Share a single service instance for all Ethernet devices to use
for EAP credentials. This service instance is only used for EAP
authentication, so other parameters such as Static IP paramters
are still retrieved from the per-device Ethernet service. Provide
a method for all Ethernet devices connected to an EAP
authenticator to be notified when the EAP credentials for this
shared service have been changed. Use both facilities in the
Ethernet device.

CQ-DEPEND=CL:48162
BUG=chromium:227433
TEST=New unit tests; revised version of network_8021xWiredAuthentication
(see co-dependent CL)

Change-Id: I5b19723dddfa2d793090128adb6429f31174b276
Reviewed-on: https://gerrit.chromium.org/gerrit/48138
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
f3eced90466010ac4b067a565ba371c476e6de67 17-Apr-2013 Paul Stewart <pstew@chromium.org> shill: Profile: Add "UserHash" property

Add a read-only property to the Profile that contains an opaque
"UserHash" string. This string is populated using a new field
in the Profile::Identifier structure, which can be filled in as
it is being created by by using a new Manager::InsertUserProfile
RPC call. InsertUserProfile is so named because it's still not
completely resolved in the design where in the profile stack a
profile inserted via this method will end up (See design doc
https://go/cros-multiprofile for up-to-date discussion).

CQ-DEPEND=CL:48378
BUG=chromium:231858
TEST=Unit tests

Change-Id: I0c6623f3d7253eb4d773712cddb72a222c0be6c5
Reviewed-on: https://gerrit.chromium.org/gerrit/48405
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
60a3706bee5686ae2322a774b9e7d5e8e63fcaf7 02-Apr-2013 Wade Guthrie <wdg@chromium.org> shill: Keeps track of successful wifi connection frequencies.

Saves the connection frequencies (and counts therefor) in the default
profile. Sends number of frequencies on which successful connections
have been made to an UMA stat.

BUG=chromium:222081
TEST=unittests and manual (look for UMA stat
'Network.Shill.Wifi.FrequenciesConnectedEver', disconnect from
wifi, reconnect, verify that the UMA stat went up by 1).

Change-Id: I1e3c75b82ac387dd01066c4da4ebfce2c4b2ddc0
Reviewed-on: https://gerrit.chromium.org/gerrit/47154
Commit-Queue: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
/system/connectivity/shill/manager.h
68d4109ff0176f7e5a9b67b916478d638aac577a 02-Apr-2013 Wade Guthrie <wdg@chromium.org> shill: Adds UMA metric for scan time for certain scans.

Future code will perform a different type of scan (called "progressive
scan") for resume from disconnect, resume from suspend, and boot up.
This CL differentiates between those cases and the traditional, full,
scan in the code and adds a time-to-scan UMA metric for progressive
scan.

BUG=chromium:222096
TEST=unittest and manual (cycle power on the chromebook and notice on
chrome://histograms that Network.Shill.Wifi.TimeToScan got a new entry).

Change-Id: I450602c4b0a418c2b9322edeceec970c79de1330
Reviewed-on: https://gerrit.chromium.org/gerrit/47562
Commit-Queue: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
/system/connectivity/shill/manager.h
23ac6b72d44c446bca88175883ba26b39c5ed817 01-Feb-2013 mukesh agrawal <quiche@chromium.org> shill: Revert "shill: resolver: Use (even) smaller DNS timeout"

The short DNS timeout was intended to work around an issue with
some DNS servers. The belief was that the DNS failure was
transient, and that a quick retry would improve DNS lookup times.

Field results didn't show any improvement, so back out this change.

Note further that, as of M25 stable, Chrome uses its own DNS
resolver. That resolver has a fixed one second timeout for the
first try, and exponential backoff thereafter.

Consequently, if this code remained in the tree, this code would
only affect system processes.

BUG=chromium:220150
TEST=unit tests

This reverts commit bf667617d573e3af4b808ed317b1d6ca04747ee4.

Conflicts:

connection.cc
connection_unittest.cc
default_profile_unittest.cc
manager.cc
manager.h
mock_resolver.h
resolver.cc
resolver.h
resolver_unittest.cc

Change-Id: Ic96c6c014a973de441ab1771539a0d9f3d5c5967
Reviewed-on: https://gerrit.chromium.org/gerrit/46944
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
d2e1c360880fe0f23ee7dac785ca1c247544aac1 04-Mar-2013 Paul Stewart <pstew@chromium.org> shill: Manager: Create Manager::ConfigureServiceForProfile

Create a method in the manager for creating a WiFi service
within a different profile than the one the service currently
exists without affecting the current profile entry.

To accomplish this, add methods in the WiFi Provider to
return a matching service given a KeyValueStore, as well
as the ability to create a temporary service for configuration
purposes only. While here, allow ConfigureService to accept
AdHoc mode WiFi services.

BUG=chromium-os:39513
TEST=Unit tests

Change-Id: I4d0fc9b41cf6a5d7da59a87ef58ee5d491bd43a6
Reviewed-on: https://gerrit.chromium.org/gerrit/44563
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
1057cd706c91b1a5fc3a99c5a9bfa4f24a98e283 01-Mar-2013 Christopher Wiley <wiley@chromium.org> shill: Connect manager dbus calls to calls to the crypto-shim

Implement the logic in the manager which looks up the currently
connected WiFi service, and verifies it as a valid destination. It does
this by delegating to a CryptoUtilProxy which manages the interface to
the crypto-util.

BUG=chromium:221168
TEST=Unit tests pass, added a new one that tests the linkage between the
manager and the CryptoUtilProxy.

Change-Id: I3ed2608652463f04060b712adcf17e26676c3d9d
Reviewed-on: https://gerrit.chromium.org/gerrit/46447
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>
/system/connectivity/shill/manager.h
307c250b76de403ac086279fe67964c59daa4cdd 23-Mar-2013 Paul Stewart <pstew@chromium.org> shill: Manager: Add "PopAllUserProfiles"

Add a Manager method that pops all profiles that are user-associated,
leaving default profiles remaining on the stack.

BUG=chromium:223106
TEST=Unit tests.

Change-Id: Ie5dc807f9204c973bd99f1a5b16750b5b3c027d1
Reviewed-on: https://gerrit.chromium.org/gerrit/46366
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
39db5caaa3d07c3af9c575affcbb7313536de91d 18-Mar-2013 Paul Stewart <pstew@chromium.org> shill: Manager: Add method to explicitly connect to "best" services

Add a method that evaluates the best connectable services
independent of their current connectivity state, and connects
the best service for each technology type. This method will
only connect services that have their "auto-connect" property
set, and will only connect non-primary services (VPN) if the
system is already online.

BUG=chromium-os:39739
TEST=Unit test

Change-Id: I6bdd0504cccfcb7a8e66fe8fb2e33aa480b21fe0
Reviewed-on: https://gerrit.chromium.org/gerrit/45781
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
c3505a569e3f98ce56e4017300a3ce46bc714e4c 18-Mar-2013 Darin Petkov <petkov@chromium.org> shill: vpn: Conditionally build VPN support into shill.

VPN is disabled if SHILL_VPN=0 is passed to the Makefile.

BUG=chromium-os:39329
TEST=Together with I9e4d5741cbdcd99c9c109259167d87dbff04ee7a:
- FEATURES=test emerge-lumpy shill;
- After unmerging dependencies, FEATURES=test USE=-vpn emerge-lumpy shill
- Connected to OpenVPN successfully with default USE flags.
- Tested connectivity with shill with no VPN support.

Change-Id: I480a5911a4310ff9f80ca312db2a1bc3fe67bbd1
Reviewed-on: https://gerrit.chromium.org/gerrit/45740
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
0e1cdeae24dd678a5fe27c840802582c0ca45ec0 28-Feb-2013 Albert Chaulk <achaulk@chromium.org> shill: Implement Service.Remove & delete DHCP leases

Implement the Service.Remove dbus API and modify the unload sequence to
remove the DHCP lease file. Add unit tests to DHCPProvider & WiFiService to
check lease file deletion. Currently only WiFi does the DHCP lease delete
from DBus - WiMax/Cell/VPN do their own things for IP configuration and
Ethernet can't be removed as per the API spec.

Also make sure FilePath is qualified as base::FilePath throughout the project.

BUG=chromium-os:32756
TEST=added unittests to test the call path on Unload() to delete the lease file

Change-Id: Ic6eee17b9d81cd0be8d09c683d85d6a4d19278c9
Reviewed-on: https://gerrit.chromium.org/gerrit/44339
Tested-by: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
/system/connectivity/shill/manager.h
0fec81c24484638bb50c0e57cf7e572fbe4f642b 28-Feb-2013 Liam McLoughlin <lmcloughlin@chromium.org> Fix CellularCapabilityUniversalMainTest.UpdateStorageIdentifier on Clang

Also disabled CellularTest.ConnectAddsTerminationAction on Clang for now
since it crashes (bug: crosbug.com/39351)

BUG=chromium-os:28749, chromium-os:30434, chromium-os:39351
TEST=Run USE="clang asan" FEATURES="test" emerge-amd64-generic -v shill
Run USE="clang asan" FEATURES="test" emerge-x86-generic -v shill

Change-Id: I223bf423a8f6585b76d1b9dd441c9b8b21fbcb5a
Reviewed-on: https://gerrit.chromium.org/gerrit/44276
Commit-Queue: Liam McLoughlin <lmcloughlin@chromium.org>
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
/system/connectivity/shill/manager.h
0d9cf0cb47c86a1f7fff0e2b8e351bcd0478e9b6 20-Feb-2013 Christopher Wiley <wiley@chromium.org> shill: Add support for asynchronous non-void DBus methods

Previously, we only had DBus async method calls which return an error as
their indicator of success. In order to facilitate destination
verification, we're going to need to asynchronously return primitive
types.

BUG=chromium-os:39054
TEST=This is extremely difficult to test before the rest of the
credential verification stack exists. Unit tests pass though.

Change-Id: I058ef5a190c45e9116124c14d4dee5d8c30e2ece
Reviewed-on: https://gerrit.chromium.org/gerrit/43687
Commit-Queue: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Tested-by: Christopher Wiley <wiley@chromium.org>
/system/connectivity/shill/manager.h
c7b1560b03c070fad239767f868322e6b3bdd932 16-Feb-2013 Arman Uguray <armansito@chromium.org> shill: cellular: Keep track of activation per ICCID after online payment.

CellularCapabilityUniversal now internally keeps a state machine that
keeps track of the activation status of the cellular service associated
with the current SIM, once an online payment has successfully completed.

BUG=chromium-os:38851
TEST=1. Build and run unit tests.
2. - Insert an unactivated LTE SIM.
- ff_debug cellular; ff_debug --level -4.
- Go on and activate the service through the OLP portal.
- Watch /var/log/net.log. Look for a call to
CellularCapabilityUniversal::CompleteActivation.
- Check that /var/cache/shill/activating_iccid_store.profile
contains the current ICCID with an assigned value of 1.
- Wait for modem to reset. After the reset ends, the above file
should contain a value of 2 assigned to the current ICCID.
- Make sure that we eventually get cellular connectivity.
- If the MDN updates (possibly after a manual reset), make sure
that the ICCID entry has been removed from the file.

Change-Id: If4265b2c0ef1154fe4c8d164249226a31657f707
Reviewed-on: https://gerrit.chromium.org/gerrit/43589
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/manager.h
3c5040174273386868cc8dea8044d22c465885d8 18-Jan-2013 Paul Stewart <pstew@chromium.org> shill: WiFiProvider: Move Service vector to WiFiProvider

Remove the services_ vector from the WiFi Device and move it
to the WiFiProvider. Also remove the WiFi device initializer
from the WiFiService, so it doesn't have an early or permanent
binding to a particular device. This allows WiFi services to
be loaded immediately as a profile loads, so that operations
that operate on services (like Manager::ConfigureService
and Manager::FindMatchingService) do not need to use a separate
API to find and modify services that are not visible but have
stored configuration associated with them.

This also allows Chrome a somewhat more stabilized service
path to remembered services as they appear and disappear from
view. Another advantage is that this completely regularizes
the relationship between the presence of the service in the
provider's services_ list and its registration with the
manager.

In order to perform late-binding to a WiFi device, we provide
two methods for WiFi services to find a device to call
WiFi::ConnectTo on when the time comes: Firstly, visible
WiFi services (ones with endpoints) can select the device
associated with the most "promising" endpoint. In the case
where we try to connect to a hidden WiFi service before
endpoints appear for it, there is a new method for selecting
a WiFi device from the Manager. In both of these cases only
one WiFi device is selected for the connect request, so this
method is no worse than before in the unlikely case where
there are two WiFi devices, except for the fact that now
there won't be duplicate WiFi services registered in the
Manager.

CQ-DEPEND=Ic8af4999b25503c3b002504edd12405dc91cc824
BUG=chromium-os:38017
TEST=Unit tests; manual operation; manager unit tests, WiFiManager
autotests (profile tests failing due to crosbug.com/35374)

Change-Id: I904df8a983ba6e7e76e20159622c652675eb6a7d
Reviewed-on: https://gerrit.chromium.org/gerrit/41664
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
4cbff5b5897593f7a2e6de48a98abe72356075af 29-Jan-2013 Darin Petkov <petkov@chromium.org> shill: vpn: Auto-connect at most one service at a time, only when online.

This patch suppresses auto-connect for non-primary technologies (such
as VPN) while the system is offline. Also, don't auto-connect a VPN
service if there's already an active (connecting or connected) VPN
service.

Cleanup Manager's online/offline API a bit.

BUG=chromium-os:38229
TEST=unit tests

Change-Id: Iedd3879cf45c8b509a956415c7de5e5ba1af4652
Reviewed-on: https://gerrit.chromium.org/gerrit/42226
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
85aea151c69ff40967becfa8751d821feebf3bb9 22-Jan-2013 Paul Stewart <pstew@chromium.org> shill: WiFiService: Fix-up old-style WiFi Service entries

Add a utility to upgrade WiFi service entries that don't contain
the "Type", "Mode" or "Security" properties, and only contain
this information in the fields of the storage identifier. Use
this utility whenever the WiFi device loads a new profile.
Follow-on CLs will clean up all remaining direct callers of
WiFiServce::ParseStorageIdentifier().

BUG=chromium-os:38048
TEST=Unit Tests, inspect chrome://histograms for new histogram
entries when profiles are updated.

Change-Id: I0f1d4e75abc1edfe6da1bbfe68183cab1b1c0021
Reviewed-on: https://gerrit.chromium.org/gerrit/41802
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
7a20aa492230e9e969c8853ad684be0c5b224479 17-Jan-2013 Paul Stewart <pstew@chromium.org> shill: Manager: Implement FindMatchingService

Find an in-memory Service given a dictionary of attributes. The
Manager will return the first Service that matches these attributes.
While here, fix an old bug where Service::Configure enumerated the
input uint32 arguments with the intention of configuring the
"Priority" property, except that "Priority" is an int32.

BUG=chromium-os:34525
TEST=Unit tests, manual using python script to call GetMatchingService
with a known service name

Change-Id: Ib093b257c4217796ae5aa13bf090c1234df70c7d
Reviewed-on: https://gerrit.chromium.org/gerrit/41554
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
5086b9744e8330e7f3bd8ab91fe20b53dda28a1c 16-Jan-2013 Ben Chan <benchan@chromium.org> shill: Add Manager.UninitializedTechnologies property.

This CL adds an UninitializedTechnologies property to the Manager
interface to include the technologies of uninitialized devices that have
been detected by shill but may not have finished initialization and
created a Device object. This allows the CrOS network UI to show the
the technologies of uninitialized devices as 'initializing'.

BUG=chromium-os:37877
TEST=Tested the following:
1. Build and run unit tests.
2. Verify that CrOS network UI shows the cellular technology as
initializing shortly after the modem is detected but before it
is fully initialized.

Change-Id: Ibf5d8eebb734207c015636cad0ca0cd9e62c7ea9
Reviewed-on: https://gerrit.chromium.org/gerrit/41350
Commit-Queue: Ben Chan <benchan@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/manager.h
0818cca76b252080dc78f10e6c4c7c4580a226fc 14-Dec-2012 Daniel Erat <derat@chromium.org> shill: Use new power manager suspend delay methods.

This updates shill to use protocol-buffer-based calls to
register its suspend delay with powerd.

BUG=chromium-os:36980
TEST=unit tests pass.
watched /var/log/power_manager/powerd.LATEST on device
with active cellular modem:
- suspend delay with 4500 ms timeout is registered
- shill notifies powerd about readiness before
suspending
- suspend delay is unregistered and then re-added after
resuming
CQ-DEPEND=Ibf13a1c338f214cb534d7c79191846c82d90cc0b

Change-Id: I7b6e7b713ea426eafed85447b8d6a774201033a5
Reviewed-on: https://gerrit.chromium.org/gerrit/39850
Commit-Queue: Daniel Erat <derat@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
/system/connectivity/shill/manager.h
cb0b56639ef45e172b16b9de897fe4a813cf7001 13-Dec-2012 Darin Petkov <petkov@chromium.org> shill: diags: Ignore disconnect events in transitional power states.

BUG=chromium-os:37141
TEST=unit tests; tested on device with suspend and shutdown

Change-Id: I62bed5180c54c92166323755892611c01a65fd8e
Reviewed-on: https://gerrit.chromium.org/gerrit/39645
Tested-by: Darin Petkov <petkov@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
32c7640137e576d98b44e4af8ea87fc7fd54b718 27-Nov-2012 Arman Uguray <armansito@chromium.org> shill: LinkEvent shouldn't call DestroyService

In Cellular::LinkEvent, if shill sees that the network interface has
gone down, it now calls DropConnection instead of calling DestroyService.
In addition, shill no longer takes down the network interface in
Cellular::DisconnectCleanup.

BUG=chromium-os:36573
TEST=unit tests and network_3GModemControl

Change-Id: Id64a3cc0245cfb75cfbd68529473683a7313af22
Reviewed-on: https://gerrit.chromium.org/gerrit/38756
Commit-Ready: Arman Uguray <armansito@chromium.org>
Reviewed-by: Arman Uguray <armansito@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
/system/connectivity/shill/manager.h
87a4ae88915e3dc22dbb1327002e1daf769ef23e 27-Oct-2012 Paul Stewart <pstew@chromium.org> shill: WiFi: Reload hidden services after restart

Hidden services in WiFi are loaded in two situations:

(1) When the WiFi Device is registered, WiFi::Load() is called
each profile.

(2) When a profile is pushed, WiFi::Load() is called with the
new profile.

When WiFi::Stop() is called, all services are removed, so some
mechanism needs to be used to reload these hidden services when
WiFi::Start() is called.

BUG=chromium-os:35703
TEST=Unit tests + manual: Disable / Re-Enable WiFi and make sure
remembered hidden networks are still visible.

Change-Id: Ie6b9351db940860cb20c39e0575c3d5dd8c921d0
Reviewed-on: https://gerrit.chromium.org/gerrit/36736
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
b790aa2e5b6422cbba4a20be81ba1c0445701405 23-Oct-2012 Gaurav Shah <gauravsh@google.com> shill: Hook up manager dbus method to return the list of geolocation networks

BUG=chromium-os:34844
TEST=dbus-send --system --print-reply --fixed --dest=org.chromium.flimflam / \
org.chromium.flimflam.Manager.GetNetworksForGeolocation

Change-Id: I5d4b932004677a54621494af87f94c50c38a858d
Reviewed-on: https://gerrit.chromium.org/gerrit/36524
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Gaurav Shah <gauravsh@chromium.org>
/system/connectivity/shill/manager.h
ab22c166ccfb33fd99169bee645d67306ae26ced 09-Oct-2012 Arman Uguray <armansito@chromium.org> shill: Add metrics for recording termination/suspend time

Added the following metrics:

- Network.Shill.TerminationActionResult.OnSuspend,
- Network.Shill.TerminationActionResult.OnTerminate,

which log success/failure;

- Network.Shill.TerminationActionTime.OnSuspend,
- Network.Shill.TerminationActionTime.OnTerminate,

which measure the time it takes to complete the termination actions.

BUG=chromium-os:35029
TEST=Manually suspended machine and terminated shill on separate
occasions and observed the output on chrome://histograms

Change-Id: I5183d7c3dd5d4633f661598b7a0cacab6d205d8b
Reviewed-on: https://gerrit.chromium.org/gerrit/34975
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Ready: Arman Uguray <armansito@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
/system/connectivity/shill/manager.h
3ec553401f04d005cfce24411cd63929557dea75 28-Sep-2012 Darin Petkov <petkov@chromium.org> shill: cellular: Disconnect service on suspend.

Also, suppress auto-connect as soon as the SuspendDelay signal is
received. Schedule a timeout to detect failed or interrupted suspend
and re-enable auto-connect.

BUG=chromium-os:30587,chromium-os:33412
TEST=unit tests, tested on device through inspecting logs

Change-Id: If40f8217e4d9b222a698532054287ae9b4fcb4d6
Reviewed-on: https://gerrit.chromium.org/gerrit/34342
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
4d5efb7d5d130e3e6e52ab732127a273bcb95261 17-Sep-2012 Paul Stewart <pstew@chromium.org> shill: Ignore certan DNS search paths

Add a manager property to provide a list of DNS Search paths
that should be ignored when applying DHCP parameters. This
covers a list of DNS search suffixes that are popularly
provided, but are generally unlikely to provide any useful
results, therefore significantly reducing DNS lookup performance.

BUG=chromium-os:34495
TEST=Unit-tests + Manual: Add a domain to the default search list and make sure it is filtered from the "search" line in resolv.conf.
CQ-DEPENDS: I54bdd33a05bb704d8c3ff05f71e034fe42635e89

Change-Id: Id92b39f1ad0ae64b3ff50c7671cdf388d92a07af
Reviewed-on: https://gerrit.chromium.org/gerrit/33460
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
2f9df4eebeb6363e38834ff1e13fac5836c8eb5d 08-Aug-2012 mukesh agrawal <quiche@chromium.org> shill: move WiFi to use new OnAfterResume callback.

Now that Manager pokes every Device on suspend and resume, there's not
much point to having devices register for callbacks from PowerManager.

BUG=None
TEST=unit tests

Change-Id: I0459e907eb0b8f3582079e90c173328fc03fa170
Reviewed-on: https://gerrit.chromium.org/gerrit/29767
Commit-Ready: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
49739c08a76187fae6494c61e960eec315960715 09-Aug-2012 Paul Stewart <pstew@chromium.org> shill: Manager: Create "DefaultService" property

This property contains the object path of the default service.
The Manager will emit a PropertyChanged signal when this value
changes from its previous value.

CQ-DEPENDS=I5b85c6ae3960ecfe9067f05c3527f27109edd8c3
BUG=chromium-os:33395
TEST=Modified unit tests + manual (since the mock Emit* functions
are hard to get to): Use dbus-monitor to display property change
messages. Read manager DBus properties to make sure DefaultService
is "/" at startup and when not connected.

Change-Id: I7f980dcd1a311af58dd396bf76326711f414e27c
Reviewed-on: https://gerrit.chromium.org/gerrit/29693
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
bf667617d573e3af4b808ed317b1d6ca04747ee4 29-Jun-2012 Paul Stewart <pstew@chromium.org> shill: resolver: Use (even) smaller DNS timeout

Use the new glibc facility for sub-second timeouts, and choose
300 milliseconds for the timeout. However, only do this by
default for Ethernet and WiFi networks, since VPN networks
in particular have trouble with this configuration (due to many
name servers and search domains, as well as the additional
latency inherent to such networks). Also, increase the number
of attempts, so we still spend a reasonable amount of time
overall waiting for a DNS response.

Provide a means to change which technologies are setup in this
manner.

BUG=chromium-os:29124
TEST=Manual: Install connection manager, verify via strace that
gethostbyname now waits 300 ms, and retries 15 times per trial (*).
Ensure Chromium continues to work correctly under light loads.
Also, connect via Verizon and VPN and ensure DNS parameters
are back to the long timeout.
List manager properties and ensure it says "ethernet,wifi" for
ShortDNSTimeoutTechnologies and that this is saved out to the
profile.
New unit tests.
CQ-DEPENDS=Ib9ffc59bbfcd5bf3f57d146965c5a43a936348f8

*: Each trial consists of a nameserver / IP address pair, so
for example, if we have IPv6 connectivity and have two "server"
entries in resolv.conf, we first do 30 tries of IPv6 requests,
alternating between the two servers, then another 30 alternating
IPv4 requests between them. This was tested by intentionally
making the DNS server unreachable and instrumenting the gethostbyname
request via strace.

Change-Id: Idd331b4a9fcf96d457ab9959537aefcb86328e12
Reviewed-on: https://gerrit.chromium.org/gerrit/26493
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
ca62154261be3d481c1e54d5fcf7012e8918b4e2 25-Jul-2012 Darin Petkov <petkov@chromium.org> shill: Suppress auto-connect on suspend and force it on resume.

This avoids extra churn on suspend and prevents shill from trying to
auto-connect a cellular service that's being automatically
disconnected by Cromo right before suspend.

This seems like a good feature to have and should do for now although
it just makes the race less likely to happen. Ideally:

- Cromo should deregister the RPC Modem object as soon as it sees the
state transitioning to suspend. But Cromo is going away...

- ModemManager-next should handle delayed suspend (or shill should do
that instead).

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

Change-Id: I2a7bcf201bb7f7ca785e86a8d3abb7d28f767c74
Reviewed-on: https://gerrit.chromium.org/gerrit/28390
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
212d60f4de8a17702dc824f4a56d7de884e18e27 12-Jul-2012 Paul Stewart <pstew@chromium.org> shill: Manager: Take over responsibility for device save

Move the responsibility of saving devices from the default
profile to the Manager. This removes an awkward setup where
the DefaultProfile asks for and iterates the Manager's device
list. Instead, call UpdateDevice on each device on
Manager::Stop().

This has a positive side effect that newly created default
profiles (such as those created during autotests) do not
end up with device entries for all devices, but only the
ones persisted while the profile is in use.

This also allows the Manager to take charge of persisting
device state to disk while deregistering, so that the most
recent snapshot of the device is saved before it is removed
from memory.

BUG=chromium-os:31584
TEST=Expanded unit tests.

Change-Id: Id2eb916b0b33d038847248a88312fb6899b3f717
Reviewed-on: https://gerrit.chromium.org/gerrit/27299
Reviewed-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
a5e07ef0402aad0635a5e7a0932740b9dfbf46d1 09-Jul-2012 Darin Petkov <petkov@chromium.org> shill: openvpn: Hold connect/reconnect until a new service is online.

Use OpenVPN's management hold API to prevent the client from
connecting/reconnecting until an underlying connection becomes
available. The hold is released only when a new default service is
connected. This ensures, for example, that the openvpn client will not
use stale network configuration on reconnect. Also, add API to Manager
to register and deregister callbacks to monitor for default service
changes.

BUG=chromium-os:31572
TEST=unit tests, tested on device with inactivity restart/reconnect

Change-Id: I6d6d63a03ee92aaa18b7a2cca9462a8ea1e5a931
Reviewed-on: https://gerrit.chromium.org/gerrit/26920
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
b501ad2324d110cfd3622c9326ca59f5d73a3635 03-Jul-2012 Darin Petkov <petkov@chromium.org> shill: wimax: Monitor for WiMaxManager's presence on DBus.

Reset WiMaxProvider's state by destroying all WiMax devices when WiMaxManager
disappears. Connect to WiMaxManager only if its present. This makes shill more
resilient against wimax_manager crashes.

BUG=chrome-os-partner:10948
TEST=unit tests

Change-Id: I0a79d44fd19d6decc0b3964a144e6358711cd8b6
Reviewed-on: https://gerrit.chromium.org/gerrit/26665
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Ready: Ben Chan <benchan@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
2b8e44e4559ef85394e868963d9084b4e4148824 25-Jun-2012 Darin Petkov <petkov@chromium.org> shill: wifi: Monitor the presence of WPA supplicant.

Connect to WPA supplicant only if it's present and suspend the device when WPA
supplicant disappears. This ensures that the WiFi device/service state remains
consistent across crashes of WPA supplicant, for example.

Also, drop the device connection when stopping the WiFi device. This avoids a
DCHECK for connections not being present in Manager::DeregisterService.

Remove a device restart on scan failure -- this should be covered now by the
explicit wpa_supplicant monitor.

BUG=chromium-os:31712,chromium-os:25657
TEST=tested on device, kill -SEGV wpa_supplicant; unit tests

Change-Id: I11efb1d841d4c7abd40da725b1d074170baee726
Reviewed-on: https://gerrit.chromium.org/gerrit/26017
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
dfa46057cfb0a3af99d326694e2537f1189dcc06 26-Jun-2012 Paul Stewart <pstew@chromium.org> shill: Manager: Run SortServices in a delayed task

Running SortServices while an outer loop might be traversing the
Service list can cause very strange effects. Defer SortServices
to the event loop instead. This also allows multiple batched
property changes to occur while only performing SortServices
once. This replaces a previous change which placed the AutocConnect
in a task, since AutoConnect is only called from SortServices.

BUG=chromium-os:32123, chromium-os:32117
TEST=Changed unit tests

Change-Id: I47b3f861bc4cb75e6d5b09d3b38f5cc7f5e47f63
Reviewed-on: https://gerrit.chromium.org/gerrit/26131
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
002c58e9809822b0b309a7f9c1d3bbb4fd42e7cf 19-Jun-2012 Darin Petkov <petkov@chromium.org> shill: Implement a DBusManager class to listen for name/owner notifications.

An instance of DBusManager is instantiated in Manager. It will be used to detect
DBus services appearing and disappearing and syncing properly.

BUG=chromium-os:31712
TEST=unit tests, tested on device with extra logging and pkill wpa_supplicant

Change-Id: I701d2efff405769bc14f5589331c54647b41beab
Reviewed-on: https://gerrit.chromium.org/gerrit/26014
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
cb3eb8970ee676be0e5738d62685f9e0a2d7cb73 07-Jun-2012 Paul Stewart <pstew@chromium.org> shill: Manager: Fix up a few RpcIdentifiers

There were a few remaining properties of the Manager that were
returning String arrays instead of RpcIdentifier paths.

BUG=None
TEST=Unit tests + list_services + list_devices + list_profiles

Change-Id: I9a5545d7e313e94f3897e43b3871f1868313b136
Reviewed-on: https://gerrit.chromium.org/gerrit/24778
Reviewed-by: Elly Jones <ellyjones@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
7f5ad57031c51938d29206e60a7d26df719887a8 05-Jun-2012 Paul Stewart <pstew@chromium.org> shill: manager: Treat GetService for VPN services as a ConfigureService

This way, when GetService is called, the service is associated
with a profile and can be "forgotten".

BUG=chromium-os:31481
TEST=Unit tests

Change-Id: I9c8691d251526080b00e9bb8ff8d0991f9d81bfd
Reviewed-on: https://gerrit.chromium.org/gerrit/24427
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
a9fb325a645e0be17b3eaa26a4d0f1d5228683c9 31-May-2012 Gary Morain <gmorain@chromium.org> shill: Add cellular hooks for suspend and termination

When ChromeOS suspends or shill terminates, a cellular device should
disconnect from the cellular service. This CL adds methods to do that
and connects them to the manager's hook table. The manager runs these
actions when there is a terminate signal. The shill Daemon has been
modified to signal the manager on a terminate signal. TODO: Run these
actions on a suspend signal.

This CL modifies the HookTable API to remove the polling action.
Instead, actions are expected to call HookTable::ActionComplete()
to signal the completion of an action.

BUG=chromium-os:22408
TEST=new unittests; ran all existing unittests. Manual testing
includes executing 'stop shill' and looking at log messages to make
sure the termination actions occurred.

Change-Id: I5bbf0832e76a5c818724fbca4c436beb3e5d182b
Reviewed-on: https://gerrit.chromium.org/gerrit/24261
Reviewed-by: Jason Glasgow <jglasgow@chromium.org>
Tested-by: Gary Morain <gmorain@chromium.org>
Commit-Ready: Gary Morain <gmorain@chromium.org>
/system/connectivity/shill/manager.h
e369ecef65c622f0f6aaf3012e4ae392a378ee1c 22-May-2012 Paul Stewart <pstew@chromium.org> shill: WiFi: Scan frequently immediately after disconnect

At startup, and after disconnect, temporarily decrease
the scan interval in order to ensure that we've exhaustively
found all the networks we are looking for. Scanning in
WiFi is not an exact science, and it's not possible to
guarantee that with one scan we have found all possible
networks. Since we can scan relatively infrequently
while idle (to conserve power), be a more aggressive just
as we disconnect to give us the best chance to get back
online.

BUG=chromium-os:30984
TEST=New test network_WiFiRoaming/011RetryReconnectHidden
https://gerrit.chromium.org/gerrit/23231

Change-Id: If8fc83008aa5d99abe6af157b5bf47d3c8466632
Reviewed-on: https://gerrit.chromium.org/gerrit/23307
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
b72b62ec23d13c8e84a1499a04231b79d4bd74bb 15-May-2012 Darin Petkov <petkov@chromium.org> shill: wimax: Start a WiMaxProvider class.

The class is a peer of DeviceInfo/ModemInfo/VPNProvider in the
Manager. It communicates with the WiMaxManager RPC service. It will
instantiate WiMax device objects that will communicate with
WiMaxManager.Device RPC objects.

BUG=chrome-os-partner:9700
TEST=unit tests

Change-Id: I003f0ff3e67ee527137fb11f56a6e57d9c2589bf
Reviewed-on: https://gerrit.chromium.org/gerrit/22700
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
df7c553368620f718ec14bc6751f232185792870 14-May-2012 Jason Glasgow <jglasgow@chromium.org> shill: manager: send a reply to Enable/Disable Technology even if no devices

Send a reply to Enable/Disable Technology even if no devices need to
be disabled or enabled.

BUG=none
TEST=shill on vm. run test-flimflam enable cellular. command does not timeout.

Change-Id: I3892b80cc0281fcc6aa530630897af44098430bd
Reviewed-on: https://gerrit.chromium.org/gerrit/22598
Commit-Ready: Jason Glasgow <jglasgow@chromium.org>
Reviewed-by: Jason Glasgow <jglasgow@chromium.org>
Tested-by: Jason Glasgow <jglasgow@chromium.org>
/system/connectivity/shill/manager.h
d408fdf69489e3199c63796a06f7cfbbb4513515 08-May-2012 Paul Stewart <pstew@chromium.org> shill: Add ArpGateway and network-based leases

Add two arguments to the DHCP client:
- Turn on ArpGateway (ARP for default gateway in order to test validity
of lease) by default, and use the same manager flag as flimflam did.

- Use per-network lease files for Ethernet and WiFi. This means that
multiple leases can be held in parallel for different Ethernet devices
and WiFi SSIDs.

Bonus changes: Fix DHCP lease filename template which was broken in flimflam
and ported with full fidelity to shill. Make removal of old lease files
conditional on whether the lease file was non-default.

BUG=chromium-os:25717,chromium-os:16885
TEST=New unit tests + manual: Ensure dhcpcd runs with correct arguments ("-R"
added when ArpGateway is enabled on the manager, no "-R" otherwise), and that
the "set_arpgw" command in crosh works correctly. Monitor dhcpcd command line
for new lease suffix parameter, and ensure that leases are being written out
to those files, and that the files are not being removed on program exit.
CQ-DEPEND=Iac282c1686695239a790bbcc0d110c6a69bf45e0

Change-Id: I68bb3cbd18c95f01003eaf049fa60aad446f8116
Reviewed-on: https://gerrit.chromium.org/gerrit/22065
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
d93615e9687b3473ede06a8503b6d23aacd0c603 27-Apr-2012 Gary Morain <gmorain@chromium.org> shill: Save ephemeral profile when GSM cellular network connects

Normally, a service is saved when an IP address is
assigned to a network. However, in the case of GSM, when the
network connects (but before an IP address is assigned), the
APN needs to be saved. This was causing crashes because the
save function was being performed on the ephemeral profile,
which does not have a backing store. This change saves the
service to the current profile (which has a backing store).

BUG=chromium-os:29981
TEST=manual. Log in. Ensure there is no cellular network in
~chronos/shill/shill.profile. Attempt to connect to the
a GSM (T-Mobile) network. Verify that shill does not crash
and that the cellular network has an entry in
~chronos/shill/shill.profile.

Change-Id: Ib14c80cc08598841629a3a1a3e96739b30297aa6
Reviewed-on: https://gerrit.chromium.org/gerrit/21350
Commit-Ready: Gary Morain <gmorain@chromium.org>
Reviewed-by: Gary Morain <gmorain@chromium.org>
Tested-by: Gary Morain <gmorain@chromium.org>
/system/connectivity/shill/manager.h
10ccbb3c6bc4f4246105743c8508fc9ce8759c17 27-Apr-2012 Paul Stewart <pstew@chromium.org> shill: wifi: Scan for non-ephemeral hidden networks

Before, shill used the "favorite()" property to tell whether it
should scan for a hidden SSID. Instead, use a more direct approach
of asking whether the service is part of a non-ephemeral profile.
This allows services configured via Manager::ConfigureService()
for which the "favorite" flag has not been set to be scanned for
and listed for the user to select.

BUG=chromium-os:26676
TEST=New unit tests, manual -- configure a hidden network via
configure-hidden-wifi, then propose a scan via "test-flimflam scan",
while running "iw event" to confirm whether the new SSID appears in
the scan list

Change-Id: I75364c83c94482c0c3d654e2076a4bed06a7fca2
Reviewed-on: https://gerrit.chromium.org/gerrit/21288
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
10e9e4e93537a0673524d47535cbf0f723470a0d 27-Apr-2012 Paul Stewart <pstew@chromium.org> shill: Accept --portal-list command line option

This option is used from the init scripts to override the startup
value of the portal list. This is not meant to override the profile
value, but simply to mask that value until the user has completed
OOBE.

BUG=chromium-os:28424
TEST=New unit tests, plus manual:
- Reboot -- test that system starts up with machine default
(get-portal-list => ethernet,wifi,cellular)
- rm /home/chronos/.oobe_completed
- Restart shill and test that get-portal-list => ""
- Run "set-portal-list wifi,ethernet,cellular", and ensure we can read
this back.
- Reboot (on test machines, this repopulates .oobe_completed on boot)
ensure that we return to the profile-stored value.

Change-Id: I8c6427d89087d6e8a611e407b93e4082300ddf03
Reviewed-on: https://gerrit.chromium.org/gerrit/21295
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Brian Harring <ferringb@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
38fd24c2e1f5fefe5817b5a4b9aabd95852742f9 25-Apr-2012 Paul Stewart <pstew@chromium.org> shill: ManagerDBus: Implement GetState()

BUG=chromium-os:30006
TEST=Manual:
dbus-send --system --dest=org.chromium.flimflam --print-reply / \
org.chromium.flimflam.Manager.GetState

Change-Id: I094d44ed2b7a03eb50c4162977041e18fd4b7d35
Reviewed-on: https://gerrit.chromium.org/gerrit/21120
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
f7ef50a6054414c446f891fa87401e6f0a00097f 16-Apr-2012 Darin Petkov <petkov@chromium.org> shill: vpn: Implement l2tp/ipsec external process option initialization.

BUG=chromium-os:26843
TEST=unit tests

Change-Id: Ie635ff143d8934e68f8193d3d5b727f1abd4d987
Reviewed-on: https://gerrit.chromium.org/gerrit/20321
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
028545d00919bac838b8c8f691b799db6bb93de5 07-Apr-2012 Gary Morain <gmorain@chromium.org> shill: Implement Manager::CalculateState

If at least one service is connected, Manager::CalculateState
returns "online"; otherwise, if returns "offline".

BUG=chromium-os:23338
TEST=Added new unit tests Manager.CalculateStateOffline and
Manager.CalculateStateOnline. All other unit tests pass.

Change-Id: I5b45df7c08cb30ea0954d7bd97941bc5221ed717
Reviewed-on: https://gerrit.chromium.org/gerrit/19804
Commit-Ready: Gary Morain <gmorain@chromium.org>
Reviewed-by: Gary Morain <gmorain@chromium.org>
Tested-by: Gary Morain <gmorain@chromium.org>
/system/connectivity/shill/manager.h
e73d05ca690cc847f512072f4709c92cbd7b0651 30-Mar-2012 Paul Stewart <pstew@chromium.org> shill: Implement RemoveProfile

Also clean up the comment for Profile::set_storage()

BUG=chromium-os:24461
TEST=New unit tests; autotests to come

Change-Id: If092d09c7cc1b3312bdbece8ee00a128cc3e427b
Reviewed-on: https://gerrit.chromium.org/gerrit/19334
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
8839a899af928671d87b12073bebc5f1b2752a30 29-Mar-2012 Eric Shienbrood <ers@chromium.org> shill: Emit Manager.Devices property changed signal.

When a device is register or deregistered with the shill Manager
class, it needs to send out the new list of known devices, which
is kept in the Manager.Devices property. Otherwise, the UI doesn't
know about the device, and doesn't display any device information
in the network details panel. For GSM modems, it also means that
the UI doesn't know the system has a GSM modem, so it doesn't
show the SIM unlock dialog nor the APN selection dropdown.

BUG=chromium-os:28603
TEST=Before-and-after manual testing. With the change, all the
expected device details are displayed.

Change-Id: Ie74913edf3c524e8d1adfb9d564df3ca4c32946d
Reviewed-on: https://gerrit.chromium.org/gerrit/19296
Commit-Ready: Eric Shienbrood <ers@chromium.org>
Reviewed-by: Eric Shienbrood <ers@chromium.org>
Tested-by: Eric Shienbrood <ers@chromium.org>
/system/connectivity/shill/manager.h
65512e10f0534c390b2ef027cc64f660658db6c0 27-Mar-2012 Paul Stewart <pstew@chromium.org> shill: vpn: Destroy Unload()ed VPN services

BUG=chromium-os:28481
TEST=New unit test.

Change-Id: I222441d3ff5cbc7d97d97f7fdd2917eee5921721
Reviewed-on: https://gerrit.chromium.org/gerrit/19143
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
7f61e52dced33bd4cd5af1c7989ee6e59bf8f892 22-Mar-2012 Paul Stewart <pstew@chromium.org> shill: Implement Manager::ConfigureService

As part of this change, add the "Profile" property to the list
of ignored properties for Service::Configure(), since we deal with
it separately in Manager::ConfigureService(). Also, fully deprecate
ConfigureWifiService; since Chrome doesn't use this function, there's
no purpose in supporting it.

BUG=chromium-os:22800
TEST=New unit tests.

Change-Id: Ie58e47d175784688b09e5d85f863ab97a8c8bb44
Reviewed-on: https://gerrit.chromium.org/gerrit/18897
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
13ed225b4a4567e8e2411435d1266c8b86236c54 21-Mar-2012 Paul Stewart <pstew@chromium.org> shill: manager: Search for services by GUID

Add a function to search by GUID, and use this function if GetService
is passed a GUID parameter.

BUG=chromium-os:22800
TEST=New unit test

Change-Id: I24799ef3c5b014670e089ff70c4116b481e58371
Reviewed-on: https://gerrit.chromium.org/gerrit/18689
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
2366eede28daa298f240ddbc3c8f36cc0e7b7ad1 21-Mar-2012 mukesh agrawal <quiche@chromium.org> shill: serialize Manager.Services as an array of object paths

Previously, we serialized this property as an array of strings.
That was contrary to the API documentation, and caused a crash
in update_engine_client.

BUG=chromium-os:27987
TEST=unit tests, manual

Manual testing: ran on device, and checked that update_engine_client
was able to identify the technology of the default service.

Collateral change: replace PathArray with Paths (and similar
for variations, such as path_array). This makes the naming of
Paths conform to the style used for Strings, Stringmaps, etc.

Change-Id: I4ee4b9df04d3f006ab974c2092f6e515ebf5a9b8
Reviewed-on: https://gerrit.chromium.org/gerrit/18592
Commit-Ready: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
e2bad7c1edd7dbe837619e5350bd70814e6913be 14-Mar-2012 Paul Stewart <pstew@chromium.org> shill: Add Manager::GetDefaultService

Also fix SortServices to fix reporting of "DefaultService" to metrics.

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

Change-Id: Ic456e51de366ac4181bcd32d49d6e4055622c1cc
Reviewed-on: https://gerrit.chromium.org/gerrit/18133
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
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/manager.h
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/manager.h
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/manager.h
36a3acea410a5731b392d0f735e022472e5c55e3 06-Mar-2012 Darin Petkov <petkov@chromium.org> shill: vpn: Spawn the OpenVPN process when tunnel index becomes available.

BUG=chromium-os:27373
TEST=unit tests

Change-Id: Ie946e4275beff4d5ac176413cc219dbe52356b28
Reviewed-on: https://gerrit.chromium.org/gerrit/17407
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
ca6abd4635507fa5b8f4b8819a37819fb560c464 02-Mar-2012 Paul Stewart <pstew@chromium.org> shill: vpn: Claim interface from DeviceInfo

Maintain a list in the VPNProvider of all services created by it.
When DeviceInfo alerts it of a new tunnel interface, VPNProvider
will find a service->driver() to accept this interface. If not
found, delete the interface (cleaning up after crash). Also,
in OpenVPNDriver, create a tunnel device and hold enough state
to be able to claim it later.

BUG=chromium-os:26841,chromium-os:27156,chromium-os:27158
TEST=New unit tests. Manual: Ensure tunnel devices get cleaned up on a
real system.

Change-Id: Iaaa44dc26830a2e8bf5dfea00d165ab8c034e6e9
Reviewed-on: https://gerrit.chromium.org/gerrit/17191
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
33af05c849e0888b15222da38b55515784b821c7 28-Feb-2012 Darin Petkov <petkov@chromium.org> shill: Basic VPN service framework.

The manager uses a VPNProvider (similar to DeviceInfo and ModemInfo) to manage
VPN services. For each VPN service the VPNProvider instantiates an appropriate
VPNDriver (e.g., OpenVPNDriver) based on the service arguments and associates it
with the generic VPN service.

BUG=chromium-os:26835,chromium-os:26836,chromium-os:26838,chromium-os:26839
TEST=unit tests

Change-Id: Ia1bdbe49ecbb6d5b50a732dcef4a15e1feaa4f69
Reviewed-on: https://gerrit.chromium.org/gerrit/16956
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
ac1bdb47b498a82460c995742ac5892f9a4d7e57 17-Feb-2012 Gary Morain <gmorain@chromium.org> shill: Initiate scan on resume, if appropriate

When a power resume event occurs, start a scan if the WiFi device is idle.

BUG=chromium-os:24885
TEST=Added new unit tests to WiFiMainTest. Ran all shill unit tests.
autotest WiFiRoaming.009ConnectOnResume should pass but currently doesn't
because shill crashes on suspend-resume.

Change-Id: I2730b0f27c0d85e72c0add57a3e9a5a2c995a04f
Reviewed-on: https://gerrit.chromium.org/gerrit/16107
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Gary Morain <gmorain@chromium.org>
Tested-by: Gary Morain <gmorain@chromium.org>
/system/connectivity/shill/manager.h
b65c24574109b331150f376f117e10948acc7123 23-Feb-2012 Darin Petkov <petkov@chromium.org> shill: Refactor Manager's Get*Service to support both VPN and WiFi types.

BUG=chromium-os:22063
TEST=unit tests

Change-Id: I1f9ae822af8a22a59dda0c159a5f3471dcda2a89
Reviewed-on: https://gerrit.chromium.org/gerrit/16479
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
a20cbc2864edf5491cfa1fa240ba83c30b8a483c 09-Jan-2012 Thieu Le <thieule@chromium.org> shill: Add metrics Network.Shill.TimeToDrop and Network.Shill.*.TimeOnline

Also changed some existing constant names for consistency purposes.

BUG=chromium-os:24810
TEST=Unit tests, network_WiFiManager (7/9)

Change-Id: I49db32dc0a4b6b80a5114b910b9be6e45a30d7f0
Reviewed-on: https://gerrit.chromium.org/gerrit/13883
Commit-Ready: Thieu Le <thieule@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
/system/connectivity/shill/manager.h
0756db95c9d39d6e6aa9a754e54b441eff46ff34 27-Jan-2012 Paul Stewart <pstew@chromium.org> shill: Implement GetEntry on Profile

Implement "GetEntry" on profile_dbus_adaptor. This change adds
the ability to look up a Service in the Manager by its
StorageIdentifier and then to return its properties to the caller.
If the Service does not exist in the manager, we have to read
directly out of the Profile's store and build a DBus property dict
out of its contents. This is a pretty gross method, and I've already
created a bug to remove this as soon as we can diverge from the
flimflam Profile API. crosbug.com/25813

BUG=chromium-os:25542
TEST=New unit tests + Manual: chrome://settings/internet now lists
both visible and unavailable networks under "Remembered Networks"
and clikcing on "Forget Network" purges the network from the profile.

Change-Id: Ib2f0ab772e40a1f615206a7b985be446fc7facde
Reviewed-on: https://gerrit.chromium.org/gerrit/15200
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
7522551440b9a287bccf2d95a42357d04ab79814 27-Jan-2012 Paul Stewart <pstew@chromium.org> shill: Implement DeleteEntry Profile method

Implement the DeleteEntry DBus method call, which removes
a Profile entry as well as detaching any connected services
from the profile data. As a bonus change, modify Manager to
consolidate finding a Profile that is suitable for a Service
which does not have one.

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

Change-Id: I6a954a41ab2d1b49f6432858e2263a63b5af21f1
Reviewed-on: https://gerrit.chromium.org/gerrit/14944
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
1b2531423a15ccc5ac5acaf09edac9a687902dfa 26-Jan-2012 Paul Stewart <pstew@chromium.org> shill: Implement more of Profile DBus interface

Return a DBus path from Manager.GetActiveProfile().
Implement the "Profiles" property on the manager Manager.
Fix the "Entries" property on the Profile to only report group
identifiers that correspond to technologies (not ipconfig,
devices, etc).
Fix the "Services" Profile property, to only appear as a property
of the active profile.

BUG=chromium-os:25538, chromium-os:23702
TEST=Manual: Running "list-profiles" from the flimflam test suite now
works correctly.

Change-Id: I3120fe54f02662822186ac033fab0b3566449705
Reviewed-on: https://gerrit.chromium.org/gerrit/14904
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
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/manager.h
41c0e0accae6602dbc9fc31f336dabee7af1b170 09-Jan-2012 Darin Petkov <petkov@chromium.org> shill: Delay cellular device creation if DeviceInfo is not available yet.

DeviceInfo notifies ModemInfo/ModemManager/Modem whenever a new cellular device
link is added so that cellular devices can be constructed and registered. This
fixes the current behavior where the device is not created at all if its device
info is not available yet.

BUG=chromium-os:24855
TEST=tested on device

Change-Id: I929bd70a6692a9ec6c66f51e01e44fca4433eb87
Reviewed-on: https://gerrit.chromium.org/gerrit/13866
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Eric Shienbrood <ers@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
1b1a7f222bc8a2b6c9f15fd7a41aad7977ff275e 07-Jan-2012 Paul Stewart <pstew@chromium.org> shill: Implement get/set of Profile property for Service

Create getter and setter. To set the "Profile" property on a
service we have to ask the manager to take care of finding the
profile by name, and then moving the service to the new profile.

BUG=chromium-os:22803
TEST=New unit test, manual (via list-services on a live system)

Change-Id: Idfb3f9f68764b926ddf06c0cc0285292aa85864d
Reviewed-on: https://gerrit.chromium.org/gerrit/13847
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
8a3188dbc04245c17a4729d16a632547ce4bf585 01-Dec-2011 mukesh agrawal <quiche@chromium.org> shill: improve conformance with WiFiRoaming tests

This patch makes several changes to get shill passing more of
the WiFiRoaming suite. shill now passes 13 of the 18 tests.

Overview of changes:
- Clean up Services when their last Endpoint disappers.
- Make a new WiFi connection request pre-empt an existing one.
- Make Device::SelectService no-op if new service is same as old.
(part of resolving crosbug.com/23703)
- Move auto-connect logic to its own function, and run that function
in a deferred task (partly resolves crosbug.com/24276)
- Add a non-deferred variant of Service::Connect (part of resolving
crosbug.com/24276).
- Have service sort order reflect whether or not services are
connecting, failed, connectable, and configured for auto-connect.

BUG=chromium-os:24276,chromium-os:23223,chromium-os:22943,chromium-os:23703
TEST=WiFiRoaming, unit tests, manual

Manual testing: per https://gerrit.chromium.org/gerrit/12963

Collateral changes:
- updated TESTING
- added crosbug.com/24461 for problem with autotest and profiles
- declared some functions as const
- removed some useless comments

Change-Id: I36d6eb7108a377dbf409d3e5673deffb85c0633e
Reviewed-on: https://gerrit.chromium.org/gerrit/12687
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
19c871da666a307fdf4e5bced0d745abefe9a04a 16-Dec-2011 Paul Stewart <pstew@chromium.org> shill: Hook up Create/Pop/PushProfile to dbus

Have the manager profile methods written so far link up
with the RPC Manager Adaptor code.

BUG=chromium-os:24326
TEST=Unit tests for regression. Also used flimflam's Python
create-profile/push-profile as well as logging out/in on a
shill instance running with --use-flimflam-profiles

Change-Id: I69f3a94e6cb3acda5ae37ec005b2345566e5e700
Reviewed-on: https://gerrit.chromium.org/gerrit/13070
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
4eb4d782b83850552af41f675d22250601b9fb8d 05-Dec-2011 mukesh agrawal <quiche@chromium.org> shill: when we find an Endpoint for a WiFiService that hasn't been
registered with the Manager, register that service.

BUG=chromium-os:23713
TEST=unit tests, manual

Manual testing: ran network_WiFiSecMat.031CheckHidden_WPA, and
verified that the hidden service is registered with the manager.
(The autotest still fails, but for different reasons than before.)

Collateral change: don't create services with empty SSIDs.
They're not useful for anything, and would probably confuse
users.

Change-Id: Ie9aa8743d55de4dcd913fb089fc06a533cc065ef
Reviewed-on: https://gerrit.chromium.org/gerrit/12472
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
713547627a2d6dc731cc1a7c80d2df79bee68a5e 29-Nov-2011 Gaurav Shah <gauravsh@chromium.org> shill: Add option to push profiles on shill startup

When re-started after a user has logged in (say, due to a crash), we need a
way to tell shill to load the logged in user's profile. Normally, you would
do this by having the respawning entity (upstart, usually) to re-send a dbus-
message to load a profile.

Due to the machinations of how process tracking works, it's sometimes better
to do the startup and profile load in a single step. Hence, this new option
similar to flimflam.

BUG=chromium-os:23492
TEST=none

Change-Id: I2f66ebd726fa678468b4ad01a57c21ebf42784aa
Reviewed-on: https://gerrit.chromium.org/gerrit/12179
Tested-by: Gaurav Shah <gauravsh@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Gaurav Shah <gauravsh@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
00917ceafbc28599391bfcdd5837faf6d63fec32 23-Nov-2011 mukesh agrawal <quiche@chromium.org> shill: set favorite property when a Service is connected, and
set autoconnect property when a Service is made a favorite

BUG=chromium-os:23346,chromium-os:23349
TEST=new unittests

Bonus changes:
- remove some unused variables in ManagerTest.SortServices
- add "static" comment for Service::DecideBetween and
Service::Compare

Change-Id: I4b7e01f98d1292b9c8f951c9a54a01f76292b740
Reviewed-on: https://gerrit.chromium.org/gerrit/12053
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
a41e38d57e4fa37bd2c8de6447890b4e1951acb7 11-Nov-2011 Paul Stewart <pstew@chromium.org> shill: wifi: Load hidden services from storage

When a device or profile comes into existence, the device
will search the profile for hidden services and instantiate
services if they do not exist. These services will not
be visible in the RPC service list until they either appear
in scan or are actively being connected.

Side effects:
* Manager now loads the devices with profile data.
* Manager now respects the "powered" attribute loaded by
devices from the profile to determine whether or not
to call Start() on them.
* Key files can be searched for groups with a certain
key. This will be useful when we start supporting GUIDs.
* On service registration go backward (from top of stack
downward) through the list of profiles searching for
configuration instead of forwards.
* Move the update of the "Services" property of the manager
to a more centralized spot in SortServices. This way,
when the service order changes (or anything else that
affects the service list) this RPC property will update.
* Hidden services are not scanned for if they are in the
ephemeral profile -- it means that whatever profile was
supporting them does not exist anymore.
* WiFi services have the unenviable task of also decoding
storage identifiers in order to glean the address, mode
and security parameters.

BUG=chromium-os:22073,chromium-os:22074
TEST=New unit tests, Manual on real hardware.
Note: I could not connect to a hidden network, but this
is because we're not setting the ApScan parameter on
wpa_supplicant so on connect it is just doing broadcast
scans. However if I seed the profile with with a record
containing a hidden SSID, shill will force a scan for
the hidden network, which will allow it to connect.

Change-Id: I97a5b5f6db7c6e6d2aabf212c5c2984ce7f4daaa
Reviewed-on: https://gerrit.chromium.org/gerrit/11558
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
1b7a616197af7ff753dbe7614a8e207b1e10ac1a 09-Nov-2011 Gaurav Shah <gauravsh@chromium.org> shill: Implement write-only properties

Certain properties (e.g. WIFI Passphrase) are write only and must
not be returned when Service.GetProperties() is called over D-Bus.

This CL implements WriteOnlyProperties, a write-only analog of the
read-only ConstProperties.

Also add a ReadablePropertyConstIterator which only returns the
readable properties. Switch over DBus adaptor and PropertyStore
to use that.

BUG=chromium-os:21196
TEST=Added 2 new unittests.

Change-Id: I52815cc395650e0b49e1acac8d4954deeebcee5d
Reviewed-on: https://gerrit.chromium.org/gerrit/11402
Commit-Ready: Gaurav Shah <gauravsh@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
Tested-by: Gaurav Shah <gauravsh@chromium.org>
/system/connectivity/shill/manager.h
a849a3d95bb67e457149fbc34c49d03bdcdc7370 03-Nov-2011 Paul Stewart <pstew@chromium.org> shill: Nuke AdoptProfile

Remove this method from Manager, and turn it into a manager_unittest
method function.

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

Change-Id: Ia3dc3f6b1cde71e52198a01f04d2a423058d9f72
Reviewed-on: https://gerrit.chromium.org/gerrit/11123
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
5dc40aad05908dc435e623e56392780ef6d1079e 29-Oct-2011 Paul Stewart <pstew@chromium.org> shill: Implement CreateProfile, PushProfile, PopProfile

Collateral fixes: Profiles now create a header at the beginning
of the file, and this feature is plumbed down through key_file_store
and glib. InitStorage can be configured to fail if the profile
already exists/doesn't yet exist.

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

Change-Id: Ie7c2d0dee97891b7850cec75b74052fce77eee8f
Reviewed-on: https://gerrit.chromium.org/gerrit/10884
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
6515aabcd1fbbb9ff2090c9675c17eeef64e7474 13-Oct-2011 Chris Masone <cmasone@chromium.org> [shill] Make profiles backed with StoreInterfaces

Rely on persistence of data in StoreInterface to maintain
Service/Device/IPConfig info for entities that are not
currently active, instead of maintaining lists in Profile
objects themselves.

BUG=chromium-os:17253
TEST=unit, run on device

Change-Id: I206f44ddf16c584354f8fcadb57032f047f33d0a
Reviewed-on: http://gerrit.chromium.org/gerrit/10024
Commit-Ready: Chris Masone <cmasone@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
b9c00597eb1f6d2560f7e88cb0d1f627228840d4 06-Oct-2011 Chris Masone <cmasone@chromium.org> [shill] Profiles need to own their own storage

We're moving to a model where we rely on the StoreInterface
implementation to maintain profile state, instead of managing
a list of Service objects manually. Thus, we need to allow
Profile to own its own StoreInterface.

BUG=chromium-os:17253
TEST=unit

Change-Id: Ie62462686ecf598efeac08a2d3180cd372430bb9
Reviewed-on: http://gerrit.chromium.org/gerrit/9916
Commit-Ready: Chris Masone <cmasone@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
ffa3d0433d419aa9251f3768a0090a27b6b1c434 07-Oct-2011 mukesh agrawal <quiche@chromium.org> shill: allow property accessors to return an error message if a
property's value cannot be changed.

also, reduce some code duplication in property_store.cc

BUG=chromium-os:21384
TEST=unittests

Change-Id: Iaac8d40bbb9e9a1341d6c6d01642885d88ac0e27
Reviewed-on: http://gerrit.chromium.org/gerrit/8925
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
22aa71b334c716f20999c2e08e5b797207b0afae 16-Sep-2011 Paul Stewart <pstew@chromium.org> shill: Implement service sorting

Sort the list of Services for presentation to
RPC callers, essentially copying the current flimflam
sorting criteria. Introduce the TechnologyOrder to
the Manager.

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

Change-Id: I766b2297ba3170a7a6ab5adfe68425a8011be4fb
Reviewed-on: http://gerrit.chromium.org/gerrit/8205
Tested-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
7a4e4008dc09effe39c94a5f9575644a79ee1388 06-Sep-2011 mukesh agrawal <quiche@chromium.org> shill: implement Manager.GetService (error-case only)

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

this gives us enough to pass the autotest for
network_WiFiManager/000_SSID_Length_Limit.

Change-Id: Ib0305e707d2203327d846be3e0b206033d6a884a
Reviewed-on: http://gerrit.chromium.org/gerrit/7567
Commit-Ready: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
877ff9894e21c4c78b63777025f6c8d577ccd855 22-Sep-2011 Chris Masone <cmasone@chromium.org> [shill] Enable default profile to persist device info

Make Profile::Save() take a pointer to a vector of DeviceRefPtrs. The base
implementation ignores this pointer, but the DefaultProfile implementation
persists all the devices to disk.

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

Change-Id: I5d72bd2319edfb9ae57366cbd5c766b558ffc8a4
Reviewed-on: http://gerrit.chromium.org/gerrit/8057
Commit-Ready: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
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/manager.h
3239932e4a0a92fec52d88860081cbbb003eabb0 01-Sep-2011 mukesh agrawal <quiche@chromium.org> shill: implement manager.RequestScan (for WiFi only)

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

note that 000_SSID_Length_Limit does not pass yet,
because we don't do IP configuration yet. but it
does get scan results.

Change-Id: I8993b3c646eda705271d1f7ad7d7341c692ae06b
Reviewed-on: http://gerrit.chromium.org/gerrit/7407
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
5029c6ceeeef212187d35b23e586f6af28332dc4 25-Aug-2011 mukesh agrawal <quiche@chromium.org> shill: stop devices when deregistering them

update Manager::DeregisterDevice, to call Stop before forgetting
about a device. this is needed in particular for WiFi. without
the call to Stop, cyclic references prevent the WiFi object from
being deleted when Manager forgets it.

BUG=chromium-os:16419
TEST=WiFiManager+new unittest

note that shill doesn't actually pass any of the WiFiManager
tests yet. but this patch eliminates one of the situations in
which it might crash.

Change-Id: I067b80745a05e060430a6d403c47b5c6fa186b51
Reviewed-on: http://gerrit.chromium.org/gerrit/6673
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
2ae797d040b7261a5619c750e07037566bcb542b 24-Aug-2011 Chris Masone <cmasone@chromium.org> Re-land "[shill] Provide a cmd line toggle between flimflam and shill storage dirs"

This is so that we can easily switch to (and away from) using
the flimflam profile dir (and user profile dirs) when we start shill.

BUG=chromium-os:17253
TEST=unit

Change-Id: I0264162665607bb180688428c4640e42383ae355
Reviewed-on: http://gerrit.chromium.org/gerrit/6568
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/manager.h
7156c923c9a9d2240ea9c62045337ac8c8f89e57 24-Aug-2011 Chris Masone <cmasone@chromium.org> Revert "[shill] Provide a cmd line toggle between flimflam and shill storage dirs"

This reverts commit 54c93e972563b713030a15ce3c1c1824800e317f

Change-Id: Id4bf4ee1e7e62efea5d116507d8b49d76a7a9556
Reviewed-on: http://gerrit.chromium.org/gerrit/6567
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/manager.h
6402e501258c9f64373dcd05271c6c7dd75e20bc 23-Aug-2011 Chris Masone <cmasone@chromium.org> [shill] Provide a cmd line toggle between flimflam and shill storage dirs

This is so that we can easily switch to (and away from) using
the flimflam profile dir (and user profile dirs) when we start shill.

BUG=chromium-os:17253
TEST=unit

Change-Id: I9352cf5c40a8f77bcda8cdc0b5912782b4e342ed
Reviewed-on: http://gerrit.chromium.org/gerrit/6454
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
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/manager.h
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/manager.h
e613202d36e3bfb06a40eea1888694413210ef7e 16-Aug-2011 Paul Stewart <pstew@chromium.org> shill: Add connection to device

Also in the process, do a few bits like setting up a run path in
the manager so it can initialize the resolver output path.

BUG=chromium-os:19095
TEST=Ran unit tests (for regression), tested that DNS and routes applied
for Ethernet on real system.

Change-Id: If505200643efa6c3152f6e61db3b91a04e739c18
Reviewed-on: http://gerrit.chromium.org/gerrit/6087
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
6f9eaa30b850ee4a22e71fd1b6ab13c873ec7110 10-Aug-2011 Darin Petkov <petkov@chromium.org> shill: Add Cellular devices to DeviceInfo.

This allows DeviceInfo to handle link messages for Cellular devices, so that we
can bring their interfaces up and down.

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

Change-Id: I7d642c7302472472c56042f731f746c8b997a149
Reviewed-on: http://gerrit.chromium.org/gerrit/5604
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
8f317b600a218afe05f2d73c59204bb98269a950 15-Jul-2011 mukesh agrawal <quiche@chromium.org> shill: add ability to blacklist devices

BUG=chromium-os:16787
TEST=ebuild + manual

manual testing: set up mac80211_hwsim and hostapd on a device.
run shill, observe that it core dumps. run shill again, with
"--black-list=mon.wlan1", observe that it does not core dump.

Change-Id: Id43ed8badc2d8ac414c8a2ceb7487ecb85dc851c
Reviewed-on: http://gerrit.chromium.org/gerrit/4414
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
/system/connectivity/shill/manager.h
6791a43add38926966bd420e89541717fb2cb2b5 12-Jul-2011 Chris Masone <cmasone@chromium.org> [shill] Enable Profile objects to manage a list of Services to persist.

The Manager will hang on to a list of active services. They will be sorted,
someday, in an order that makes sense. Every service will be associated with
a Profile, though it may the an ephemeral profile that won't persist state to
disk. Profiles will maintain a map of service name to service references to
track the services whose state they persist to disk. Services may move between
Profiles, and will certainly need to be bound to one after they are registered
with the Manager, so support for this is provided as well.

BUG=chromium-os:17436
TEST=unit tests

Change-Id: Id43a0e1d97302b6f574bd2213d4f3d176bb5223f
Reviewed-on: http://gerrit.chromium.org/gerrit/4033
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/manager.h
887f2983bc84acc15139df257e43217fec1f6cdb 15-Jul-2011 Darin Petkov <petkov@chromium.org> shill: Add a ModemInfo object that's a peer of DeviceInfo.

ModemInfo is responsible for managing ModemManager instances. Each ModemManager
instance watches for and handles an individual ModemManager DBus service. Each
ModemManager will be responsible for creating cellular devices associated with
that ModemManager.

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

Change-Id: Ie9946cba4465aea8671305e32596fc9f6cca96e2
Reviewed-on: http://gerrit.chromium.org/gerrit/4124
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
7aa5f90848b530999d8b6788ecb40aa30871c7ae 11-Jul-2011 Chris Masone <cmasone@chromium.org> [shill] Back property storage in Service objects with Entry objects

Much of Shill Service state is persisted to disk, by creating an Entry
in a Profile. We should store this info just once, so that we don't
have to worry about keeping multiple data stores in sync. This is a
first step in that direction.

BUG=chromium-os:17436
TEST=unit tests

Change-Id: If94db2a38a7d79c56e2c746b2f069cfd7ab4bf65
Reviewed-on: http://gerrit.chromium.org/gerrit/3876
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
88cbd5f509862f746abbfe99df0605dcc0de40b0 03-Jul-2011 Chris Masone <cmasone@chromium.org> [shill] Add properties to Profiles.

There are several properties of the Manager that are reflected only in
the default Profile. We create a subclass for this special type of
profile and hand it a const ref to the properties of the Manager class
so it can provide read-only access to these values via RPC.

BUG=chromium-os:17261
TEST=unit tests
STATUS=Verified

Change-Id: I6fa9f2549a0e1af1b9523206bad8ee17e133f399
Reviewed-on: http://gerrit.chromium.org/gerrit/3620
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
3c3f6a1dcc0533545f7efb5ffed5a3edc089f240 01-Jul-2011 Chris Masone <cmasone@chromium.org> [shill] Add a few more derived properties of the Manager class

Add properties like Devices, Services -- properties that return object
paths and must be calculated on the fly.

BUG=chromium-os:16343
TEST=unit tests

Change-Id: I4d7e478c2cc574a7006600a1bbcfe9b867d9cb34
Reviewed-on: http://gerrit.chromium.org/gerrit/3555
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
2b10554b6c736f3421102d483b74b70bb82f997c 22-Jun-2011 Chris Masone <cmasone@chromium.org> [shill] Use ref-counted pointers more, break unneeded header deps

1) Replace more bare pointers with ref-counted pointers.
2) Move declarations of *RefPtr into a header file with fwd-declared classes
3) Make class headers include that, move inclusion of real headers to .cc files.

BUG=None
TEST=unit tests

Change-Id: I8208c82377c6dbefe6903561a503b8db63f063d6
Reviewed-on: http://gerrit.chromium.org/gerrit/3177
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/manager.h
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/manager.h
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/manager.h
8fe2c7eea92541b5282929361a19ad519e0608a9 10-Jun-2011 Chris Masone <cmasone@chromium.org> [shill] Begin wiring SetProperty

Create a PropertyStoreInterface that can be implemented by Device,
Service, Manager, etc to handle getting/setting of properties. The
various DBusAdaptor subclasses can dispatch incoming calls to their
associated implementation object based on the names of the properties
and/or the types of the arguments.

BUG=chromium-os:16343
TEST=unit tests

Change-Id: If7abb0ffa623e59288943b4ed1f49832a92524ea
Reviewed-on: http://gerrit.chromium.org/gerrit/2408
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/manager.h
e0dea765d1f41c43aa6fcd094dff84393451843c 09-Jun-2011 Chris Masone <cmasone@chromium.org> [shill] FindService should return a ServiceRefPtr, and should always return something

We weren't explicitly returning a value from FindService on failure,
which was causing a unit test to pass erroneously. Once I fixed it,
the test started failing because of a dumb thing I was doing in
MockService. So, fix that so that the tests can pass as they should.

BUG=None
TEST=unit tests

Change-Id: Ice304e514ea0e3add779ac061b0945b5712dea29
Reviewed-on: http://gerrit.chromium.org/gerrit/2374
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
c1e50412f45518e23d51ba8bb8694c366943d945 07-Jun-2011 Chris Masone <cmasone@chromium.org> [shill] Start replacing bare pointers with scoped_refptrs where appropriate

BUG=chromium-os:16259
TEST=unit tests

Change-Id: I5e1531b726bbb40917d25dc3ae44da9a6a420e00
Reviewed-on: http://gerrit.chromium.org/gerrit/2236
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
/system/connectivity/shill/manager.h
d0ceb8c66779819ab12b8abb488aed22b7d04fd3 02-Jun-2011 Chris Masone <cmasone@chromium.org> [shill] Add signal emitting to adaptor interfaces

BUG=chromium-os:16063
TEST=unit tests

Change-Id: Ib94cd3c27af5fb64202da42594f98b864b0e158b
Reviewed-on: http://gerrit.chromium.org/gerrit/2009
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/manager.h
9be4a9d1e87d64f850f15061123b2a4334477fa2 17-May-2011 Chris Masone <cmasone@chromium.org> [shill] the beginnings of the data model

Flesh out Manager a little, to add vectors of Device* and Service* and ways to look through them.

BUG=chromium-os:15347
TEST=unit tests

Change-Id: Iae5280f56bf58cf1580f0b87c465f4905459f07a
Reviewed-on: http://gerrit.chromium.org/gerrit/966
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/manager.h
487b8bfc46a91e29bb23aaf3c59cfe67033bfc8b 14-May-2011 Chris Masone <cmasone@chromium.org> [shill] Roll forward to new libchrome

Basically just a bunch of header renames.

BUG=chromium-os:14304
TEST=emerge with FEATURES=test

Change-Id: I426d66048731ac17719ab7b1ede318f7a15f294b
Reviewed-on: http://gerrit.chromium.org/gerrit/883
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/manager.h
d5843775e98ca18d1e1a6aae26aca951d7c5dc28 12-May-2011 Paul Stewart <pstew@chromium.org> shill: Remove the "resource" superclass

The "resource" superclass was meant at some point to be some
sort of crude mockup of a possible refcounting scheme. Drop
this idea, and use base/ref_counted for Devices which will
likely need multiple entities referencing it.

BUG=chromium-os:12933
TEST=Rebuild

Change-Id: Id267049e881037422271f1611dcc8a5e90e9abac
Reviewed-on: http://gerrit.chromium.org/gerrit/723
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
0af98bf87e8fc3cf29293f62d7f3b73cd9adb571 11-May-2011 Paul Stewart <pstew@chromium.org> shill: First step for rtnl code -- device discovery

Add device_info object and add it to the manager. Once started,
this will perform rtnl enumeration. Current tests just assert
that each enumeration completes successfully, but since our code
does not yet store any information based on what it sees, this
cannot be tested yet.

BUG=chromium-os:12933
TEST=New unit tests added

Change-Id: Ie1958222d9831c6117d0ace127857340a11b0bb1
Reviewed-on: http://gerrit.chromium.org/gerrit/655
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
/system/connectivity/shill/manager.h
413a3191a9a177c90e60fa24d5e86eac739549cf 10-May-2011 Chris Masone <cmasone@chromium.org> [shill] Add wpa_supplicant API spec to shill. Also, change 'proxy' -> 'adaptor'

Add the XML description of the wpa_supplicant DBus API, so we can
generate client (proxy object) bindings for it. to use these
bindings, #include "shill/supplicant_cli.h" and then inherit from the
appropriate class in the fi::w1::wpa_supplicant1 namespace.

For example, for the WPA supplicant "Network" interface:

class SupplicantNetworkProxy : public fi::w1::wpa_supplicant1::Network_proxy {
public:
SupplicantNetworkProxy() {}
virtual ~SupplicantNetworkProxy() {}

// All signal handlers are abstract in the base class; implement them all here
virtual void PropertiesChanged(
const std::map< std::string, ::DBus::Variant >& properties) {
return;
}

// Methods are all implemented for you, as are accessors for properties.
};

BUG=chromium-os:15092
TEST=build

Change-Id: I55e42148bc64965317e7223c852707ed6359b0bc
Reviewed-on: http://gerrit.chromium.org/gerrit/572
Reviewed-by: Chris Masone <cmasone@chromium.org>
Tested-by: Chris Masone <cmasone@chromium.org>
/system/connectivity/shill/manager.h
75897df1154ac38b7a4512a687241ad6a197ee40 27-Apr-2011 Paul Stewart <pstew@chromium.org> Add initial sketch to shill repository

BUG=chromium-os:12066
TEST=command-line

Change-Id: If1d01bf78fca80de4cc8a26e096e1967293d9738

Review URL: http://codereview.chromium.org//6575006
/system/connectivity/shill/manager.h
05697993041f71fef9fc8f541619ec595a6a388f 23-Feb-2011 Paul Stewart <pstew@chromium.org> Reset to empty dir

Change-Id: I3ffe83089f84e5fec7b6d3e15b5236d2277f49f2
/system/connectivity/shill/manager.h
aa101a783bb53314fc3e466f0701eec0074386f1 23-Feb-2011 Paul Stewart <pstew@chromium.org> Shill, the connection manager

First checkin into new repository.

TEST=Run from command line
BUG=chromium-os:12065
/system/connectivity/shill/manager.h