OSDN Git Service

android-x86/system-connectivity-wificond.git
7 years agoSupport fetching packet counters for wificond
Ningyuan Wang [Thu, 15 Sep 2016 17:53:07 +0000 (10:53 -0700)]
Support fetching packet counters for wificond

BUG=30978872
TEST=compile, manual tests

Change-Id: Ifa0dd9ce794a1cdb6da7e357d6873992091e3ea0

7 years agoMerge "Add 'get interfaces' to wificond Binder interface."
Treehugger Robot [Thu, 15 Sep 2016 23:55:09 +0000 (23:55 +0000)]
Merge "Add 'get interfaces' to wificond Binder interface."

7 years agoMerge "Handle 0 nla_len for DebugLog()"
Treehugger Robot [Thu, 15 Sep 2016 23:43:12 +0000 (23:43 +0000)]
Merge "Handle 0 nla_len for DebugLog()"

7 years agoAdd 'get interfaces' to wificond Binder interface.
Ningyuan Wang [Mon, 12 Sep 2016 17:49:45 +0000 (10:49 -0700)]
Add 'get interfaces' to wificond Binder interface.

This also adds the missing 'override' to enableSupplicant() and
disableSupplicant().

BUG=31430211
TEST=compile, manual tests

Change-Id: I23db45a41d1dcbf5d3294b50e94961eb2de6bf4a

7 years agoAdd a nl80211 helper function to get band info and scan capabilities
Ningyuan Wang [Mon, 12 Sep 2016 23:33:31 +0000 (16:33 -0700)]
Add a nl80211 helper function to get band info and scan capabilities

This also fixes a few lines of logging.

BUG=31458138
BUG=31429695
TEST=compile, manual tests

Change-Id: I309d9ce82eb80e79a97149bd16e1caf5e13d674b

7 years agoHandle 0 nla_len for DebugLog()
Ningyuan Wang [Tue, 13 Sep 2016 22:20:01 +0000 (15:20 -0700)]
Handle 0 nla_len for DebugLog()

This fixes the infinite loop caused by 0 nla_len.
This also fixes a typo.

BUG=None
TEST=compile, manual tests

Change-Id: I903d5d3f179a96f1105e0d66f26b59d473996dfe

7 years agoMerge "Broadcast interface changes through binder"
Ningyuan Wang [Mon, 12 Sep 2016 23:47:29 +0000 (23:47 +0000)]
Merge "Broadcast interface changes through binder"

7 years agoMerge "Retrieve list of attributes from a nested attribute"
Ningyuan Wang [Mon, 12 Sep 2016 21:23:05 +0000 (21:23 +0000)]
Merge "Retrieve list of attributes from a nested attribute"

7 years agoBroadcast interface changes through binder
Ningyuan Wang [Fri, 9 Sep 2016 20:15:37 +0000 (13:15 -0700)]
Broadcast interface changes through binder

This broadcasts interface ready/towndown events after we
create/remove an interface.

BUG=31349441
TEST=compile, unit tests
Change-Id: I8d4f20ddb82db1bb53d12f3feeb06d4e761be689

7 years agoMerge "Make failure to take ownership of firmware path fatal"
Treehugger Robot [Sat, 10 Sep 2016 00:33:09 +0000 (00:33 +0000)]
Merge "Make failure to take ownership of firmware path fatal"

7 years agoAdd binder interface for registering/unregistering interface changes
Ningyuan Wang [Fri, 9 Sep 2016 17:31:17 +0000 (10:31 -0700)]
Add binder interface for registering/unregistering interface changes

BUG=31349441
TEST=compile, unit tests
Change-Id: I0fa00ecdeec46246875f7de2479dab1470d102e5

7 years agoMake failure to take ownership of firmware path fatal
Christopher Wiley [Fri, 9 Sep 2016 20:29:44 +0000 (13:29 -0700)]
Make failure to take ownership of firmware path fatal

Bug: 31225859
Test: Can connect to wifi networks after this change.
Test: unit, integration tests pass
Change-Id: I79a2657d0a6898dc6db581b4c10d98adcb907bb1

7 years agoMerge "Add capability field to wificond scan result"
Ningyuan Wang [Fri, 9 Sep 2016 00:13:13 +0000 (00:13 +0000)]
Merge "Add capability field to wificond scan result"

7 years agoRetrieve list of attributes from a nested attribute
Ningyuan Wang [Tue, 6 Sep 2016 18:48:15 +0000 (11:48 -0700)]
Retrieve list of attributes from a nested attribute

This adds helper functions to retrieve a list of attribute
values or nested attributes from a nested attribute.
This helps us get all sub-attributes in one pass.

BUG=30901326
TEST=compile, unit tests, manual tests

Change-Id: I3f9090b65f8e08c2a2643b35ec6db3340e1effd2

7 years agoMerge "Return on invalid attribute length for DebugLog()"
Ningyuan Wang [Thu, 8 Sep 2016 22:01:21 +0000 (22:01 +0000)]
Merge "Return on invalid attribute length for DebugLog()"

