chromiumos/platform/shill.git
12 months agoshill: WiFiProvider: Unit-test OnEndpointUpdated 72/66672/3 master
Paul Stewart [Thu, 22 Aug 2013 17:08:15 +0000 (10:08 -0700)]
shill: WiFiProvider: Unit-test OnEndpointUpdated

Add unit tests for WiFiProvider::OnEndpointUpdated.

BUG=chromium:277309
TEST=Run unit tests

Change-Id: Ieee83fab5604966f5d35ecb042a32d4c6b7f5dc2
Reviewed-on: https://gerrit.chromium.org/gerrit/66672
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
12 months agoshill: cellular: Fix ModemManager DBus error constants. 01/66701/2
Ben Chan [Thu, 22 Aug 2013 21:18:14 +0000 (14:18 -0700)]
shill: cellular: Fix ModemManager DBus error constants.

ModemManager DBus errors are prefixed
"org.freedesktop.ModemManager1.Error.*" instead of
"org.freedesktop.ModemManager1.*". This CL fixes that by using the
MM_*_ERROR_DBUS_PREFIX macros to obtain the prefixes.

BUG=chromium:277822
TEST=Build and run unit tests.

Change-Id: Ie7ead1de42cc5a36c70b9cc8aefd46823aa0934f
Reviewed-on: https://gerrit.chromium.org/gerrit/66701
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Arman Uguray <armansito@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>

12 months agoshill: WiFiProvider: Don't update endpoints on shutdown 18/66618/3
Paul Stewart [Thu, 22 Aug 2013 04:03:12 +0000 (21:03 -0700)]
shill: WiFiProvider: Don't update endpoints on shutdown

While the shill is shutting down, shill shuts down the WiFiProvider,
but may leave Devices running.  https://gerrit.chromium.org/gerrit/43979
protected OnEndpointRemoved and OnEndpointAdded but neglected to
protect OnEndpointUpdated.  Do that here.

BUG=chromium:277227
TEST=Unit tests

Change-Id: Ibc5e0d8921900d43c7578cdb0bcbab3ae35583a2
Reviewed-on: https://gerrit.chromium.org/gerrit/66618
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
12 months agoshill: WiFi: Track background scans in scan_state_ state 16/66416/2
Paul Stewart [Tue, 20 Aug 2013 20:20:54 +0000 (13:20 -0700)]
shill: WiFi: Track background scans in scan_state_ state

We should consider a full scan started while non-idle to be
a background scan.  Further, we should then return the scan
state back to "idle" when such scan completes.  Otherwise
our scan state will never return to Idle at the end of a
background scan.

BUG=chromium:276351
TEST=Unit test + Manual:
Connect to an AP, and open up the network dropdown.  The
"Searching for Wi-Fi Networks.." message should appear briefly,
and then disappear after a few seconds.

Change-Id: I37fc187773a13f9e2b63c63c6d6166aa800f54ab
Reviewed-on: https://gerrit.chromium.org/gerrit/66416
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
12 months agoshill: cellular: Sid belonging to an unknown carrier should be visible. 48/66148/3
Arman Uguray [Sat, 17 Aug 2013 00:54:59 +0000 (17:54 -0700)]
shill: cellular: Sid belonging to an unknown carrier should be visible.

CellularCapabilityUniversalCDMA will know expose the SID of an unknown
carrier as part of the Cellular.ServingOperator property. If there is no
match for the SID in the database, the "name" and "country" fields of
|serving_operator_| will be cleared.

BUG=chromium:274835
TEST=Build and run unit tests.

Change-Id: If485b8e53bbd6b84b14fecbf10d3765c909686ee
Reviewed-on: https://gerrit.chromium.org/gerrit/66148
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: Arman Uguray <armansito@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
12 months agoshill: wimax: Log device status as readable string instead of value. 46/66146/2
Ben Chan [Sat, 17 Aug 2013 00:01:11 +0000 (17:01 -0700)]
shill: wimax: Log device status as readable string instead of value.

BUG=None
TEST=Verify that WiMAX device status is logged as readable string in /var/log/net.log.

Change-Id: Ie17960774c1126468ecc1f4859576bb0be8fb113
Reviewed-on: https://gerrit.chromium.org/gerrit/66146
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
12 months agoshill: don't update FrequenciesConnectedEver until we complete L2 13/66113/3
mukesh agrawal [Fri, 16 Aug 2013 18:53:10 +0000 (11:53 -0700)]
shill: don't update FrequenciesConnectedEver until we complete L2

shill has been reporting Network.Shill.WiFi.FrequenciesConnectedEver when
supplicant reports a change in BSS. However, a change in BSS may only
indicate the start of a connection attempt, not its success.

It's probably more relevant to record the number of frequencies where
we successfully connect. So change to reporting the data after the
layer-2 is established.

We could go further and wait until DHCP is complete, or even further,
and wait until we get online. But let's keep this a layer-2 statistic
for now.

While there: make some EXPECTations in wifi_provider_unittest a little
more specific.

BUG=chromium:274595
TEST=unit tests

Change-Id: I67547db507498c130a2a26822b679306ad3ede4f
Reviewed-on: https://gerrit.chromium.org/gerrit/66113
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>

12 months agoshill: remove Network.Shill.CellularDropsPerHour metric 23/66123/4
mukesh agrawal [Fri, 16 Aug 2013 20:26:44 +0000 (13:26 -0700)]
shill: remove Network.Shill.CellularDropsPerHour metric

This metric can't be too important, because nobody noticed it was
missing from histograms.xml (and hence, not viewable in the metrics
dashboard).

Also, a per-hour metric can be misleading, because it doesn't account
for what fraction of the hour the device was actually trying to use
Cellular.

This commit sort-of reverts 6c1e3bbc, but it leaves some of the
hooks of that commit in place. In particular, metrics still takes
an EventDispatcher pointer in its ctor, so that it can report
periodic statistics. While there aren't presently any other periodic
statistics, it's easier to leave these hooks in place than to rip
them out.

BUG=chromium:274640
TEST=unit tests

Change-Id: I7ad88e2e2dd54935f4d8f743203802612eed52df
Reviewed-on: https://gerrit.chromium.org/gerrit/66123
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
12 months agoshill: cellular: remove unnecessary calls to SetUp 30/66030/2
mukesh agrawal [Fri, 16 Aug 2013 01:13:59 +0000 (18:13 -0700)]
shill: cellular: remove unnecessary calls to SetUp

SetUp is called automatically by the test framework, so there
is no need to call it from individual test cases. Given that,
remove the unnecessary explicit calls.

BUG=None
TEST=unit tests

Change-Id: I1558791309a8b8f461fff2bc2fef5cedee919aff
Reviewed-on: https://gerrit.chromium.org/gerrit/66030
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>

12 months agoshill: dongles: UpdateBearerPath when modem enters Connected state 32/66032/4
mukesh agrawal [Fri, 16 Aug 2013 01:31:42 +0000 (18:31 -0700)]
shill: dongles: UpdateBearerPath when modem enters Connected state

In order to fire up PPP for a dongle, shill needs to know that the
ModemManager Bearer requires PPP. To know that, shill needs to
call ListBearers on the appropriate mm1::ModemProxy.

In the normal case, where shill connects the Cellular modem, this
happens through CellularCapabilityUniversal::OnModemStateChangedSignal.

However, in the case where the Cellular modem is already connected
at the time shill starts (as happens if shill crashes after connecting
the modem), OnModemStateChangedSignal will not be reached. That's
because, from ModemManager's perspective, the modem stays in the
Connected state the whole time.

To resolve this, add a call to UpdateBearerPath in
CellularCapabilityUniversal::OnModemStateChanged (note that this method
is different from CellularCapabilityUniversal::OnModemStateChangedSignal.)
Since this method is invoked at the time shill learns of the modem,
we're now guaranteed that UpdateBearerPath will be called. And that
call will eventually lead to the capability calling StartPPP, if
appropriate.

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

Manual test
-----------
1. plug in ppp dongle
2. wait for network to connect
3. killall -9 shill
4. wait for network to connect
   (should happen in ~10 seconds)

Change-Id: I2ea1581dd33a9969332968ea7c160e669359b4f0
Reviewed-on: https://gerrit.chromium.org/gerrit/66032
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
12 months agoshill: provide ability to configure children to terminate with parent 31/66031/3
mukesh agrawal [Fri, 16 Aug 2013 02:23:13 +0000 (19:23 -0700)]
shill: provide ability to configure children to terminate with parent

If shill crashes and restarts, it will re-initialize its state about
its peer daemons (e.g. wpasupplicant, ModemManager). Child processes,
however, do not always provide a way to query their current state.

For dhcpcd, we deal with this problem by having the child process
(dhcpcd) monitor D-Bus events to determine when shill exits. When
that occurs, dhcpcd terminates itself. In this way, a newly spawned
shill process doesn't have to worry about an old dhcpcd conflicting
with one fired off by the (new) shill process.

Since pppd doesn't have integrated D-Bus support, doing the same
for pppd could be hairy. Instead, use prctl() to ask the kernel
to deliver SIGTERM to pppd when shill exits.

BUG=chromium:261710
TEST=manual

Manual test
-----------
- plug in ppp dongle
- wait for network to connect
- killall -9 shill
- egrep 'pppd.+Terminating on signal 15' /var/log/net.log

Change-Id: I7513ccfa8de0b154d233d8a4d6f1bc701af32974
Reviewed-on: https://gerrit.chromium.org/gerrit/66031
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
12 months agoshill: WiFi: Track signal strength of connected AP 13/65713/5
Paul Stewart [Mon, 12 Aug 2013 21:50:14 +0000 (14:50 -0700)]
shill: WiFi: Track signal strength of connected AP

While connected to an AP, perform periodic captures of the
"station" information element in the kernel for our connection
to the current endpoint.  When we receive a response, update
the endpoint with the signal strength in the station information.
This will in turn update the service's "Strength" property.

BUG=chromium:271492
TEST=Unit tests; Manual: Walk around while connected and ensure
bars move up and down to compensate.  ff_debug +wifi; ff_debug --level -2
shows messages about endpoint signal strength changing.

Change-Id: I246baafb01cc6ae94bb08b2b950eaa09f11b8cc2
Reviewed-on: https://gerrit.chromium.org/gerrit/65713
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
12 months agoshill: Fix misleading error log in Device::SetEnabled. 17/65617/3
Arman Uguray [Mon, 12 Aug 2013 21:18:03 +0000 (14:18 -0700)]
shill: Fix misleading error log in Device::SetEnabled.