7 years agoReturn on invalid attribute length for DebugLog()
Ningyuan Wang [Tue, 6 Sep 2016 21:52:55 +0000 (14:52 -0700)]
Return on invalid attribute length for DebugLog()

This fixes the case where |nla_len| is invalid and it causes
an infinite loop.

BUG=None
TEST=compile, manual tests

Change-Id: Ica24355618b144337a5731d57a57202c031472a5

7 years agoAdd capability field to wificond scan result
Ningyuan Wang [Wed, 31 Aug 2016 20:31:36 +0000 (13:31 -0700)]
Add capability field to wificond scan result

BUG=31157181
TEST=compile and manual test

Change-Id: I8c7cef6334a49eedd1060da6d417e771ed049916

7 years agoMerge "Use wrapper functions to simplify message response handling"
Treehugger Robot [Thu, 8 Sep 2016 21:37:02 +0000 (21:37 +0000)]
Merge "Use wrapper functions to simplify message response handling"

7 years agoFix looper unit tests
Ningyuan Wang [Tue, 6 Sep 2016 22:17:52 +0000 (15:17 -0700)]
Fix looper unit tests

|LooperBackedEventLoopStopWatchFdTest| sometimes fails because the
read_result has no initial value.

This patch fixes it and also gives initial value to all boolean
variables for readability.

BUG=None
TEST=unittests
Change-Id: I35c179b64fc262ebbe76469546d6c0158d125485

7 years agoMerge "Do not assert crash if FW_PATH can not be owned"
Dmitry Shmidt [Thu, 1 Sep 2016 00:24:36 +0000 (00:24 +0000)]
Merge "Do not assert crash if FW_PATH can not be owned"

7 years agoDo not assert crash if FW_PATH can not be owned
Dmitry Shmidt [Wed, 31 Aug 2016 23:21:40 +0000 (16:21 -0700)]
Do not assert crash if FW_PATH can not be owned

Bug: 29220405

Change-Id: Ia344193d22070c22d106ee948e9bc9735dcc7a3c
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
7 years agoUse wrapper functions to simplify message response handling
Ningyuan Wang [Wed, 31 Aug 2016 20:34:00 +0000 (13:34 -0700)]
Use wrapper functions to simplify message response handling

BUG=31111084
TEST=compile, unittests

Change-Id: I220719f94f768cd8dd9f3711347d3c399389fba0

7 years agoFix logging of GetInterfaceInfo() and GetWiphyIndex()
Ningyuan Wang [Wed, 31 Aug 2016 20:29:16 +0000 (13:29 -0700)]
Fix logging of GetInterfaceInfo() and GetWiphyIndex()

CleanUpSystemState() calls GetWiphyIndex() to mark down
any existing interfaces.
It should not be an ERROR if we find no wiphy/interface
at this time.

BUG=None
TEST=compile

Change-Id: I64c1f81625c4964b5ed8c501bd6f761cde883495

7 years agoDo not report error if no ssid is found in IE
Ningyuan Wang [Fri, 26 Aug 2016 22:47:29 +0000 (15:47 -0700)]
Do not report error if no ssid is found in IE

BUG=None
TEST=compile

Change-Id: I71b441728687faf167d417e50255322143c17f80

7 years agoMerge "Add wrapper functions of SendPacketAndGetResponses"
Ningyuan Wang [Fri, 26 Aug 2016 21:20:53 +0000 (21:20 +0000)]
Merge "Add wrapper functions of SendPacketAndGetResponses"

7 years agoAdd wrapper functions of SendPacketAndGetResponses
Ningyuan Wang [Thu, 25 Aug 2016 23:45:05 +0000 (16:45 -0700)]
Add wrapper functions of SendPacketAndGetResponses

This can help simplify the existing code of handling netlink
responses.

BUG=31111084
TEST=compile

Change-Id: I9a48ddb9af805c59c2733b7c1e2413b3f049edda

7 years agoAdd function StartScheduledScan()
Ningyuan Wang [Thu, 25 Aug 2016 22:47:23 +0000 (15:47 -0700)]
Add function StartScheduledScan()

This function starts scans repeatedly.
This is expected to be used to request Pno scans.

BUG=31067130
TEST=compile and manual tests

Change-Id: I6f0e0bc999197e84a8c6130c068204b305e71d2f

7 years agoMerge "Add function StopScheduledScan()"
TreeHugger Robot [Fri, 26 Aug 2016 20:46:54 +0000 (20:46 +0000)]
Merge "Add function StopScheduledScan()"

7 years agoMerge "Tear down system state on wificond startup"
TreeHugger Robot [Fri, 26 Aug 2016 20:32:44 +0000 (20:32 +0000)]
Merge "Tear down system state on wificond startup"

7 years agoAdd DebugLog() to NL80211NestedAttr
Ningyuan Wang [Thu, 25 Aug 2016 20:48:07 +0000 (13:48 -0700)]
Add DebugLog() to NL80211NestedAttr

BUG=None
TEST=compile, manual test