There is a conditional error line in Device::SetEnabled that shouldn't
send an error log if an enable is in progress. The code checks for
Error::kOperationInitiated but not for Error::kInProgress, while the
code path usually prefers the latter.

BUG=chromium:271505
TEST=shill shouldn't log "Enable failed, but no way to report the
failure.", if an enable operation is already in progress.

Change-Id: I9b75097e052438b4dd0e96f44bb5c867dfd3e9d0
Reviewed-on: https://gerrit.chromium.org/gerrit/65617
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
Commit-Queue: Arman Uguray <armansito@chromium.org>

12 months agoshill: fix Network.Shill.Wifi.TimeToJoin metric 39/65739/2
mukesh agrawal [Tue, 13 Aug 2013 20:39:01 +0000 (13:39 -0700)]
shill: fix Network.Shill.Wifi.TimeToJoin metric

The Network.Shill.Wifi.TimeToJoin metric was not being collected, due
to subtleties of how it was supposed to be hooked in to Metrics. So
fix it.

More specifically, What's supposed to happen is this:

Metrics::RegisterService
-> WiFiService::InitializeCustomMetrics  // overrides base class impl
   -> Metrics::AddServiceStateTransitionTimer(...)

The problem was that Metrics::RegisterService is called from
Service::Service. Thus, at the time that Metrics::RegisterService is called,
we only have a Service object, not a WiFiService object. Consequently, the
virtual method call from Manager::RegisterService resolves to the base class
implementation of InitializeCustomMetrics, which has an empty body.

To fix this, we make InitializeCustomMetrics a non-virtual method (it
only had a meaningful implementation in WiFiService, anyway), and call
it explicitly from the WiFiService ctor, rather than implicitly via
Metrics::RegisterService.

While there:
- Remove RegisterService calls in MetricsTests. These are both
  unnecessary, and actively harmful. The harm comes from the fact
  that the explicit call to RegisterService in the unit tests overrides
  the effect of the RegisterService in the Service.

  In the case of WiFiService, this meant calling the derived-class
  implementation of InitializeCustomMetrics. That meant the test passed,
  but only because it did not reflect actual program behavior.
- Log a WARNING if a Service is re-registered with Metrics (without an
  intervening call to DeregisterService).
- Remove unused |service| field of ServiceMetrics.
- Add parenthesis to ctor invocation in Metrics::RegisterService. I
  believe the fields are non-POD, and initialized either way (with or
  without parentheses). But it seems clearer to use the parentheses,
  since we want the fields initialized.
- Fix whitespace issue in WiFiService::InitializeCustomMetrics.
- Tweak log message in service.cc.

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

Manual testing
--------------
1. boot system
2. connect to wifi
3. open chrome://histograms
4. find that Network.Shill.Wifi.TimeToJoin exists, and has at least one sample

Change-Id: Icd925148415ea30fb63709bf034e63b8930c179c
Reviewed-on: https://gerrit.chromium.org/gerrit/65739
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>

12 months agoshill: add more metrics logging 38/65738/2
mukesh agrawal [Tue, 13 Aug 2013 19:51:55 +0000 (12:51 -0700)]
shill: add more metrics logging

Add some logging that was useful in debugging chromium:268058,
and tweak an existing log message to be provide more context.

BUG=chromium:268061
TEST=unit tests

Change-Id: I7dc6036a661cb0086f468b3d73957609fbc5da22
Reviewed-on: https://gerrit.chromium.org/gerrit/65738
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>

12 months agoshill: metrics: add ability to log metrics for debugging 51/65651/3
mukesh agrawal [Tue, 13 Aug 2013 00:55:33 +0000 (17:55 -0700)]
shill: metrics: add ability to log metrics for debugging

To help us debug issues with metrics, log a message at scope
"metrics", level -5, whenever shill sends an enum or histogram
sample to UMA.

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

Manual testing
--------------
1. connect to wifi
2. ff_debug +metrics
3. ff_debug --level -5
4. wait 10 seconds
5. grep "Sending metric Network.Shill.Wifi.LinkMonitorResponseTimeSample" \
     /var/log/net.log
   -> should see matching lines

Change-Id: Iea2a8bfc3eb7d13d23a72d78d6c949d8a32b0e77
Reviewed-on: https://gerrit.chromium.org/gerrit/65651
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>

12 months agoshill: L2TPIPSecDriver: Don't croak due to intermediate PPPD phases 31/65631/2
Paul Stewart [Mon, 12 Aug 2013 22:21:06 +0000 (15:21 -0700)]
shill: L2TPIPSecDriver: Don't croak due to intermediate PPPD phases

There are two intermediate pppd phases ("authenticating",
"authenticated") which are non-fatal, but not an indicator of
success either.  Fix the L2TPIPSecDriver to ignore notification
of transitions into these states.

BUG=chromium:271717
TEST=Unit tests

Change-Id: I4ad6f29a37ebc09da034c759b5da1cb1f874fc61
Reviewed-on: https://gerrit.chromium.org/gerrit/65631
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
12 months agoshill: dongles: report PPP authentication failures correctly 63/64863/5
mukesh agrawal [Wed, 7 Aug 2013 01:10:07 +0000 (18:10 -0700)]
shill: dongles: report PPP authentication failures correctly

Previously, any time we received a disconnect notification from
pppd, we would attempt to set our error state to indicate that
PPP authentication failed. (See below for more on "attempt to".)

This CL tightens up our disconnect handling, to identify which
disconnects are likely to be authentication failures, versus
those that are other failures. Other failures include things like
being unable to acquire an acceptable IP configuration.

We say a disconnect is an authentication failure if PPP was in
the middle of authenticating when the disconnect occurred. Otherwise,
we report kFailureUnknown.

In addition to tightening up the error reporting, this CL fixes a
case where errors would fail to be reported.

Specifically, we used to call SetServiceState, which modifies the
state of selected_service(). However, if we had not yet started
configuring IP, then there would be no selected service, and no
error would be reported.

Fix this, by falling back to |service_| in this case. Note that I
suspect that the failed error reporting is a long-standing issue,
and not specific to PPP dongles.

While there:
- Lower the priority of some log statements (from INFO to VERBOSE2).
- Uncomment a line in CelluarTest.Notify, which I'd meant to uncomment
  before it originally landed.
- Improve readability of log statement in TaskProxy::Notify.

BUG=chromium:267682
TEST=(new) unit tests, manual
TEST=network_3GSmokeTest.pseudomodem
TEST=network_3GModemControl.pseudomodem

Manual testing
--------------
1. get a dongle that requires a specific PPP username/password
2. use set_cellular_ppp (in crosh), to configure an incorrect
   username/password combination
3. try connecting to the cellular network
4. observe a toast-style notification with an error message
   indicating a bad username or password

Change-Id: I60fa7fa9ad8901f5a19eea23b6eb44a6100a02db
Reviewed-on: https://gerrit.chromium.org/gerrit/64863
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>

12 months agoshill-test: add device manipulation script 90/64790/7
Jason Abele [Tue, 6 Aug 2013 17:57:54 +0000 (10:57 -0700)]
shill-test: add device manipulation script

BUG=None
TEST=./device list
./device get-property mlan0
./device get-property mlan0 ScanInterval
./device set-property mlan0 ScanInterval 60

Change-Id: I04a34efe35c7b90c59a64fb129445fb004a01096
Signed-off-by: Jason Abele <jabele@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64790

12 months agoshill: cellular: Enable out-of-credits detection for ALT3100 modem. 02/65102/3
Ben Chan [Thu, 8 Aug 2013 00:44:53 +0000 (17:44 -0700)]
shill: cellular: Enable out-of-credits detection for ALT3100 modem.

BUG=chrome-os-partner:21739
TEST=Tested the following:
1. Build and run unit tests.
2. Verify that an out-of-credits notification is shown when the SIM on
   an ALT3100 modem runs out of data allowance.

Change-Id: Id6a89c672dbdad196457eb0209c8e1aa95f9a90e
Reviewed-on: https://gerrit.chromium.org/gerrit/65102
Commit-Queue: Ben Chan <benchan@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
12 months agoshill: ConnectToBestServices should ignore user-disconnected services. 27/64427/4
Arman Uguray [Sat, 3 Aug 2013 03:21:55 +0000 (20:21 -0700)]
shill: ConnectToBestServices should ignore user-disconnected services.

Manager.ConnectToBestServices should ignore explicitly disconnected
services. This CL addresses a corner-case caught by
network_ChromeCellularSmokeTest (which caused very frequent failures),
in which the network doesn't become disconnected after a call to
chrome.networkingPrivate.startDisconnect, due to a race between the test
and the certificate loader that issues a call to
Manager.ConnectToBestServices after the modem disconnects but before the
service state propagates to the UI. This seems to violate user intent,
as this call causes a service that is explicitly disconnected by the
user through a high-level API call to become disconnected.

The reasons for applying this fix in shill and not the UI:

  1. It is extremely easy to fix in shill and is slightly more involved
     in the NetworkConnectHandler level, as shill already stores which
     services have been explicitly disconnected through an API call.
  2. It makes sense from a shill API stand-point. It can be argued that
     explicitly disconnected service is temporarily undesirable and
     shill shouldn't automatically connect to it. This reasoning is
     already applied to auto-connect.

BUG=chromium:266746,chromium:267011
TEST=1. Build and run unit tests.
     2. network_ChromeCellularSmokeTest.

Change-Id: Ieeb4aef967a2777e94a2a291efc99b7b0b31567f
Reviewed-on: https://gerrit.chromium.org/gerrit/64427
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
Commit-Queue: Arman Uguray <armansito@chromium.org>

12 months agoshill: cellular: Handle service activation when MDN is not available. 32/65032/2
Ben Chan [Wed, 7 Aug 2013 21:39:04 +0000 (14:39 -0700)]
shill: cellular: Handle service activation when MDN is not available.

This CL changes CellularCapabilityUniversal to consider that service
activation may be required when the modem reports no MDN or an empty
MDN.

BUG=chrome-os-partner:21732
TEST=Tested the following:
1. Build and run unit tests.
2. Test activating the cellular service on a modem that reports no MDN
   for an unactivated SIM.
3. Run network_LTEActivate test.
4. Run a modified network_LTEActivate test, which initializes the pseudo
   modem with an empty MDN in the 'OwnNumbers' property.

Change-Id: Ide4da9f9c089ca016c4e90760096884274de7e23
Reviewed-on: https://gerrit.chromium.org/gerrit/65032
Reviewed-by: Thieu Le <thieule@chromium.org>
Reviewed-by: Arman Uguray <armansito@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
12 months agoshill: OpenVPNDriver: Quote options containing spaces 81/64981/4
Paul Stewart [Wed, 7 Aug 2013 19:47:39 +0000 (12:47 -0700)]
shill: OpenVPNDriver: Quote options containing spaces

When converting from command line arguments to config files,
the previous OpenVPN CL neglected to deal with arguments
containing spaces.  These need to be quoted.

BUG=chromium:269600
TEST=Unit tests

Change-Id: Id6aa5e8ed5eb9a97580d6ffe3bbb30992be5293a
Reviewed-on: https://gerrit.chromium.org/gerrit/64981
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>

12 months agoshill_proxy: use ShillProxyError 16/65016/2
Jason Abele [Wed, 7 Aug 2013 22:35:38 +0000 (15:35 -0700)]
shill_proxy: use ShillProxyError

While attempting to raise an error in another shill_proxy CL, noticed
that the error.TestFail class was not available in this context.  Fix by
using the Exception class defined in shill_proxy.

BUG=None
TEST=None

Change-Id: I0affd21eda5497570ab810d91a1995c7e360ddcb
Signed-off-by: Jason Abele <jabele@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65016
Reviewed-by: Christopher Wiley <wiley@chromium.org>
12 months agoshill-test: Fix missing service WiFi test flakes 90/64990/2
Christopher Wiley [Wed, 7 Aug 2013 20:35:23 +0000 (13:35 -0700)]
shill-test: Fix missing service WiFi test flakes

Fix a class of errors that manifest as:

Unhandled Fault:
<Fault 1: '<class \'dbus.exceptions.DBusException\'>:
org.freedesktop.DBus.Error.UnknownObject:
Method "GetProperties" with signature "" on interface
"org.chromium.flimflam.Service" doesn\'t exist\n'>

This happens when we're enumerating services that are being torn down
in shill.  This can happen when we configure our test AP several
different ways in a short time, giving us more opportunities to
experience this race.

BUG=None
TEST=Ran test_that --fast suite:wifi_matfunc and finally saw these errors
disappear.

Change-Id: If4c3d15922f4d79028d6876b676853e06434c115
Reviewed-on: https://gerrit.chromium.org/gerrit/64990
Tested-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>

12 months agoshill: add yet more unit tests for ppp dongle support 01/64401/4
mukesh agrawal [Fri, 2 Aug 2013 22:58:21 +0000 (15:58 -0700)]
shill: add yet more unit tests for ppp dongle support

This time, the lucky winner is VirtualDevice.

BUG=chromium:246826
TEST=unit tests (old+new)

Change-Id: I1c87afa29ba9ebed1a95c2e5132fbe90161aaced
Reviewed-on: https://gerrit.chromium.org/gerrit/64401
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
12 months agoshill: more unit test changes for ppp dongle support 94/64294/3
mukesh agrawal [Thu, 1 Aug 2013 23:03:59 +0000 (16:03 -0700)]
shill: more unit test changes for ppp dongle support

This time, we focus on PPPDevice. We add a couple more constraints
to the ParseIPConfiguration test.

While there: we modify the interface for ParseIPConfiguration.
Previously, the target IPConfig::Properties object was supplied
as an out parameter. Now, the method returns an IPConfig::Properties
object instead.

This was motivated by the new part of the ParseIPConfiguration
test, where the behavior depended on whether or not I passed
ParseIPConfiguration a fresh IPConfig::Properties object. The
new interface avoids that gotcha.

BUG=chromium:246826
TEST=unit tests (old+new)

Change-Id: Icf6dbd0e31623a228779439b23a42970d9b85042
Reviewed-on: https://gerrit.chromium.org/gerrit/64294
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>

12 months agoshill: add yet more unit tests for ppp dongle support 88/64288/3
mukesh agrawal [Thu, 1 Aug 2013 22:43:23 +0000 (15:43 -0700)]
shill: add yet more unit tests for ppp dongle support

This time, we add a test for Modem.

BUG=chromium:246826
TEST=unit tests (old+new)

Change-Id: I8d7118868d16eef370e5a95e8212ca510efe393e
Reviewed-on: https://gerrit.chromium.org/gerrit/64288
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>

12 months agoshill: L2TPIPSecDriver: add test for another Notify case 63/64263/4
mukesh agrawal [Thu, 1 Aug 2013 20:41:15 +0000 (13:41 -0700)]
shill: L2TPIPSecDriver: add test for another Notify case

If we already have a |device_| when L2TPIPsecDriver::Notify
is called, we don't create a new PPPDevice. This case didn't
have test coverage before, so this CL adds it.

While there: refactor some code, to reduce duplication
across test cases.

BUG=chromium:246826
TEST=unit tests (old+new)

Change-Id: Ic7325cabfd28f9db4efd90c0f7b765c1f48d4901
Reviewed-on: https://gerrit.chromium.org/gerrit/64263
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
12 months agoshill: cellular: add carrier info for Reliance, MTS, and Tata 62/63462/4
Ben Chan [Fri, 26 Jul 2013 06:33:29 +0000 (23:33 -0700)]
shill: cellular: add carrier info for Reliance, MTS, and Tata

BUG=chromium:256915
TEST=Tested using pseudomodem as follows:
1. Modify 'sid' passed to CdmaNetwork in pseudomodem/modem_cdma.py
2. Run `pseudomodem.py -f CDMA`
3. Verify that shill reports the carrier name for Reliance, MTS, and
   Tata as specified in cellular_operator_info.

Change-Id: Icc541f3f4cd9d75c4bef86e969bb05df00814440
Reviewed-on: https://gerrit.chromium.org/gerrit/63462
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>

12 months agoshill: add unit test for ExternalTask::DestroyLater 18/64018/4
mukesh agrawal [Thu, 1 Aug 2013 01:38:55 +0000 (18:38 -0700)]
shill: add unit test for ExternalTask::DestroyLater

The new test verifies that DestroyLater defers actual destruction
of the ExternalTask to the event loop.

While there: refactor some code, to reduce duplication across
test cases.

BUG=chromium:246826
TEST=unit tests (old+new)

Change-Id: Idd3ad4e447f2f59132742d6daca5699328e950df
Reviewed-on: https://gerrit.chromium.org/gerrit/64018
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
12 months agoshill: OpenVPNDriver: Write a configuration file 68/64368/5
Paul Stewart [Fri, 2 Aug 2013 19:12:09 +0000 (12:12 -0700)]
shill: OpenVPNDriver: Write a configuration file

Instead of passing configuration to OpenVPN using command line
options, write out a configuration file instead.  This config
file is owned by root created in a run directory that is not
readable by any other users.  Although OpenVPN drops privileges,
it reads its configuration before doing so.  The configuration
file is removed with the regular OpenVPNDriver cleanup process.

As a side effect of this, all added options in the OpenVPNDriver
and OpenVPNManagementServer now lose their "--" prefix.

BUG=chromium:217624
TEST=Unit tests, network_VPNConnect.openvpn_user_pass

Change-Id: I6424ccafb5764428b1ee8fc2ad41177a6d2b3c52
Reviewed-on: https://gerrit.chromium.org/gerrit/64368
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
12 months agoshill: OpenVPNDriver: Remove kOpenVPNMgmtEnableProperty 93/64293/2
Paul Stewart [Fri, 2 Aug 2013 00:03:21 +0000 (17:03 -0700)]
shill: OpenVPNDriver: Remove kOpenVPNMgmtEnableProperty

Since this argument isn't used in Chrome anymore, we are safe
to remove it from shill.

BUG=chromium:211858
TEST=Unit tests, network_VPNConnect.openvpn_user_pass, code search for
kOpenVPNMgmtEnableProperty in chrome.

Change-Id: I1ca7946e9430e60ae01a1a69a56686112aafa519
Reviewed-on: https://gerrit.chromium.org/gerrit/64293
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
12 months agoshill-test: Avoid using Manager.FindMatchingService for legacy support 73/63973/4
Christopher Wiley [Wed, 31 Jul 2013 21:08:07 +0000 (14:08 -0700)]
shill-test: Avoid using Manager.FindMatchingService for legacy support

Allow WiFi proxy to work with older shill versions by replacing its call
to FindMatchingService with a Python equivalent.

TEST=WiFi can connect to APs with R24 shill.  Ran tests on ToT ChromeOS
that exercise all three changed methods.
BUG=chromium:266513

Change-Id: If150efaa6b02341748a6e11321c8b126741a42f2
Reviewed-on: https://gerrit.chromium.org/gerrit/63973
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Tested-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Christopher Wiley <wiley@chromium.org>

12 months agoshill: wimax: Do not clear EAP password on user-initiated disconnection. 55/63455/5
Ben Chan [Thu, 25 Jul 2013 18:59:03 +0000 (11:59 -0700)]
shill: wimax: Do not clear EAP password on user-initiated disconnection.

The networking UI now provides a way to configure the WiMAX EAP
credentials (crosbug.com/p/21324), so the workaround that clears the
WiMAX EAP password upon a user-initiated disconnection is no longer
needed.

BUG=chrome-os-partner:21357
TEST=Tested the following:
1. Build and run unit tests.
2. Connect to a WiMAX network and then explicitly disconnect. Verify
   that the UI does not prompt for EAP password when reconnecting to the
   same WiMAX network.

Change-Id: I08f30d9b23e12316c955f79b1c370f06e2c6faea
Reviewed-on: https://gerrit.chromium.org/gerrit/63455
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
13 months agoshill: add some more unit tests for ppp dongle support 96/63996/4
mukesh agrawal [Wed, 31 Jul 2013 23:25:53 +0000 (16:25 -0700)]
shill: add some more unit tests for ppp dongle support

Following on CL:63937, this commit adds unit tests for the
changes made to cellular_capability_universal, in CL:51356.