Change-Id: Id2dd18f937f6f9798723555f78c3f3e72b2440a8

7 years agoAdd function StopScheduledScan()
Ningyuan Wang [Wed, 24 Aug 2016 22:17:14 +0000 (15:17 -0700)]
Add function StopScheduledScan()

BUG=31067130
TEST=compile and manual tests

Change-Id: I81bccf991314ff9eb478e98d5c5db17d0561587a

7 years agoTear down system state on wificond startup
Christopher Wiley [Tue, 23 Aug 2016 20:48:21 +0000 (13:48 -0700)]
Tear down system state on wificond startup

Test: Added an integration test
Bug: 29620309

Change-Id: Ibf378dda9b6ca2dfa29cca3071d967a3e4f6b036

7 years agoUse mockable supplicant delegate
Christopher Wiley [Tue, 23 Aug 2016 17:56:06 +0000 (10:56 -0700)]
Use mockable supplicant delegate

This allows us to mock interactions with supplicant in unit tests.

Bug: 29620309
Test: unit/integration tests pass

Change-Id: I1526c90ffa9822a4d7dcabe5752676bfc61d6965

7 years agoDrop privileges and become wifi user during startup
Christopher Wiley [Mon, 22 Aug 2016 17:24:22 +0000 (10:24 -0700)]
Drop privileges and become wifi user during startup

Bug: 29870863
Test: Unit and integration tests pass

Change-Id: I939ad488eb3ad17cb2c166298e720f7d7b368f57

7 years agoSet AP interfaces down after stopping hostapd
Christopher Wiley [Tue, 23 Aug 2016 00:42:58 +0000 (17:42 -0700)]
Set AP interfaces down after stopping hostapd

This cleans up after we unceremoniously kill hostapd with SIGKILL.
It also guarantees that we don't continue beaconing after the death
of hostapd.

Test: Unit and integration tests pass
Bug: 31023120

Change-Id: I6a363bfdab81ea24a25d6a86a42ff4ccc99556dd

7 years agoFetch the mac address in GetInterfaceNameAndIndex
Roshan Pius [Tue, 23 Aug 2016 18:26:51 +0000 (11:26 -0700)]
Fetch the mac address in GetInterfaceNameAndIndex

Rename the |GetInterfaceNameAndIndex| function to
|GetInterfaceInfo| and fetch the mac address assigned to the interface
along with the other info being fetched.

BUG: 31038272
TEST: Modified existing tests
TEST: Manual tests on bullhead to see if the correct mac address is
fetched.

Change-Id: I89c11e2227ef9bdf90dfd681df09d8b8116cd53f

7 years agoGet rid of NL80211Packet copying
Ningyuan Wang [Fri, 19 Aug 2016 21:06:56 +0000 (14:06 -0700)]
Get rid of NL80211Packet copying

This CL removes all NL80211Packet copying by introducing the use of
unique_ptr on NL80211Packet objects.

The copy constructor is not explicitly deleted because it helps write
readable unit tests.

BUG=30901326
TEST=compile, unit tests, manual tests

Change-Id: I8dc9b42cacc3e929aa720abbd8ff0a3862b33bd3

7 years agoMerge changes I502fb470,I5bb0d98c
TreeHugger Robot [Fri, 19 Aug 2016 21:40:47 +0000 (21:40 +0000)]
Merge changes I502fb470,I5bb0d98c

* changes:
  Monitor scan results for current client interface
  Add helper functions to get and parse scan results

7 years agoMerge "Pass packet by reference to reduce copy operations"
Ningyuan Wang [Fri, 19 Aug 2016 18:32:06 +0000 (18:32 +0000)]
Merge "Pass packet by reference to reduce copy operations"

7 years agoMerge "Add a copy counters for netlink packet debugging"
Ningyuan Wang [Fri, 19 Aug 2016 18:32:06 +0000 (18:32 +0000)]
Merge "Add a copy counters for netlink packet debugging"

7 years agoMonitor scan results for current client interface
Ningyuan Wang [Thu, 18 Aug 2016 22:26:15 +0000 (15:26 -0700)]
Monitor scan results for current client interface

This CL includes the following changes:
  1. Add functions which can subscribe and unsubscribe scan results
  notification in ScanUtils, so we don't need to expose a NetlinkManager
  object to ClientInterfaceImpl.

  2. ClientInterfaceImpl subscribes the scan results when it is
  initialized. It unsubscribes the scan results when it is destroyed.

  3. ClientInterfaceImpl requests scan results objects using ScanUtils.
  In later CLs these objects are supposed to be sent to java framework
  through binder.

  4. Add corresponding mock classes and unit tests adjustment for the
  changes above.

This CL won't enable the scan results monitoring unless we uncomment
SubscribeToEvents() in NetlinkManager::Start().

BUG=30896985
TEST=compile, unit tests, manual tests
Manual test:
  1. Uncomment SubscribeToEvents() in NetlinkManager::Start().
  2. Call ScanResult::DebugLog() in ClientInterfaceImpl::
  OnScanResultsReady().
  After 1 and 2 we can see detail scan results in wificond logs.