Note that I've changed the ON_CALL statements in CreateDBusPropertiesProxy
to EXPECT_CALL...AnyNumber. This is arguably the wrong place to set
expectations on the number of calls. However, given that
CreateDBusPropertiesProxy is called from a loop inside OnListBearersReply,
there's not a good way to set expectations from an individual test.

(In particular, the DBusPropertiesProxy objects are allocated and
forgotten by the test fixture before any of the test-specific code
can grab a handle to them.)

While there: remove GetActiveBearerProperties and GetInactiveBearerProperties,
as a) they're unused, and b) they might be confused with the new methods
mutable_active_bearer_properties and mutable_inactive_bearer_properties.

BUG=chromium:246826
TEST=new unit tests

Change-Id: I328be4866bd4736ed4d7481a8faa60437b265196
Reviewed-on: https://gerrit.chromium.org/gerrit/63996
Reviewed-by: Arman Uguray <armansito@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>

13 months agoshill: add some unit tests for ppp dongle support 37/63937/3
mukesh agrawal [Wed, 31 Jul 2013 18:37:57 +0000 (11:37 -0700)]
shill: add some unit tests for ppp dongle support

This is the first in a series of CLs that will provide unit test coverage
for code introduced or modified by CL:51356, which added support for PPP
dongles.

The primary purpose of this CL is to add unit test coverage for the changes
made to cellular.cc. (Other files will be covered in other CLs.)

While there:
- add a PPPDeviceFactory, and a MockPPPDeviceFactory, so that we
  can force the creation of a Mock in Cellular::StartPPP
- add an mm1::MockModemSimpleProxy to CellularTest, so that the PPP
  tests can use something similar to what we use at runtime
- mock out SelectService and UpdateIPConfigFromPPP in MockPPPDevice,
  so that PPP tests can EXPECT on them
- update L2TPIPSecDriverTest.Notify to reflect that SelectService
  and UpdateIPConfigFromPPP are now mock methods
- add some comments in various proxy class headers, to help distinguish
  between stuff related to old modemmanager and stuff related to new
  modemmanager
- fix a random typo or two

BUG=chromium:246826
TEST=new unit tests

Change-Id: I5b2d0af0f9beb760d05e802531c0c9bc1ac5a040
Reviewed-on: https://gerrit.chromium.org/gerrit/63937
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>

13 months agoshill: OpenVPNDriver: Use double vector of strings for arguments 92/64292/3
Paul Stewart [Thu, 1 Aug 2013 16:30:12 +0000 (09:30 -0700)]
shill: OpenVPNDriver: Use double vector of strings for arguments

Restructure the code that creates command-line arguments for the
openvpn process.  Instead of building a flat vector of strings,
each logical option supplied to openvpn is itself a vector of
strings.  Thus, it is possible to output either a command line
argument list for OpenVPN (as is still done here) or a configuration
file which will contain each multi-word option on a separate line.

This structure also allows testing to be more rigorous since
expectations won't conflate the flag with its arguments.

BUG=chromium:217624
TEST=Unit tests, network_VPNConnect.openvpn_user_pass

Change-Id: I7d2973792372d43df6c3a3ebe3728debd09e1e68
Reviewed-on: https://gerrit.chromium.org/gerrit/64292
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>

13 months agocellular_proxy: Added find_cellular_service_object. 64/64264/3
Arman Uguray [Thu, 1 Aug 2013 20:57:12 +0000 (13:57 -0700)]
cellular_proxy: Added find_cellular_service_object.

Added the service equivalent of find_cellular_device_object.

BUG=none
TEST=Manual.

Change-Id: I9998e804caeb48612aa06e6c8fa45eb18b8705b0
Reviewed-on: https://gerrit.chromium.org/gerrit/64264
Commit-Queue: Arman Uguray <armansito@chromium.org>
Reviewed-by: Arman Uguray <armansito@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
13 months agoshill: Manager: Use Provider mapping in ConfigureServiceForProfile 51/63651/7
Paul Stewart [Mon, 29 Jul 2013 19:21:12 +0000 (12:21 -0700)]
shill: Manager: Use Provider mapping in ConfigureServiceForProfile

Instead of tailoring Manager::ConfigureServiceForProfile specifically
for WiFi services, use the |providers_| map to retrieve and configure
services for all supported providers.

BUG=chromium:265592
TEST=Unit tests

Change-Id: I515f846db91c0a7b55cbe46f20c972736dc8a8d0
Reviewed-on: https://gerrit.chromium.org/gerrit/63651
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>

13 months agoshill: remove unused method DeviceAdaptorInterface::UpdateEnabled 74/63974/2
mukesh agrawal [Wed, 31 Jul 2013 21:22:39 +0000 (14:22 -0700)]
shill: remove unused method DeviceAdaptorInterface::UpdateEnabled

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

BUG=None
TEST=unit tests

Change-Id: Ief487561c826b57a365f2e5013dee204c3b7f1c0
Reviewed-on: https://gerrit.chromium.org/gerrit/63974
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>

13 months agoshill: *Provider: Flesh out inherited classes 50/63650/7 firmware-pit-4482.B
Paul Stewart [Tue, 30 Jul 2013 15:21:58 +0000 (08:21 -0700)]
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>
13 months agoshill: Manager: Map between Technology and Provider 05/63605/8
Paul Stewart [Mon, 29 Jul 2013 18:11:37 +0000 (11:11 -0700)]
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>
13 months agoshill: Provider: Create common superclass 04/63604/7
Paul Stewart [Fri, 26 Jul 2013 21:42:55 +0000 (14:42 -0700)]
shill: Provider: Create common superclass

Make all *Provider classes in shill that are responsible for
managing Service objects descend from a common parent class.
This will allow the Manager to refactor repeated code related
to providers.  The parent class is non-virtual for now, and
implements stubs for all methods, so subclasses that do not
yet implement the full interface can safely omit these methods.
A future CL will flesh out these implementations and change
this to a pure-virtual Interface class.

BUG=chromium:265518
TEST=Unit tests

Change-Id: If4ee03a511f4732e3067ce134e501f73e421ace1
Reviewed-on: https://gerrit.chromium.org/gerrit/63604
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
13 months agoshill: Support setting stringmaps via ServiceDBusAdaptor::SetProperties. 15/63815/5
Arman Uguray [Tue, 30 Jul 2013 23:41:12 +0000 (16:41 -0700)]
shill: Support setting stringmaps via ServiceDBusAdaptor::SetProperties.

Added support for Stringmap to KeyValueStore and enabled Stringmap as a
settable property type through ServiceDBusAdaptor::SetProperties and
Service::Configure.

BUG=chromium:266103
TEST=1. Build and run unit tests.
     2. Using Service.SetProperties via DBus should successfully set
     properties.

Change-Id: I84489bf431ff08b8f8367afb46cf5f87430a3f61
Reviewed-on: https://gerrit.chromium.org/gerrit/63815
Commit-Queue: Arman Uguray <armansito@chromium.org>
Reviewed-by: Arman Uguray <armansito@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
13 months agoshill: Make Manager.UninitializedTechnologies and others mutually exclusive. 84/63684/3
Arman Uguray [Tue, 30 Jul 2013 01:20:52 +0000 (18:20 -0700)]
shill: Make Manager.UninitializedTechnologies and others mutually exclusive.

If there is at least one device of a particular technology that is
enabled or enabling then it shouldn't be contained in
Manager.UninitializedTechnologies.

BUG=chromium:265002
TEST=1. Build and run unit tests.
     2. On a device that contains a built in modem:
        - stop modemmanager/cromo
        - Run pseudomodem. Make sure that cellular is enabled.
        - Check via DBus that Manager.UninitializedTechnologies does not
          contain "cellular".

Change-Id: I85e6b06782967255d68a6c73d660fd5e00092d9e
Reviewed-on: https://gerrit.chromium.org/gerrit/63684
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Arman Uguray <armansito@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
13 months agonetfilter-queue: Fix fd leak when gaining netmask 97/63897/2
Paul Stewart [Wed, 31 Jul 2013 15:31:10 +0000 (08:31 -0700)]
netfilter-queue: Fix fd leak when gaining netmask

The netfilter queue process leaked an fd each time a socket
was opened to query the interface netmask.  Fix this by giving
ownership to a ScopedFD.

BUG=chromium:261360
TEST=Unit tests

Change-Id: Ie926cc5b1909f63c054c1cde8b24dae7cef7d48c
Reviewed-on: https://gerrit.chromium.org/gerrit/63897
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
13 months agoshill: Factors some common unittest code into own methods. 12/63712/3
Wade Guthrie [Mon, 29 Jul 2013 23:03:14 +0000 (16:03 -0700)]
shill: Factors some common unittest code into own methods.

A code review on a previous CL suggested refactoring the StartScan and
AttemptConnection code from the unittests into their own methods.  This
does that.

Found and fixed a tiny buglet where transitioning from
scanning(progressive) to scanning(full) emitted an extra dbus
signal(scanning=true).

Also made VerifyScanState 'const'.

BUG=None.
TEST=unittest.

Change-Id: Ia4d993dfd0ee425cba1a38fed2561e213f42e699
Reviewed-on: https://gerrit.chromium.org/gerrit/63712
Commit-Queue: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
13 months agoshill: cellular: Updating serving operator should update service name. 13/63513/3 factory-pit-4471.B
Arman Uguray [Fri, 26 Jul 2013 21:53:30 +0000 (14:53 -0700)]
shill: cellular: Updating serving operator should update service name.

CellularCapabilityUniversalCDMA::UpdateServingOperator should update the
service name.

BUG=chromium:264937
TEST=1. Build and run unit tests.
     2. Start pseudomodem in CDMA mode. Running "connectivity show services"
        should display "Test Network" as the value for "Name" and not a generic
        name such as "CDMANetwork0"

Change-Id: I5fcad7528d8de8870befee513ec79d0a2133a801
Reviewed-on: https://gerrit.chromium.org/gerrit/63513
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Arman Uguray <armansito@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
13 months agoshill: accelerate link monitoring after a suspend/resume event 26/63126/4
mukesh agrawal [Wed, 17 Jul 2013 23:32:24 +0000 (16:32 -0700)]
shill: accelerate link monitoring after a suspend/resume event

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

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

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

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

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

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

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

Change-Id: I900ba45714875f5785bba3d47c73f37b863553fb
Reviewed-on: https://gerrit.chromium.org/gerrit/63126
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
13 months agoshill: Makes progressive scan field trial more visible in logs. 60/63360/3
Wade Guthrie [Thu, 25 Jul 2013 17:43:01 +0000 (10:43 -0700)]
shill: Makes progressive scan field trial more visible in logs.