Change-Id: I502fb4704ffce4dd2bf8de8d0d5d9293b2b43d9a

7 years agoAdd helper functions to get and parse scan results
Ningyuan Wang [Wed, 17 Aug 2016 17:22:46 +0000 (10:22 -0700)]
Add helper functions to get and parse scan results

GetScanResult() is used for request the newest scan results from kernel.
ParseScanResult() is used for converting scan result packet to a scan
result object.
This CL also moves all the scanning helper functions to a new file.

BUG=30896985
TEST=manual tests
TEST=unit tests

Change-Id: I5bb0d98cb62daf9cc02da31a7cdf42f0c9fff16c

7 years agoPass packet by reference to reduce copy operations
Ningyuan Wang [Wed, 17 Aug 2016 21:32:26 +0000 (14:32 -0700)]
Pass packet by reference to reduce copy operations

With this change, along with ag/1333902 the copy counter is
reduced from 14 to 5, for the entire booting process.

BUG=30901326
TEST=unit tests

Change-Id: Ie7f46b6ca1663a00d1703d567b2de35259bfd13a

7 years agoMerge "Add the ability to start/stop supplicant to wificond"
TreeHugger Robot [Thu, 18 Aug 2016 17:21:55 +0000 (17:21 +0000)]
Merge "Add the ability to start/stop supplicant to wificond"

7 years agoAdd a copy counters for netlink packet debugging
Ningyuan Wang [Wed, 17 Aug 2016 22:13:02 +0000 (15:13 -0700)]
Add a copy counters for netlink packet debugging

Copy operation of NL80211Packet copies the entire buffer. This
costs a lot resouces. We should avoid it as much as we can.

This CL adds a static variable in NL80211Packet tracking the number
of copy operations, as well as another counter tracking the bytes of
we copied. This help us debug wificond netlink performance issues.

BUG=30901326
TEST=manual tests

Change-Id: I5be04ff977b5ffd7340a98d435a5703b0b79be28

7 years agoMerge "Add function for triggering scan"
TreeHugger Robot [Thu, 18 Aug 2016 16:29:30 +0000 (16:29 +0000)]
Merge "Add function for triggering scan"

7 years agoAdd function for triggering scan
Ningyuan Wang [Tue, 16 Aug 2016 23:49:51 +0000 (16:49 -0700)]
Add function for triggering scan

This adds a function scan() to send a 'trigger scan' message to kernel.

BUG=30643703
TEST=manual tests

Change-Id: I8be2d8a033f38ca66fd29cc4a7135c8526985032

7 years agoDisable wificond scan result monitoring for now
Ningyuan Wang [Wed, 17 Aug 2016 16:52:58 +0000 (09:52 -0700)]
Disable wificond scan result monitoring for now

This disbales the scan result monitoring of wificond.
We will re-enable it when the integration finishes, otherwise
wificond will silently using CPU/Memory to parse scan results.

BUG=None
TEST=unit tests

Change-Id: Iaa50fd4f2f6b7f60dbfcec08f59e21b539c603bc

7 years agoMerge "Add a helper function for logging scan result"
TreeHugger Robot [Wed, 17 Aug 2016 00:51:59 +0000 (00:51 +0000)]
Merge "Add a helper function for logging scan result"

7 years agoMerge "Get SSID from information element"
TreeHugger Robot [Wed, 17 Aug 2016 00:30:59 +0000 (00:30 +0000)]
Merge "Get SSID from information element"

7 years agoAdd a helper function for logging scan result
Ningyuan Wang [Tue, 16 Aug 2016 20:05:08 +0000 (13:05 -0700)]
Add a helper function for logging scan result

This function is only used for debugging now.

Example output:
Scan result:
SSID: GoogleGuest
BSSID: 6c:f3:7f:af:fa:b1
FREQUENCY: 5220
SIGNAL: -86dBm
TSF: 23486915

BUG=30746278
TEST=manual tests

Change-Id: Ia504a0e18723dcbffcd3d8da0920d1ea2238af70

7 years agoGet SSID from information element
Ningyuan Wang [Tue, 16 Aug 2016 20:23:09 +0000 (13:23 -0700)]
Get SSID from information element

Scan result netlink message doesn't provide SSID directly.
It provides raw information elemnt array, which contains SSID.
This helper function can get SSID from that array.

BUG=30896985
TEST=manul tests

Change-Id: I38f43a3528ddddbdc052333e5d0e15875517c89e

7 years agoCreate functions to handle scan result notification
Ningyuan Wang [Fri, 12 Aug 2016 20:42:02 +0000 (13:42 -0700)]
Create functions to handle scan result notification

BUG=30737305
TEST=compile, unit tests, integration tests

Change-Id: I763db062ccb59b71ee358723b8285e1c5f2f8aa2

7 years agoAdd the ability to start/stop supplicant to wificond
Christopher Wiley [Wed, 10 Aug 2016 16:33:45 +0000 (09:33 -0700)]
Add the ability to start/stop supplicant to wificond

Introduce two new methods:

enableSupplicant()
disableSupplicant()

to IClientInterface.  These are used to start/stop
wpa_supplicant from controlling a given interface.
Today, they start/stop the wpa_supplicant service, but
in the future we may use them to add/remove the interface
from supplicant's control.

Bug: 30666540
Test: Can still connect to WiFi on bullhead.

Change-Id: I25fe9e7e5f2e3764cd38cf89902dffd957b474ee

7 years agoMerge "Get interface index from kernel for wificond"
TreeHugger Robot [Sat, 13 Aug 2016 00:38:37 +0000 (00:38 +0000)]
Merge "Get interface index from kernel for wificond"

7 years agoMerge changes I31237daf,Ie4c8eb49
Roshan Pius [Fri, 12 Aug 2016 21:24:25 +0000 (21:24 +0000)]
Merge changes I31237daf,Ie4c8eb49

* changes:
  wpa_supplicant_binder_test: Add reconnect tests
  wpa_supplicant_binder_test: Simple connect tests

7 years agoGet interface index from kernel for wificond
Ningyuan Wang [Thu, 11 Aug 2016 16:59:22 +0000 (09:59 -0700)]
Get interface index from kernel for wificond

This CL adds the interface index query to interface name query.

With interface index wificond can assign scan request to specific
interface and ignore scan result from uninteresting interfaces.

BUG=30808053
TEST=compile, unit tests, integration tests

Change-Id: I2a6333dcad4e9faadb7793501762602017125865

7 years agoMerge "Create a ScanResult class for wificond internal use"
TreeHugger Robot [Fri, 12 Aug 2016 21:16:59 +0000 (21:16 +0000)]
Merge "Create a ScanResult class for wificond internal use"

7 years agoCreate a ScanResult class for wificond internal use
Ningyuan Wang [Wed, 10 Aug 2016 21:40:04 +0000 (14:40 -0700)]
Create a ScanResult class for wificond internal use

An object of this class is used for storing the scan result
of a BSS.

More fields will added to this class if it is neccessary.
Future parcelable scan result class is expected to inherit
from this class.

BUG=30746278
TEST=compile

Change-Id: I5d65a6eb51e4ffdd8b92345eef6a51de61aab236

7 years agowpa_supplicant_binder_test: Add reconnect tests
Roshan Pius [Thu, 11 Aug 2016 18:21:27 +0000 (11:21 -0700)]
wpa_supplicant_binder_test: Add reconnect tests

Create a base class for all connect tests and add a
test which exercies the new iface methods:
1. IIface.Disconnect
2. IIface.Reconnect

BUG: 30667354
TEST: Ran
/data/nativetest/wpa_supplicant_binder_test/wpa_supplicant_binder_test

Change-Id: I31237dafbcbc276feef7a2814d2246f0069c12e4

7 years agowpa_supplicant_binder_test: Simple connect tests
Roshan Pius [Thu, 4 Aug 2016 22:19:56 +0000 (15:19 -0700)]
wpa_supplicant_binder_test: Simple connect tests

Add a new test file for connection tests. All the tests in this file
parse a json formatted |NetworkParams| structire from command line args.

Changes in the CL:
1. Store any incoming test args in a global |kGlobalTestArgs| variable.
These can be used by the tests as needed.
2. Add a data type |NetworkParams| which is used to deserialize json
formatted command line args to parameters that can be used to connect to
a network.
3. Add a simple connect/disconnect using the above.

BUG: 30667354
TEST: Initiated connection to open/psk networks around.
Open Networks:
/data/nativetest/wpa_supplicant_binder_test/wpa_supplicant_binder_test
'{\"NetworkParams\":{\"ssid\":\"<SSID>\"}}'
PSk Networks:
/data/nativetest/wpa_supplicant_binder_test/wpa_supplicant_binder_test
'{\"NetworkParams\":{\"ssid\":\"<SSID>\",\"psk_passphrase\":\"<PSK>\"
,\"key_mgmt\":2}}'

Change-Id: Ie4c8eb49ea5f10bfd7ba3cde19aac87ab3c85e64

7 years agoProcess all responses to queries for interface name
Christopher Wiley [Wed, 10 Aug 2016 19:10:37 +0000 (12:10 -0700)]
Process all responses to queries for interface name

Sometimes the kernel will tell us about unexpected network devices (e.g.
p2p devices without a real netdev backing them).

Also added a quick facility to log these packets in excruciating detail.
This should only be used for debugging.

Bug: 30773545
Test: angler can now configure client network interfaces in this state.
      added a unittest

Change-Id: I5423acd7dc6177f73e54150e5ef734d15703163d

7 years agoMerge "Support receiving broadcast for NetlinkManager"
TreeHugger Robot [Tue, 9 Aug 2016 22:32:47 +0000 (22:32 +0000)]
Merge "Support receiving broadcast for NetlinkManager"

7 years agoSupport receiving broadcast for NetlinkManager
Ningyuan Wang [Thu, 4 Aug 2016 22:49:09 +0000 (15:49 -0700)]
Support receiving broadcast for NetlinkManager