The progressive scan field trial used to be shown in the logs only on
instantiation of the WiFi device so feedback would probably not provide
this information.  This CL makes the progressive scan group visible at
the start of every scan greatly increasing the likelihood of having this
data available in feedback logs.

BUG=None
TEST=unittest

Change-Id: I5c6d7b563002339740ae54e919843f218cd1ba8e
Reviewed-on: https://gerrit.chromium.org/gerrit/63360
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
Commit-Queue: Wade Guthrie <wdg@chromium.org>

13 months agoshill: Improves logging for scan. 57/63357/3
Wade Guthrie [Thu, 25 Jul 2013 17:03:03 +0000 (10:03 -0700)]
shill: Improves logging for scan.

Looking at the logs, it's hard to tell why shill chooses to do a scan.
This CL adds a 'reason' (which is really the name of the calling
function) to Scan calls to make it clear why we're scanning.

BUG=None
TEST=unittest

Change-Id: Ibd128625681fc5d61d359b60953bb78d89e97dfe
Reviewed-on: https://gerrit.chromium.org/gerrit/63357
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
13 months agoshill: Cleans-up scan state machine to address field trial anomalies. 31/62131/7
Wade Guthrie [Wed, 17 Jul 2013 18:43:55 +0000 (11:43 -0700)]
shill: Cleans-up scan state machine to address field trial anomalies.

The progressive scan field trial shows a few scan-to-connect times that
extend much, much longer than expected (5% of one study group shows
times that extend to multiple hours).  I suspect that various timeouts
in the scan/connect process (including the user being too frustrated to
continue) would terminate this process long before we reached an hour
and, therefore, that these anamolies are a function of measurement
rather than operational problems.  This would suggest that some
operations that should terminate the scan state machine aren't being
caught and, consequently, that occasionally some wifi connections are
being linked to previous, unrelated, scans.

This CL explores this possibility by rearranging the SetScanState calls
to follow pending_service_ (an indicator of scan/connect state that has
gotten a lot of testing and time in the field).  This has the added
benefit of insuring that different code that expresses the state of
the scan/connect mechanism track each other more closely.

One ramification of this CL is that scan-to-connect and
scan-to-not-found state transitions occur earlier than before.  The
transition was moved to the actual cause of the transition (to the call
to SetPendingService, for instance) rather than a convenient spot to
view it (in ProgressiveScanTask).

In certain cases (in PendingTimeoutHandler, for instance), SetScanState
calls had to be moved relative to existing calls to SetPendingState
(which now calls SetScanState) in order to reflect the actual scan state
correctly.  Similar reasoning instigated the creation
kScanTransitionToConnecting to correctly document the scan state if,
during the scan/connect process, we try to connect to a service that is
not the pending_service_.

Another change resets the WiFi connect timer (just as we reset the WiFi
scan timer) when the scan state reaches 'kScanIdle'.

BUG=chromium:260759
TEST=unittest

Change-Id: Ib1c559b27d91df5b7408a42b187fb67cf03c8784
Reviewed-on: https://gerrit.chromium.org/gerrit/62131
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
13 months agotest-scripts: Add cellular_proxy.py and some constants to shill_proxy.py 32/62932/5 factory-4455.B
Prathmesh Prabhu [Thu, 18 Jul 2013 20:51:13 +0000 (13:51 -0700)]
test-scripts: Add cellular_proxy.py and some constants to shill_proxy.py

(1) cellular_proxy.py provides functions and constants over and above
    shill_proxy.py for cellular tests.
(2) Extended shill_proxy.py for tests.

BUG=chromium:249149
TEST=None

Change-Id: I88555d64b6c7f2b625aed7593b22d994a6ff6f52
Reviewed-on: https://gerrit.chromium.org/gerrit/62932
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
13 months agoshill: PPP dongles: cleanly move Service from Cellular to PPPDevice 12/62712/4 stabilize-4443.B
mukesh agrawal [Fri, 19 Jul 2013 21:49:08 +0000 (14:49 -0700)]
shill: PPP dongles: cleanly move Service from Cellular to PPPDevice

In CL:61602, I added a CHECK that the Cellular object doesn't have
a selected_service() when PPP comes up. The idea was to ensure that
we only have one Device trying to drive the state of the CellularService.

This CHECK fails on devices with an embryonic cdc_ether or cdc_ncm
interface, because we SelectService() in LinkEvent().

Resolve this by dropping the selected_service() in StartPPP().
We do this using DropConnection(), which may be what I should have
done all along. (DropConnection() also takes care of killing dhcpcd,
if it is running.)

While there: fix up a couple of buggy log statements in device_info.

BUG=chromium:261364
TEST=unit tests, manual

Manual testing
--------------
- plug in a dongle with an embryonic cdc_ether or cdc_ncm interface.
  e.g. the huawei UMG1691 dongle
- check that the cellular connection comes up (IP address is configured,
  can load web pages)
- check that shill did not crash in the process (grep crash /var/log/messages)
- repeat steps 1-3 with a ppp-only dongle (e.g. huawei e369)

Change-Id: Ia270f00746dc321b41a223e9f848ffc796dd8528
Reviewed-on: https://gerrit.chromium.org/gerrit/62712
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>

13 months agoshill: DBusAdaptor: Parse int32 keys 12/62412/5
Paul Stewart [Wed, 17 Jul 2013 22:46:19 +0000 (15:46 -0700)]
shill: DBusAdaptor: Parse int32 keys

Parse int32 keys from string -> variant maps and place them in
KeyValueStore in DBusAdaptor::ArgsToKeyValueStore().  This way
int32 values can be added to dicts in Manager::ConfigureService()
and Service::SetProperties().

BUG=chromium:260656
TEST=Unit tests

Change-Id: Ib62f8d215dafb0405c08d16e4418c0b5211a46d6
Reviewed-on: https://gerrit.chromium.org/gerrit/62412
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
13 months agoshill: ManagerTest: Use a non-null Ethernet EAP Service 88/62488/2
Paul Stewart [Thu, 18 Jul 2013 16:51:35 +0000 (09:51 -0700)]
shill: ManagerTest: Use a non-null Ethernet EAP Service

Previously the service we used to set and test the EthernetEap
service in the provider was null

BUG=None
TEST=Run unit tests

Change-Id: I1adcff5a371c0b00ee131b620a77ba3064db0b6f
Reviewed-on: https://gerrit.chromium.org/gerrit/62488
Reviewed-by: Philipp Neubeck <pneubeck@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
13 months agoshill: Cleans-up scan state handling. 75/62375/3
Wade Guthrie [Fri, 12 Jul 2013 20:49:18 +0000 (13:49 -0700)]
shill: Cleans-up scan state handling.

This CL does the following:
  o Moves all scan state metrics into SetScanState.
  o Updates local scan state before making DBus calls.

While there:
  o Enhances SetScanState to include the calling method (helps with
    debugging).

BUG=chromium:260759
TEST=unittest

Change-Id: Ie0e3de42183ed4d670786d2e9236e58c94269168
Reviewed-on: https://gerrit.chromium.org/gerrit/62375
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
13 months agoshill: Service: Clear optionally saved parameters on Load() 72/62372/3
Paul Stewart [Wed, 17 Jul 2013 17:32:48 +0000 (10:32 -0700)]
shill: Service: Clear optionally saved parameters on Load()

There are some values that are not saved to a profile entry
(explicitly removed) in Service::Save if they are currently
the default value.  When loading from a Profile, reset these
properties if the profile property does not exist.

BUG=chromium:261211
TEST=New unit tests

Change-Id: Ia6d847f30fade2ed54ed007ad847c1426560a795
Reviewed-on: https://gerrit.chromium.org/gerrit/62372
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
13 months agoshill: Metrics: Report AP Mode (Managed vs IBSS) 47/62347/4
Paul Stewart [Wed, 17 Jul 2013 15:56:44 +0000 (08:56 -0700)]
shill: Metrics: Report AP Mode (Managed vs IBSS)

When a connection completes report the AP mode of the service.
This way we can track aggregate statistics of IBSS-mode connections.

BUG=chromium:260922
TEST=Unit test; connect to AP and look for "Network.Shill.Wifi.ApMode"
in chrome://histograms

Change-Id: I272ac04d7a1fa9479512e35ae844d31041a7694b
Reviewed-on: https://gerrit.chromium.org/gerrit/62347
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
13 months agoshill: small syntax cleanup 56/62356/2
mukesh agrawal [Wed, 17 Jul 2013 17:21:00 +0000 (10:21 -0700)]
shill: small syntax cleanup

An invocation of make_scoped_refptr doesn't need to include
empty angle-brackets. So remove them.

BUG=None
TEST=unit tests

Change-Id: Id6ea7fee5bf9f973e3efb06763b8c377d71d8eae
Reviewed-on: https://gerrit.chromium.org/gerrit/62356
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>

13 months agoshill: fix DisableTechnology with multiple devices of a technology 16/62016/5
mukesh agrawal [Wed, 10 Jul 2013 23:39:10 +0000 (16:39 -0700)]
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>
13 months agoshill: cellular: Pass operator-specific MDN to online payment portal. 23/61823/5
Ben Chan [Sat, 13 Jul 2013 05:10:55 +0000 (22:10 -0700)]
shill: cellular: Pass operator-specific MDN to online payment portal.

BUG=chrome-os-partner:20887
TEST=Tested the following:
1. Build and run unit tests.
2. Run `connectivity show services` to verify that the 'Cellular.OlpUrl'
   property of a LTE cellular service includes a 10-digit MDN.
3. Verify that clicking the 'View account' button on the settings page
   of a connected LTE service launches the online account page of the
   mobile carrier.

Change-Id: If7a9660082b3b33812d3f1a0c0f99e01c17265f6
Reviewed-on: https://gerrit.chromium.org/gerrit/61823
Reviewed-by: Arman Uguray <armansito@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
13 months agoshill: cellular: improve handling of CellularService state 25/61625/3
mukesh agrawal [Thu, 11 Jul 2013 23:41:52 +0000 (16:41 -0700)]
shill: cellular: improve handling of CellularService state

As noted in crbug.com/246456#c1, when using a PPP dongle,
we don't let the Cellular object SelectService on the CellularService.

That avoids potential conflicts where both Cellular and PPPDevice
are trying to manage the IP configuration of the Service. However,
there are some state change events that need to be propagated to
the Service. In particular, when the modem disconnects, we need to
move the Service to the idle state.

Fix this by overriding the various service-state-setting methods
with versions that punt over to PPPDevice, when appropriate.

While there:
- mark Cellular::OnNoNetworkRouting as override-ing
- move cleanup of MockCellularService to CellularTest:TearDown
  (instead of being the responsibility of individual tests)

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

Manual testing
--------------
1. plug in ppp dongle
2. wait for dongle to connect
3. chrome://settings -> Mobile data -> <provider> -> Disconnect
4. wait for disconnect to complete
5. "Mobile data" should show "Not connected"
6. chrome://network should show the Cellular service in "idle" state.
7. ifconfig should not show any ppp device (e.g. ppp0, ppp1)
8. Mobile data -> <provider> -> Connect
9. connect should succeed

Change-Id: I512c98ef8cc187fa039e58ad66da604ff1739063
Reviewed-on: https://gerrit.chromium.org/gerrit/61625
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
13 months agoshill: Map crosbugs to their crbug equivalent 94/61794/4
Paul Stewart [Fri, 12 Jul 2013 23:07:51 +0000 (16:07 -0700)]
shill: Map crosbugs to their crbug equivalent

This makes things more consistent with the current issue URLs.

BUG=chromium:260016
TEST=Unit tests;
sed -i $(for crosbug in $(grep 'crosbug.com/[0-9]' *.cc *.h | sed -e 's#.*crosbug.com/\([0-9]*\).*#\1#' | sort | uniq); do crbug=$(curl -s "https://code.google.com/p/chromium-os/issues/detail?id=$crosbug" | grep HREF | sed -e 's/.*id=\([0-9]*\).*/\1/'); echo "-e s#crosbug.com/$crosbug#crbug.com/$crbug#"; done) *.cc *.h

Change-Id: I28e31c6c30186dd2a7cd1b36a170c33c2797d97f
Reviewed-on: https://gerrit.chromium.org/gerrit/61794
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
13 months agoshill: WiFi: Detect WEP passphrase failures 04/61704/4
Paul Stewart [Fri, 12 Jul 2013 19:49:15 +0000 (12:49 -0700)]
shill: WiFi: Detect WEP passphrase failures

Keep track of the number of (successfully decrypted) packets we
have received on a WEP network.  If the DHCP process fails and
we have received no other packets, we should suspect that this
is due to a faulty passphrase.

BUG=chromium:216250
TEST=Unit tests + manual: Connect to a WEP network with the wrong
passphrase.  (Note that CrOS_WEP_trendnet_tew639gr is currently
refusing association for a reason other than passphrase, or is
configured for shared-key authentication which is baroque even
for WEP.)

Change-Id: I0bb3ac9539bad0cf8cfaf9115b550a631a26170b
Reviewed-on: https://gerrit.chromium.org/gerrit/61704
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
13 months agotest-scripts: Deprecate flimflam.py 07/61907/2
Prathmesh Prabhu [Mon, 15 Jul 2013 17:55:25 +0000 (10:55 -0700)]
test-scripts: Deprecate flimflam.py

We are moving tests away from flimflam.py to using shill_proxy suite of scripts.
Add deprecate comments to flimflam.py to warn users, and to remind ourselves.

BUG=chromium:260312
TEST=None.

Change-Id: I62f3f6234b46a753e482f7f294c186d7fb2bf618
Reviewed-on: https://gerrit.chromium.org/gerrit/61907
Reviewed-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
13 months agoshill: cellular: Handle invalid SIM object path "/". 51/61651/3
Ben Chan [Fri, 12 Jul 2013 07:30:25 +0000 (00:30 -0700)]
shill: cellular: Handle invalid SIM object path "/".

This CL modifies CellularCapabilityUniversal::OnSimLockStatusChanged()
to properly handle an invalid SIM object path "/".

BUG=None
TEST=Build and run unit tests.

Change-Id: Ifb8e468671d11a3360ffbb6a96607d8c3c064a75
Reviewed-on: https://gerrit.chromium.org/gerrit/61651
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>

13 months agoExport the Physical Technology of a VPN service. 10/61510/5
Alex Deymo [Thu, 4 Jul 2013 01:41:31 +0000 (18:41 -0700)]
Export the Physical Technology of a VPN service.

Exposes the Type of the lowest service used for a VPN service
through the "PhysicalTechnology" property of a VPN service.

TEST=cros_workon_make shill --test and tested manually.
BUG=chromium:213086

Manual Test procedure.
1. Connect to a wifi network.
2. Connect to a VPN service on that wifi network.
3. Run /usr/local/lib/flimflam/test/list-services on a terminal
and verify the first service on its output contains a service with
a Type "vpn" and a PhysicalTechnology "wifi":

[ /service/6 ]
    ...
    Type = vpn
    ...
    PhysicalTechnology = wifi

Change-Id: Ic843429de3f4d5a4208e271bb779c3e3160f036b
Reviewed-on: https://gerrit.chromium.org/gerrit/61510
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
13 months agoautotest: Adds wait_for_service_state to ShillProxy. 53/61353/6
Wade Guthrie [Tue, 9 Jul 2013 22:47:49 +0000 (15:47 -0700)]
autotest: Adds wait_for_service_state to ShillProxy.

The new autotest framework needs the ability to wait for a service to
achieve a state from a list of states.  This CL provides such a
capability.

BUG=chromium:258664
TEST=autotest
CQ-DEPEND=If6ea0a4de2a8e90ca30df4904551ebc85a9694c1

Change-Id: Id3f34443d69e8c56e7ca885f3ac6ebe1eeb2ba47
Reviewed-on: https://gerrit.chromium.org/gerrit/61353
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
13 months agoshill: cellular: Handle vanish of bearer when getting its properties. 87/61587/3 factory-pit-4390.B firmware-falco_peppy-4389.B firmware-leon-4389.26.B firmware-wolf-4389.24.B
Ben Chan [Wed, 10 Jul 2013 06:07:03 +0000 (23:07 -0700)]
shill: cellular: Handle vanish of bearer when getting its properties.

This CL changes CellularCapabilityUniversal::OnListBearersReply() to get
the properties of a bearer via a single invocation of
DBusPropertiesProxy::GetAll() instead of multiple invocations of
different property getters in mm1::BearerProxy. This allows us to handle
the vanish of a bearer more gracefully when getting its properties over
DBus.

BUG=chromium:244496
TEST=Tested the following:
1. Build and run unit tests.
2. Run network_3GSmokeTest test on platforms with Y3400 and E362 modem.
3. Run network_3GModemControl test with pseudomodem.
4. Test a few 3G dongles that use PPP.

Change-Id: I7d594d59dae5191bc0db1defcdaf4663d929a529
Reviewed-on: https://gerrit.chromium.org/gerrit/61587
Commit-Queue: Ben Chan <benchan@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
13 months agoshill: fix crash when disabling cellular 02/61602/3
mukesh agrawal [Thu, 11 Jul 2013 21:09:41 +0000 (14:09 -0700)]
shill: fix crash when disabling cellular

As part of disabling Cellular, we deregister the CellularService
from the Manager. Manager::DeregisterService checks that the
Service does not have a Connection. We were crashing, because
this check failed.

The reason the check failed is that we were failing to drop the
Connection of the CellularService. The reason that we weren't
dropping the Connection is that we were calling DropConnection
on Cellular, rather than PPPDevice. And it's PPPDevice that
has the CellularService plumbed in the appropriate way (via
SelectService.)

Fix this by having Cellular::DropConnection punt over to
PPPDevice::DropConnection, if (and only if) we're using PPP.

While there: add some comments to crbug.com/246456, and close
it out. (I think I now understand enough of how Service and
Device interact to make a decision on that question.)

BUG=chromium:249085,chromium:246456
TEST=new unit tests, manual (see below)

Manual testing
--------------
- grab a device without built-in 3g
  (if the device has built-in 3g, verification will fail
   due to crbug.com/258206)
- log in
- plug in 3g ppp dongle
- wait to connect
- after connecting: ash-tray -> "Connected to" -> toggle
  state of 3g (triangle icon in lower right)
- wait for disconnect
- observe that the 3g network is no longer in the ash-tray
  menu
- check that shill has not crashed
- check that ifconfig no longer shows a ppp device (e.g. ppp0, ppp1)

Change-Id: I3fc3b6dc0ce1d90b5e34522543fe2116a32bf539
Reviewed-on: https://gerrit.chromium.org/gerrit/61602
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
13 months agoshill: improve logging, and comment out unused args 01/61601/3
mukesh agrawal [Thu, 11 Jul 2013 02:05:08 +0000 (19:05 -0700)]
shill: improve logging, and comment out unused args

1) Add some more context for a few logging calls.
2) Comment out some unused args, to make it obvious that they're
   unused.

BUG=None
TEST=unit tests

Change-Id: I0a71a8d2311a17859f96793a88f950c3636cd91e
Reviewed-on: https://gerrit.chromium.org/gerrit/61601
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
13 months agoshill: WiFiService: Track successive WPA/EAP auth failures 55/61355/4
Paul Stewart [Tue, 9 Jul 2013 23:32:37 +0000 (16:32 -0700)]
shill: WiFiService: Track successive WPA/EAP auth failures

When a WiFi association fails during 802.1x EAP authentication or
WPA 4-way handshake, track these in in the WiFi Service in a manner
that will allow us to detect multiple consecutive failures.  When
a number of such failures occur, signal the service's failure in a
similar manner to an initial authentication failure with no prior
successful connections.  This will signal the UI to notify the user
that their credentials might no longer be valid.

This counter is non-persistent (not stored to the profile) and
orthogonal to other facilities like connection throttling and
the PassphraseRequired property, since it is only meant as a
heuristic signal to Chrome.

BUG=chromium:217033
TEST=Unit tests

Change-Id: I9c2df6770e643162ae0e7b5e03b2b857f4773b37
Reviewed-on: https://gerrit.chromium.org/gerrit/61355
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
13 months agoshill: Generalize and extend DBusProperties to support more DBus types. 46/61446/4
Ben Chan [Wed, 10 Jul 2013 18:34:07 +0000 (11:34 -0700)]
shill: Generalize and extend DBusProperties to support more DBus types.