BUG=30737305
TEST=unit tests and integration tests

Change-Id: Ia9fb32d428970560452949b6f980b634a48c84e4

7 years agoMerge "Add unit tests for NetlinkUtils"
TreeHugger Robot [Tue, 9 Aug 2016 18:39:17 +0000 (18:39 +0000)]
Merge "Add unit tests for NetlinkUtils"

7 years agoAdd unit tests for NetlinkUtils
Ningyuan Wang [Wed, 3 Aug 2016 20:14:29 +0000 (13:14 -0700)]
Add unit tests for NetlinkUtils

This creates unit tests for helper class NetlinkUtils.
This also creates mock classes for NetlinkManager and EventLoop.

BUG=30642046
TEST=unit tests and integration tests

Change-Id: Idc3cea812e700af8a1727c380ec92cfc1f364e28

7 years agoMerge "Fix netlink errno parsing"
TreeHugger Robot [Mon, 8 Aug 2016 19:48:33 +0000 (19:48 +0000)]
Merge "Fix netlink errno parsing"

7 years agoFix netlink errno parsing
Ningyuan Wang [Thu, 4 Aug 2016 20:12:08 +0000 (13:12 -0700)]
Fix netlink errno parsing

Kernel uses negative errno for nl80211 messages.

BUG=None
TEST=compile and manual tests

Change-Id: I50f5fa82ec946f8121c846017023a76e3597589e

7 years agowpa_suppplicant_binder_test: Restructure tests
Roshan Pius [Thu, 4 Aug 2016 18:02:55 +0000 (11:02 -0700)]
wpa_suppplicant_binder_test: Restructure tests

Restructure the existing tests before adding simple connect tests.
Move the test base class and it's dependencies into a separate file
test_base.cpp & test_base.h. The original tests.cpp will only hold the
actual tests now and will add a separate |connect_tests.cpp| for
connection tests which will need some additional parsing of input args.

BUG: 30667354
Change-Id: I7c8a5e3d7ca3a291c35ad51cb2d9d4b62adeda8f
TEST: Ran existing tests.

7 years agowpa_supplicant_binder_test: Set/Get Network params
Roshan Pius [Fri, 29 Jul 2016 22:35:24 +0000 (15:35 -0700)]
wpa_supplicant_binder_test: Set/Get Network params

Add integration tests for network params set/get methods.

BUG: 1252274
Change-Id: I4b02bcff5c2d46d42cdd96524580bf7d1f521858
TEST: adb shell /data/wpa_supplicant_binder_test
--gtest_filter=*SetGet*

7 years agoSeperate netlink util functions to NL80211Utils
Ningyuan Wang [Mon, 1 Aug 2016 18:04:22 +0000 (11:04 -0700)]
Seperate netlink util functions to NL80211Utils

This creates a new clas NetlinkUtils and moves two util
functions GetWiphyIndex() and GetInterfaceName() from
NelinkManager to NetlinkUtils.

BUG=30565670
TEST=unit tests and integration tests

Change-Id: I713d4388e688f5235b7fbf61c7b9ea9341d667db

7 years agoMerge changes I1960dfc7,I82b5eb43
Roshan Pius [Wed, 3 Aug 2016 17:17:00 +0000 (17:17 +0000)]
Merge changes I1960dfc7,I82b5eb43

* changes:
  binder_dispatcher: Prevent test flakes
  Add iface/network addition/removal callback tests

7 years agobinder_dispatcher: Prevent test flakes
Roshan Pius [Tue, 26 Jul 2016 16:30:01 +0000 (09:30 -0700)]
binder_dispatcher: Prevent test flakes

Loopers & binder fd instances are sticky on a given thread. So, every
test with a new instance of |BinderDispatcher| still share the same
looper & fd instances which could lead to potential leakage of events
across tests.

Changes in the CL:
1. Stop using |PostDelayed| task to enforce the wait timeout. This could
leave behind a stale message which might affect any future tests. So,
revert back to the original design of processing each event and then
checking if the |elapsed_time| has crossed over the |timeout|.
2. In the destructor of |BinderDispatcher|, destroy the |ProcessState|
instance to trigger cleanup of the binder driver.

While there,
Flip the |needs_init| flag usage to correctly reflect the name of the
variable.

BUG: 30122642
Change-Id: I1960dfc782c6b93dcb591964b5b6cc9a984a536a
TEST: All tests run successfully.

7 years agoAdd iface/network addition/removal callback tests
Roshan Pius [Thu, 21 Jul 2016 15:56:41 +0000 (08:56 -0700)]
Add iface/network addition/removal callback tests

Use the |BinderDispatcher| module to verify callbacks from
wpa_supplicant for interface/network addition/removal.

BUG: 30093041
Change-Id: I82b5eb432b7c355407c3c383960b0d1258cc76ae
TEST: /data/wpa_supplicant_binder_test

7 years agoAdd support for creating client interfaces
Christopher Wiley [Wed, 27 Jul 2016 20:48:22 +0000 (13:48 -0700)]
Add support for creating client interfaces

Bug: 30041062
Test: unit/integration tests pass

Change-Id: I48a0adc338e474085c399750441198a4acae2cf5

7 years agoMerge "Move integration tests for IApInterface to their own file"
TreeHugger Robot [Tue, 2 Aug 2016 15:51:08 +0000 (15:51 +0000)]
Merge "Move integration tests for IApInterface to their own file"

7 years agoMerge "Add script to run related unit tests"
Christopher Wiley [Tue, 2 Aug 2016 15:50:35 +0000 (15:50 +0000)]
Merge "Add script to run related unit tests"

7 years agoMerge "Give hostapd a hint that it is about to die"
Christopher Wiley [Tue, 2 Aug 2016 15:49:57 +0000 (15:49 +0000)]
Merge "Give hostapd a hint that it is about to die"

7 years agoHandle control messages for NetlinkManager
Ningyuan Wang [Thu, 28 Jul 2016 22:44:10 +0000 (15:44 -0700)]
Handle control messages for NetlinkManager

BUG=30508758
TEST=compile
TEST=unittests and intergration tests still pass

Change-Id: I6de34a4b3b7537e68a74810e4416735bc69ba3b3

7 years agouse DISALLOW_COPY_AND_ASSIGN for NetlinkManager
Ningyuan Wang [Fri, 29 Jul 2016 23:18:00 +0000 (16:18 -0700)]
use DISALLOW_COPY_AND_ASSIGN for NetlinkManager

BUG=None
TEST=compile

Change-Id: I34d979561c85c754e8af4c06954d19b5f7153799

7 years agoMerge "Get interface name for server"
Ningyuan Wang [Fri, 29 Jul 2016 22:29:15 +0000 (22:29 +0000)]
Merge "Get interface name for server"

7 years agoAdd IsStarted() to NetlinkManager
Ningyuan Wang [Fri, 29 Jul 2016 17:47:06 +0000 (10:47 -0700)]
Add IsStarted() to NetlinkManager

This is useful to prevent multiple Start() on a NetlinkManager
obejct.

BUG=29454786
TEST=compile
TEST=unittests and intergration tests still pass

Change-Id: I006d6d9d229b16d42670534518703d9f20e602ec

7 years agoMove integration tests for IApInterface to their own file
Christopher Wiley [Thu, 21 Jul 2016 16:06:33 +0000 (09:06 -0700)]
Move integration tests for IApInterface to their own file

Move existing tests related to IApInterface to a new file.
Add additional test coverage to exercise IApInterface.

Bug: 30040724
Test: These tests pass.  Unfortunately, hostapd start/stop
      is still not as reliable as we'd like.

Change-Id: I08956798c917cf6abf09ab44c48b3588c61c8de5

7 years agoAdd script to run related unit tests
Christopher Wiley [Fri, 29 Jul 2016 17:59:00 +0000 (10:59 -0700)]
Add script to run related unit tests

This helps us believe we're going to pass continuous testing.

Bug: 30501113
Change-Id: I053ae37fa80c5e75186a07e259a1d6609dbdf4ce
Test: This script reliably runs tests.

7 years agoGive hostapd a hint that it is about to die
Christopher Wiley [Thu, 28 Jul 2016 22:07:47 +0000 (15:07 -0700)]
Give hostapd a hint that it is about to die

Give hostapd SIGTERM and some time do take itself down
before dropping SIGKILL on it.  This is blocking, and
we'll eventually replace it with an asynchronous interface
but it keeps us healthy for now.

Bug: 30311493
Change-Id: Iadbd3a4fd5c49c42d9bba12f19cfcd65ee567a67
Test: Integration tests finally pass reliably

7 years agoGet interface name for server
Ningyuan Wang [Thu, 28 Jul 2016 00:38:32 +0000 (17:38 -0700)]
Get interface name for server

This CL adds a util function on NetlinkManager for getting
interface name from kernel.

Server uses this function after driver and firmware reloading
to verify the interface is set up correctly.

BUG=29454786
TEST=unit tests and intergration tests

Change-Id: Ib8cea0e7cb744be428ddaf96b6d50f10a6cea255

7 years agoDo not use callback parameter for synchronous NL80211 interface
Ningyuan Wang [Thu, 28 Jul 2016 00:08:07 +0000 (17:08 -0700)]
Do not use callback parameter for synchronous NL80211 interface

BUG=29454786
TEST=compile
TEST=unittests and intergration tests still pass

Change-Id: Ibaf15c82035837b73021c70922e96f870fcec36b

7 years agoGet wiphy index using NL80211 messages
Ningyuan Wang [Thu, 21 Jul 2016 18:12:10 +0000 (11:12 -0700)]
Get wiphy index using NL80211 messages

Add utils functions in NetlinkManager to get wiphy index.
wificond should refresh wiphy index using those utils after
reloading the driver.

BUG=29454786
TEST=compile
TEST=unittests and intergration tests still pass