This CL modifies DBusProperties as follows:
1. Refactor code in DBusProperties::Get* methods into a template
   GetValue() method.
2. Add new DBusProperties::Get* methods for the following DBus types:
     int16, int64, uint8, uint64, double, dict<string, variant>
3. Refactor unit tests for DBusProperties::Get* into typed tests and add
   additional test coverage.
4. Change the DBusProperties::ConvertKeyValueStoreToMap method to also
   support vector<string>.

BUG=chromium:259019
TEST=Build and run unit tests.

Change-Id: I714572746116d79ba140da85e205fb3d3e6e2f55
Reviewed-on: https://gerrit.chromium.org/gerrit/61446
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
13 months agoshill: Connection: Don't create a route to invalid gateway 50/61450/2
Paul Stewart [Wed, 10 Jul 2013 18:59:13 +0000 (11:59 -0700)]
shill: Connection: Don't create a route to invalid gateway

Automated tests like network_VPNConnect will create VPN links
on interfaces that may not have a gateway route.  This causes
a crash in shill since it does not ever expect the underlying
connection to have no gateway.  Although this is unlikely in
the field, there is no cost to fixing this issue in shill.

BUG=chromium:259030
TEST=Unit tests

Change-Id: I25372df5066ad4c044fdf542f83934ab1418f517
Reviewed-on: https://gerrit.chromium.org/gerrit/61450
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
13 months agoSplit shill_proxy.py into shill_proxy.py and wifi_proxy.py 27/61127/5
Prathmesh Prabhu [Wed, 3 Jul 2013 20:38:58 +0000 (13:38 -0700)]
Split shill_proxy.py into shill_proxy.py and wifi_proxy.py

Move wifi specific functions into a new subclass WifiProxy of ShillProxy.
There are corresponding updates to references in autotest.

BUG=chromium:257142
TEST=None.

Change-Id: I52034fe3c8bbd504413ab63c5369aab024e1d98a
Reviewed-on: https://gerrit.chromium.org/gerrit/61127
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
13 months agoshill: Service: Implement "SetProperties" DBus call 75/60775/3
Paul Stewart [Tue, 2 Jul 2013 15:47:47 +0000 (08:47 -0700)]
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>

13 months agoshill: don't run dhcpcd and pppd simultaneously, for the same Cellular 28/60328/3
mukesh agrawal [Fri, 28 Jun 2013 07:25:13 +0000 (00:25 -0700)]
shill: don't run dhcpcd and pppd simultaneously, for the same Cellular

Some Cellular dongles expose both a network device (e.g. wwan0),
and a serial interface for ppp. Despite the presence of the network
device, they really want to be used as PPP devices.

Normally, we run dhcpcd on every network device, and terminate the
link if we are unable to acquire a DHCP lease. In the case of PPP
dongles, that causes us to tear down a totally functional link
after about 30 seconds. (The IP address is acquired using PPP
IPCP, and applied to the ppp0, or similar, interface.)

Avoid this problem, by a) not starting dhcpcd if pppd is already
running for the Cellular device, and b) stopping dhcpcd for the
Cellular device (if running), when we start pppd.

BUG=chromium:252516
TEST=new unit tests

Change-Id: I506413655ce44d36b3db0bd8e436340e5f5c20a9
Reviewed-on: https://gerrit.chromium.org/gerrit/60328
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
14 months agoshill: cellular: Properly translate errors from ModemManager. 96/60796/3
Arman Uguray [Tue, 2 Jul 2013 19:49:10 +0000 (12:49 -0700)]
shill: cellular: Properly translate errors from ModemManager.

The existing code that handled mapping some ModemManager errors to shill
API errors did not conform to the ModemManager1 API. This CL adds a new
static method to CellularError to handle ModemManager1 errors
separately.

BUG=chromium:248835
TEST=1. Build and run unit tests.
     2. Start the pseudomodem in locked mode (after stopping
        ModemManager and cromo).
     3. Use dbus-send or python to interact with the shill Device API
        directly. Use methods such as EnterPin with incorrect values and
        verify that the D-Bus error returned by shill are meaningful
        (e.g. entering an incorrect pin should return an error with the
        name 'org.chromium.flimflam.Error.IncorrectPin').

Change-Id: I0672595cf1db39491e7c946a3527ced80cff8ceb
Reviewed-on: https://gerrit.chromium.org/gerrit/60796
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: Arman Uguray <armansito@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
14 months agoshill: DHCPConfig: Report Web Proxy Auto Discovery 15/60015/4
Paul Stewart [Tue, 25 Jun 2013 22:29:40 +0000 (15:29 -0700)]
shill: DHCPConfig: Report Web Proxy Auto Discovery

Provide the Web Proxy Auto Discovery property displayed by the
DHCP client as a property to the ifconfig.  This will allow
Chrome to discover that value.

CQ-DEPEND=CL:59990
BUG=chromium:253915
TEST=New autotest network_DhcpWpadNegotiation
https://gerrit.chromium.org/gerrit/60020

Change-Id: I79521fd5873a2e7c2b2c4107e36545819a9a077d
Reviewed-on: https://gerrit.chromium.org/gerrit/60015
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>

14 months agoshill: Only reset service state before connect if it had failed priorly. 63/60263/3
Thieu Le [Thu, 27 Jun 2013 21:12:37 +0000 (14:12 -0700)]
shill: Only reset service state before connect if it had failed priorly.

BUG=chromium:213956
TEST=New unit tests, network_3GSafetyDance

Change-Id: I1227cd00df9105606d8056ca5b6bb5e2882a4f6f
Reviewed-on: https://gerrit.chromium.org/gerrit/60263
Reviewed-by: Arman Uguray <armansito@chromium.org>
Commit-Queue: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
14 months agoshill: L2TPIpsecDriver: Use PEM arrays for CACertPEM 57/60557/3
Paul Stewart [Fri, 28 Jun 2013 21:51:54 +0000 (14:51 -0700)]
shill: L2TPIpsecDriver: Use PEM arrays for CACertPEM

Switch the "CACertPEM" option to use a string array of PEM.
strongSwan is equally capable of accepting PEM and DER
certificates in its CA certificate store.  Since it's not easy
to export multiple certificates in a single DER file, use
a PEM file instead of DER for the output file in the CaCertPEM
case.  Since this is the last user of CreateDERFromString(),
remove this method from CertificateFile.  Since we no longer
generate DER, there is no longer a need for CertificateFile
to hold a GLib instance.

CQ-DEPEND=CL:60542
BUG=chromium:249363
TEST=Unit tests.

Change-Id: I9acde1f165006458ea0e1cd34e5037fad4784feb
Reviewed-on: https://gerrit.chromium.org/gerrit/60557
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
14 months agoshill: EAPCredentials: Use PEM arrays for CACertPEM 22/60522/3
Paul Stewart [Fri, 28 Jun 2013 21:51:54 +0000 (14:51 -0700)]
shill: EAPCredentials: Use PEM arrays for CACertPEM

Switch the "CACertPEM" option to use a string array of PEM.
wpa_supplicant is equally capable of accepting PEM and DER
certificates for its "ca_cert" option.  Since it's not easy
to export multiple certificates in a single DER file, use
a PEM file instead of DER for the output file in the CaCertPEM
case.

BUG=chromium:249363
TEST=Unit tests.

Change-Id: I3dd8389a3b099a368924459521f4978effe12b7a
Reviewed-on: https://gerrit.chromium.org/gerrit/60522
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
14 months agoshill: Service: Support string arrays in Configure 21/60221/7
Paul Stewart [Thu, 27 Jun 2013 14:39:25 +0000 (07:39 -0700)]
shill: Service: Support string arrays in Configure

Support conversion of string array parameters in
DBusAdaptor::ArgsToKeyValueStore(), so that in addition to SetProperty,
Manager functions like ConfigureService, GetService, etc, are passed
string array arguments.  In Service::Configure() and
Service::DoPropertiesMatch(), add string array properties to the
properties set / matched.

BUG=chromium:249363
TEST=Unit test.  As of https://gerrit.chromium.org/gerrit/59123,
network_VPNConnect now tests this code path (by setting CACertPEM
in the OpenVPN tests).

Change-Id: Ide3545e47c8c05b36c7ef3a41d83fbde7263404d
Reviewed-on: https://gerrit.chromium.org/gerrit/60221
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
14 months agoshill: OpenVPNDriver: Fix user authentication default setting 94/60294/6
Paul Stewart [Thu, 27 Jun 2013 23:51:11 +0000 (16:51 -0700)]
shill: OpenVPNDriver: Fix user authentication default setting

By default, OpenVPN is started with user authentication enabled
if no certificate credentials are given.  It is explicitly enabled
if either user authentication is explicitly enabled or if a username
is provided.  However until this change, if a pkcs11 certificate ID
was provided, OpenVPN would by default also use user authentication
even if no user credentials were provided.  This change disables
user authentication by default in the pkcs11 certificate ID case,
similar to certificate authentication.