Change-Id: I303ac6b81ab3650acfb7a823cb0b423f55d373b4

7 years agoMerge "Add function StopWatchFileDescriptor() to event_loop"
TreeHugger Robot [Wed, 27 Jul 2016 22:50:05 +0000 (22:50 +0000)]
Merge "Add function StopWatchFileDescriptor() to event_loop"

7 years agoAdd function StopWatchFileDescriptor() to event_loop
Ningyuan Wang [Tue, 26 Jul 2016 20:45:57 +0000 (13:45 -0700)]
Add function StopWatchFileDescriptor() to event_loop

This add a function StopWatchFileDescriptor() to wificond
event_loop implementation.

This function is useful when we need to clean up old fds.

This also adds the corresponding unit tests, and fixes a few
typing problems in looper unit tests.

BUG=30442552
TEST=compile
TEST=unit tests

Change-Id: I787670c26f0389d5060362454c55525629494023

7 years agoUpdate netlink timeout value
Ningyuan Wang [Tue, 26 Jul 2016 17:54:24 +0000 (10:54 -0700)]
Update netlink timeout value

android.net.ip uses 300ms as a waiting timeout for
netlink requests.
This CL updates the value according to that.
while there fixes a typo.

BUG=29454786
TEST=compile
TEST=unit tests and intergration tests

Change-Id: I9e7b1b5ed282499cdd2bd637bc9e2a39d35ded67

7 years agoAdd a module for binder callback handling in tests
Roshan Pius [Thu, 21 Jul 2016 15:55:25 +0000 (08:55 -0700)]
Add a module for binder callback handling in tests

Add a new module |BinderDispatcher| to wait for callback events
from |wificond| & |wpa_supplicant|.
The new module provides 2 public methods:
1. |DispatchFor()|: Will be invoked from the body of the test to
process all incoming binder events until |InterruptDispatch|.
2. |InterruptDispatch()|: Will be invoked from the binder object
to indicate the occurence of an event.

PS: Opted against using a multi-threaded approach here because we
anyway need to block the main thread until the callback is received.

BUG: 30122642
Change-Id: Ibfff79977bcf51942b5a67eb5b345be433ec9cc8

7 years agoControl hostapd from IApInterface
Christopher Wiley [Mon, 18 Jul 2016 22:30:58 +0000 (15:30 -0700)]
Control hostapd from IApInterface

Add AIDL interfaces, implementation, and tests to wificond.

Bug: 30040724
Test: unitests pass
Test: integration tests pass

Change-Id: I75339d64bf92941de26c7552b6b711cbea00eb80

7 years agoMove process utilities to process_utils.cpp
Christopher Wiley [Wed, 20 Jul 2016 18:09:32 +0000 (11:09 -0700)]
Move process utilities to process_utils.cpp

These are handy for a number of other tests.

Bug: 30040724
Change-Id: I5510b0df39831c8df842d6d7c9d55ea51a2b8c0b
Test: Compiles, unit/integration tests pass

7 years agoUse different sockets for synchronous and asynchrouns netlink interface
Ningyuan Wang [Tue, 19 Jul 2016 18:09:45 +0000 (11:09 -0700)]
Use different sockets for synchronous and asynchrouns netlink interface

NetlinkManager provides an interface synchronously waiting for netlink
reply.
In order not to bring in complexity of message rescheduling we use
different sockets for synchrounous and asynchrounous interfaces.

BUG=29454786
TEST=compile
TEST=unittests pass and wificond can still get nl80211 family id

Change-Id: I3fd693882d6e1734c3ee7f470b17ffc05152f28b

7 years agoMerge "Create NetlinkManager instance"
TreeHugger Robot [Wed, 20 Jul 2016 18:29:23 +0000 (18:29 +0000)]
Merge "Create NetlinkManager instance"

7 years agoCreate NetlinkManager instance
Ningyuan Wang [Mon, 18 Jul 2016 23:27:39 +0000 (16:27 -0700)]
Create NetlinkManager instance

BUG=29454786
TEST=compile
TEST=unittests

Change-Id: I1834cc558282ec15f92ce846e5e6921151aa64ed

7 years agoMerge "Change netlink message receive buffer size"
Ningyuan Wang [Wed, 20 Jul 2016 16:58:57 +0000 (16:58 +0000)]
Merge "Change netlink message receive buffer size"

7 years agoChange netlink message receive buffer size
Ningyuan Wang [Tue, 19 Jul 2016 20:32:47 +0000 (13:32 -0700)]
Change netlink message receive buffer size

TEST=compile
BUG=30167405

Change-Id: Ifbe39350f852978873a1858791d922d54ad75afe

7 years agoFix integration tests to not expect binder exceptions
Christopher Wiley [Tue, 19 Jul 2016 14:56:55 +0000 (07:56 -0700)]
Fix integration tests to not expect binder exceptions

We removed these exceptions in favor of a null binder from
createApInterface().

Bug: 30159593
Change-Id: I5789676df7068dfc01e6106321412c312fa1283b