BUG=chromium:249363
TEST=Unit test.  I ran into this problem while writing the TPM
flavor of the OpenVPN network_VPNConnect autotest, and verified
functionality using this test (as of https://gerrit.chromium.org/gerrit/60296)

Change-Id: Ia59ff7717d57d2fa0d350db1d78f50171cf05a26
Reviewed-on: https://gerrit.chromium.org/gerrit/60294
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>

14 months agocellular: Upload UMA stats for 3GPP delayed registration drop. 98/51398/5
Prathmesh Prabhu [Thu, 16 May 2013 00:17:33 +0000 (17:17 -0700)]
cellular: Upload UMA stats for 3GPP delayed registration drop.

crbug.com/238820 ensures that small glitches in 3GPP bearer registration
do not cause connection drop. These glitches were originally observed
for E362 modem. Upload UMA stats to figure out if the workaround should
be restricted to devices with E362.

BUG=chromium:241231
TEST=(1) build and run unit-tests.
     (2) Check that the following increments the value of
         the histogram Network.Shill.Cellular.3GPPRegistrationDelayedDrop in
         chrome://histograms on DUT.
         - Connect to cellular network on DUT.
         - Move the DUT to an area with bad reception, so that cellular
           connection is dropped.
         - Check that the histogram value for '0' is incremented and value for
           '1' remains unchanged.
     (3) Check that the following increments the value of
         the histogram Network.Shill.Cellular.3GPPRegistrationDelayedDrop in
         chrome://histograms on DUT.
         - Connect to cellular network on DUT.
         - Move the DUT to an area with bad reception so that signal strength
           goes down to 0. Return to an area with good reception within 10
           seconds.
         - Ensure that the cellular connection is never dropped.
         - Check that the histogram values for '0' and '1' are incremented.

Change-Id: Ic24ca0293226cefd4d334aec48a331a8b1f9b401
Reviewed-on: https://gerrit.chromium.org/gerrit/51398
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
14 months agoshill: Enhances a fatal error message. 48/60248/2
Wade Guthrie [Thu, 27 Jun 2013 18:22:38 +0000 (11:22 -0700)]
shill: Enhances a fatal error message.

BUG=None
TEST=unittest

Change-Id: I09c58ef80b5fd7d7f3b630cdef5d0ac5b7773b7a
Reviewed-on: https://gerrit.chromium.org/gerrit/60248
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
Commit-Queue: Wade Guthrie <wdg@chromium.org>

14 months agoshill: cellular: Recognize cellular devices using cdc_mbim driver. 85/60185/2
Ben Chan [Thu, 27 Jun 2013 06:37:16 +0000 (23:37 -0700)]
shill: cellular: Recognize cellular devices using cdc_mbim driver.

BUG=chromium:254820
TEST=Tested the following:
1. Build and run unit tests.
2. Verify that shill creates a Cellular object for a device using the
   cdc_mbim driver.

Change-Id: I6cf3b594ebca9991551dd9331bd01b18979d0b2c
Reviewed-on: https://gerrit.chromium.org/gerrit/60185
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
14 months agoshill: Adds UMA for scan-connect time. 71/57271/6
Wade Guthrie [Tue, 28 May 2013 17:16:25 +0000 (10:16 -0700)]
shill: Adds UMA for scan-connect time.

This metric covers time from start of scan through end of a successful
connect.

BUG=chromium:245807
TEST=unittest and manual.  For manual tests, do the following:

  1) reboot your chrome device
  b) browse to chrome://histograms
  iii) Verify that there's an entry for
       "Network.Shill.Wifi.TimeToScanAndConnect"

Change-Id: I3ef3f142c65b2e1d8449cf9b5405c63891261fc2
Reviewed-on: https://gerrit.chromium.org/gerrit/57271
Commit-Queue: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
14 months agoshill: Makes scan-type message a LOG(INFO) 92/59992/2
Wade Guthrie [Tue, 25 Jun 2013 23:18:32 +0000 (16:18 -0700)]
shill: Makes scan-type message a LOG(INFO)

As progressive scan gets rolled-out, it'll be really useful to know
whether a bug was seen in the presence of progressive or full scan.
This CL modifies the logging such that every shill-instigated scan is
logged with the scan type at the LOG(INFO) level.

BUG=None
TEST=unittest

Change-Id: I19763c84f5b4dda6a8a9daba056bfe1096064ccd
Reviewed-on: https://gerrit.chromium.org/gerrit/59992
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
14 months agoshill: cellular: Report first available retry count. 30/59930/2
Arman Uguray [Tue, 25 Jun 2013 17:28:02 +0000 (10:28 -0700)]
shill: cellular: Report first available retry count.

If no count is available for the current SIM lock type but some count is
available, report it, as it is better than reporting 999.

BUG=chromium:253988
TEST=Build and run unit tests.

Change-Id: I5f02b37cc3550561b44bc1313b535883d32cbc7e
Reviewed-on: https://gerrit.chromium.org/gerrit/59930
Reviewed-by: Thieu Le <thieule@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
Commit-Queue: Arman Uguray <armansito@chromium.org>

14 months agoshill-test-scripts: Increase cellular timeout in flimflam.py. 60/59960/2
Thieu Le [Tue, 25 Jun 2013 20:03:50 +0000 (13:03 -0700)]
shill-test-scripts: Increase cellular timeout in flimflam.py.

Some operations can take up to 60 seconds.

BUG=chromium:243988
TEST=network_3GSmokeTest

Change-Id: I56c96e0207c4e4a719b5547d22abbb9bba51cec3
Reviewed-on: https://gerrit.chromium.org/gerrit/59960
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Thieu Le <thieule@chromium.org>
Tested-by: Thieu Le <thieule@chromium.org>
14 months agoshill: Adds UMA metrics for scan termination reason. 75/57275/10
Wade Guthrie [Fri, 31 May 2013 16:23:30 +0000 (09:23 -0700)]
shill: Adds UMA metrics for scan termination reason.

BUG=chromium:245814
TEST=unittest and manual.  For manual tests, do the following:

  * reboot the machine (to force a scan)
  * navigate to chrome//histograms
  * verify that there's an entry for Network.Shill.WiFi.ScanResult

Change-Id: I36613ad1eb6682dfca880d94b11ec4eeacb442bc
Reviewed-on: https://gerrit.chromium.org/gerrit/57275
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
Commit-Queue: Wade Guthrie <wdg@chromium.org>

14 months agoshill: Replaces scan_pending_ with more scan states. Enhances output. 74/57274/6
Wade Guthrie [Wed, 29 May 2013 16:11:35 +0000 (09:11 -0700)]
shill: Replaces scan_pending_ with more scan states.  Enhances output.

As part of this CL, OnAfterResume is modified to cancel any on-going scan
and restart fast scan attempts.  This change was made to in this CL to
rectify issues raised when fixing unittests as a result of this change.
This change was made at all because it was recognized that a scan
(which, with progressive scan, is now a multi-state thing) should not
take place across an arbitrarily long suspend-resume cycle.

BUG=chromium:245814
TEST=unittest and manual.  For manual, on the chromebook:

  a) shell
  b) sudo bash
  c) stop shill
  d) shill --log-level=-10 --log-scopes=wifi
  e) look in /var/log/net.log for "Scan state:"  There should be an
     entry that looks like:

     wlan0: Scan state: IDLE -> (anything) @ 0ms in to scan.

Change-Id: I1c849e42737910016bdb2c72f6f0d092150902da
Reviewed-on: https://gerrit.chromium.org/gerrit/57274
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>
14 months agostop forcing -clang ourselves 93/59593/2
Mike Frysinger [Fri, 21 Jun 2013 19:07:24 +0000 (15:07 -0400)]
stop forcing -clang ourselves

We've integrated clang support into the cros-workon eclass, so packages
no longer need to set -clang themselves.

BUG=None
TEST=`emerge-x32-generic shill` no longer uses clang
TEST=`emerge-x86-alex shill` still uses clang

Change-Id: I9bac79b85eb82d11b2d01fcb7fd5398f635635db
Reviewed-on: https://gerrit.chromium.org/gerrit/59593
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>

14 months agoshill: add shell script to configure PPP username and password 14/59514/5
mukesh agrawal [Fri, 21 Jun 2013 02:13:58 +0000 (19:13 -0700)]
shill: add shell script to configure PPP username and password

This script provides the ability to set PPP username and password,
but only for Cellular services. It's a hold-over until we add
support for this in the Chrome networking UI.

BUG=chromium:246443
TEST=manual (see below)

Manual test
-----------
- plug in PPP dongle
- wait for cellular to connect
- /usr/bin/set_cellular_ppp
  -> "No PPP username."
- /usr/bin/set_cellular_ppp --username foo --password bar
- grep "Cellular.PPP.Username=foo" /var/run/shill/user_profiles/chronos/shill.profile
  -> should match
- grep "Cellular.PPP.Password=bar" /var/run/shill/user_profiles/chronos/shill.profile
  -> should match
- /usr/bin/set_cellular_ppp --clear
- grep "Cellular.PPP" /var/run/shill/user_profiles/chronos/shill.profile
  -> should NOT match

Change-Id: I68bed0522e3ebf54daf23e6a8e1d9c82eff30906
Reviewed-on: https://gerrit.chromium.org/gerrit/59514
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
14 months agoshill: fix profile-api documentation, remove stale comments in dbus_bindings 58/59458/2
mukesh agrawal [Thu, 20 Jun 2013 19:54:35 +0000 (12:54 -0700)]
shill: fix profile-api documentation, remove stale comments in dbus_bindings

Profile.DeleteEntry was documented as expecting a D-Bus path,
when, in fact, it takes a string.

While there, remove a stale comment about auto-generating the XML
files, and installing them to a system directory. The first can't
be done, because this XML is how we generate RPC stubs in the first
place; the second is already done in the Makefile.

BUG=None
TEST=emerge-link shill

Change-Id: I3dbd41ece19cbda147bf894f66b5b29a47b7651a
Reviewed-on: https://gerrit.chromium.org/gerrit/59458
Tested-by: mukesh agrawal <quiche@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>

14 months agoshill: Identify modem devices supported by the cdc_ncm driver. 26/59526/2
Ben Chan [Fri, 21 Jun 2013 05:16:56 +0000 (22:16 -0700)]
shill: Identify modem devices supported by the cdc_ncm driver.

This CL applies the same logic for checking cdc_ether devices to also
handle cdc_ncm devices.

BUG=chromium:252608
TEST=Tested the following:
1. Build and run unit tests.
2. Verify that shill correctly identifies a modem supported by the
   cdc_ncm driver.

Change-Id: I30f03add1b97f44d4f60683796e2dd9af906a33c
Reviewed-on: https://gerrit.chromium.org/gerrit/59526
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>

14 months agoshill: Times-out old netlink response handlers. 06/59306/5
Wade Guthrie [Wed, 12 Jun 2013 18:40:49 +0000 (11:40 -0700)]
shill: Times-out old netlink response handlers.

Adds a default timeout to all message response handlers.  Adds a 'type'
to auxilliary message handlers.  When/if a netlink message goes
unanswered (we don't receive a unicast response with the same serial
number) after the timeout (and there's no intervening sent message -- we
only timeout old handlers on message send), the axilliary message
handler is called with a 'type' of 'timeout' and the handler is deleted.

BUG=chromium:249028
TEST=unittest

Change-Id: I85e84a27acfaa6d9b6af6f25288056bda40a649b
Reviewed-on: https://gerrit.chromium.org/gerrit/59306
Commit-Queue: Wade Guthrie <wdg@chromium.org>
Reviewed-by: Wade Guthrie <wdg@chromium.org>
Tested-by: Wade Guthrie <wdg@chromium.org>