Commit Graph

63 Commits

Author SHA1 Message Date
Roshan Pius fc03e50498 wificond: Add debug logs
Unable to repro the corresponding bug. Adding logs to help debug the
issue.

Bug: 177936058
Test: Manual connection to wifi, toggle wifi off/on.
Change-Id: I88af48dbc6ee215cb6ff6c545297d434686c6c1b
2021-01-19 15:25:16 -08:00
David Su 3a8f36348d wificond: don't delete wiphy immediately upon iface deletion
- Multiple ifaces can map to one wiphy.
- One band can only map to one wiphy.

Previously, if any iface was removed, all wiphy's associated
with that iface will also be removed, including all
associated bands. This is not correct, as there could also
be other ifaces associated with that wiphy which are still
active.

Fixed to only remove the wiphy (and associated bands) once
no active ifaces remain for that wiphy.

Also, cleaned up weird idiom of deleting from a map while
iterating over it (no change in behavior intended).

Bug: 175614847
Test: system/connectivity/wificond/runtests.sh
Test: 1. Connect to network1 on device1.
      2. Turn on SAP for network2 on device2.
      3. Since device1 prefers network1 (configured ahead of time with user
         connect choice), it will connect to network2 using Make-Before-Break
         (MBB).
      4. After MBB completes and network1 is disconnected, turn off SAP.
      5. device1 will disconnect from network2.
      6. Verify scans are triggered and connects back to network1.
Change-Id: Ie8d2f6e12a350501dee82d6bdde3501afc556d69
2020-12-15 09:00:05 -08:00
Jimmy Chen b08ea66f49 wifi: fix use-after-free case
Bug: 168319879
Test: system/connectivity/wificond/runtest.sh
Change-Id: Ib8cbd6c9e152d736f7e4f596608ac9b069da1877
2020-09-16 10:53:33 +08:00
Jimmy Chen eed3ad38ca wificond: support 60GHz band
Add 60G channels list to BandInfo.
Add getAvailable60gChannels for retrieving the 60g channels.

Bug: 147522434
Test: system/connectivity/wificond/runtests.sh
Change-Id: Ice1abf3d4345b80560cbbc2b3207889ca4fb6f8f
2020-09-10 12:33:43 +08:00
Jimmy Chen 30a31286aa wificond: support multiple scan interfaces
Add a map for keeping unique wiphy index per interface.
This is needed in order to support multiple interfaces
from different chips, since each chip will have a
different wiphy index.

Bug: 147522434
Test: system/connectivity/wificond/runtests.sh
Change-Id: I2bdea0547aa145e52507c788a46390514f582d25
2020-08-25 10:44:35 +08:00
Jooyung Han 78ac2cc2b4 Use optional for nullable types
AIDL generates optional<T> for nullable T types for C++, which is more
efficient and idomatic and easy to use.

Bug: 144773267
Test: build/flash/boot
Change-Id: Iac0c34e10bc09f1230d0a941b05618671cbcbb5e
2020-02-19 15:18:26 +09:00
Etan Cohen 067e1194a3 [WifiNl80211] Rename WifiNl80211Manager namespace
Finish the renaming process from wificond -> nl80211.

Bug: 149105833
Test: atest android.net.wifi
Test: atest com.android.server.wifi
Test: system/connectivity/wificond/runtest.sh
Change-Id: Ia430e0c669758c46fca407723db30e076a018729
2020-02-15 17:37:33 -08:00
Ahmed ElArabawy 80f1b5216a Add parameters to device wiphy capabilities
This commit adds the following parameters to DeviceWiphyCapabilities:
1. Support of 160MHz / 80+80MHz channel width
2. Max number of Tx/Rx spatial streams.
Note that this commit does not fill those parameters from the device
NL80211 response. A separate CL should take care of this.

Bug: 144576344
Test: Manual
Change-Id: Id3f9e1ad43a576adec869d485d1001c806c34bcf
2020-01-18 23:39:28 -08:00
Ahmed ElArabawy ec905e608e Add support for query for device phy cpabilities
This commits adds support for query for device wiphy capabilities.

Bug: 143543900
Bug: 134688244
Bug: 144576344
Test: Manual
Change-Id: Iebb1e748d3c07624b2bb7fbfe5eacc66d9693491
2020-01-17 09:55:16 -08:00
Etan Cohen 3c826e5a75 [wificond] Move to wificond namespace
Move the rest of the code to the wifi.wificond namespace from the
wifi namespace. Cleanup since wificond is outside the Wi-Fi module.

Non-functional change.

Bug: 140062898
Test: atest android.net.wifi
Test: atest com.android.server.wifi
Test: ./system/connectivity/wificond/runtests.sh
Test: (CTS) atest android.net.wifi.cts
Change-Id: I257cabf92f0046214331616b381981f789933a87
2019-12-20 15:51:21 -08:00
Ahmed ElArabawy f9bd54d9ad Support 6GHz band for getAvailableChannels() API
This commit adds support for 6GHz band for providing a list of available
channels for a specific band. This is used by the system API
getAvailableChannels().

Bug: 139354972
Test: Manual
Test: ./system/connectivity/wificon/runtests.sh
Change-Id: I99c03015b59867e2690477962726d599eeb51c0b
2019-12-04 13:34:18 -08:00
Etan Cohen 9ef85b7794 Revert "Moved from wificond AIDL to com.android.server.wifi.wificond"
This reverts commit d61114cd73.

Change-Id: I3adea9db600b44e10d3829e5cc96e644debac350
2019-11-27 20:09:17 -08:00
David Su d61114cd73 Moved from wificond AIDL to com.android.server.wifi.wificond
Moved wificond AIDL from android.net.wifi to
com.android.server.wifi.wificond since android.net.wifi
should only be used for external APIs to apps.

Bug: 140062898
Test: ./runtest.sh
Change-Id: Ib7cf128ca584e1432073304aa77e8b78eaf663f1
2019-08-29 14:10:59 -07:00
Neo Jou 226d7e6f96 STA/AP Concurrency fails with the wifi which has multiple phy am: 3e76438803 am: f8f093ee02
am: 20d7a84f54

Change-Id: Ie43f14616ed19b248892b4e2d2ed4ea40e915f20
2019-01-30 10:06:36 -08:00
Neo Jou 3e76438803 STA/AP Concurrency fails with the wifi which has multiple phy
As the issue tracker: https://issuetracker.google.com/issues/122429718

    The current Android P framework doesn't support the wifi devices with
    multiple phy's.

    Suppose that the wifi has two or more wiphys.
    (e.g. wlan0 - phy#0 - ifindex 6, and wlan1 - phy#1 - ifindex 8)

    And the system is built with
        WIFI_HIDL_FEATURE_DUAL_INTERFACE := true
        PRODUCT_PROPERTY_OVERRIDES += wifi.interface=wlan0
        PRODUCT_PROPERTY_OVERRIDES += wifi.concurrent.interface=wlan1

    At first, we connected to one AP successfully, and then we tried
    to start hotspot, but the hotspot can not be enabled.

    After checking, we found that in the Android P source code,
    setupInterfaceForSoftApMode()
    => mWificond.createApInterface(ifaceName) // wificond/server.cpp
    ==> SetupInterface(iface_name, &interface)
    ===> !RefreshWiphyIndex()
    ====> netlink_utils_->GetWiphyIndex(&wiphy_index_)

    The iface_name here, assigned by upper Android framework,
    is wlan1 as expected.  Meanwhile, in the GetWiphyIndex(),
    it uses NL80211_CMD_GET_WIPHY command, with flag - NLM_F_DUMP,
    it doesn't assign NL80211_ATTR_IFINDEX, so the results have all the wiphy,
    and eventually return the last one phy#0,  instead of phy#1.

    Then in server.cpp::SetupInterface(),  wiphy_index_ is assigned to 0,
    it can not find wlan1, since wlan1's wiphy number is 1, not 0.
    Thus it fails.

    So we would like to suggest to add parameter NL80211_ATTR_IFINDEX
    in the function GetWiphyIndex(), for the command NL80211_CMD_GET_WIPHY,
    then it can find the correct wiphy number phy#1, instead of phy#0,
    when using interface wlan1.

    In the NetlinkUtils::GetWiphyIndex(), we add one more parameter,
    string iface_name. And if the string is empty, it means we use the
    original way to do GetWiphyIndex; If the string is not empty,
    it will add attribute NL80211_ATTR_IFINDEX for NL80211_CMD_GET_WIPHY.

Test: built, tested manually with the wifi which has two phy
Change-Id: I9319633d0ef220b9ba4a226ee5446bef08e4ac78
Signed-off-by: Neo Jou <neojou@gmail.com>
2019-01-30 11:24:36 +08:00
Roshan Pius 1731b15fb0 wificond: Remove supplicant/hostapd start/stop
This is no longer needed since we'll be using the lazy HAL startup
mechanism provided by HIDL to start/stop supplicant.
Created a new method for registering the softap callbacks (previously
was a part of startHostapd. The callback will be removed when we
teardown the interface.

libwifi-system (HostapdManager & SupplicantManager) will be removed in
subsequent CL's once VTS tests migrates to the new mechanism.

Bug: 72394251
Bug: 30311493
Test: ./system/connectivity/wificond/runtests.sh
Test: Device boots up & connects to wifi networks.

Change-Id: If41d40af2970d0e09b0d73388fe4f7a0640cd52b
2018-06-19 11:28:32 -07:00
Roshan Pius 8b70ba6f20 wificond: Don't reset system state on bootup
wificond no longer (was planned) manages the entire system state. The
framework is responsible for managing all the native daemons and the
interface state. So, don't reset system state (i.e kill supplicant,
hostapd and mark interfaces down) when wificond boots up.

Note: This change eliminates the second death notification that framework
has been receiving on killing wificond (previously: one for wificond, one
for supplicant; now: just one for wificond).

Bug: 75993335
Test: ./system/connectivity/wificond/runtests.sh
Test: Ran WifiManager & WifiSoftAp ACTS tests locally
Test: 'killall wificond' only produces 1 death notification.
Change-Id: I5effcbb6898f6744632cc7de65fccb4721b9add6
2018-03-30 14:34:41 -07:00
Ningyuan Wang 17c440d654 wificond: Log country code from kernel during dump
This creates nl80211 helper function to get country
code from kernel.
This also gets and logs the country code upon log dump.

Bug: 67053311
Test: compile, unit tests, manual test

Change-Id: I0ccc84763cf0588be1a2d3804bb1dca29eaa3581
2017-12-21 15:33:29 -08:00
Roshan Pius e5f2ed5f58 wificond: Add support for concurrent interfaces
Changes in the CL:
a) Create a map of iface name to handle for all the interfaces setup by
wificond.
b) Remove the old check to ensure that only 1 interface was active at
any point.
c) Add methods to teardown individual interfaces.

Bug: 69319369
Test: ./system/connectivity/wificond/runtests.sh
Change-Id: I0945c54a76fc076eb5554c34ce3c006aca3eebac
2017-11-29 13:56:12 -08:00
Roshan Pius 629acb02bf wificond: Move enable/disable Supplicant
Move enable/disable Supplicant to top level wificond Aidl object since
this is used for both STA & AP operations now.

Bug: 69319369
Test: Turn on wifi/softap succesfully.
Test: ./system/connectivity/wificond/runtests.sh
Change-Id: I3c2463f8c2bcb081503103a46188e4ec3e3e6b3e
2017-11-20 10:46:01 -08:00
Ningyuan Wang 3e5057cb38 wificond: Move get*Channels() APIs
These get*Channels() APIs should be used by java framework
in both client and AP mode.

They are implemented by GetWiphy command which is associated to
a wihpy instead of a interface.

We need to move these APIs to wificond main interface for both
correctness and convienience.

This also removes the corresponding integration test. Since wificond
no longer load/unload driver/fw, we are not able to run and verify
these tests. It's reasonble to remove them for now.

Bug: 35707768
Test: compile, unit tests
Change-Id: I7ba562fbb788a6032832a0ab1ff917b5ba869670
2017-10-24 13:34:52 -07:00
Roshan Pius 47443838f7 wificond: Create interface objects using name
Use the passed in iface name to create the corresponding interface
object.

Bug: 67365651
Test: ./system/connectivity/wificond/runtests.sh
Test: Will send for regression tests.
Change-Id: I9e8d748d47388a45567234b93f8aff854d784aea
2017-10-05 16:13:44 -07:00
Ningyuan Wang e763c873b7 Remove RTT related code from wificond
Bug: 64809697
Test: compile, unit tests
Change-Id: I4457dee48b7af6e4d2d709b636e4ddecbd8d68cd
2017-08-17 15:09:00 -07:00
Ningyuan Wang 81a0b9d1b2 Merge "Add dump state for wificond interface classes" into oc-dev am: 0d676773e1
am: 9470002e4f

Change-Id: Ibecde3bc26cb43099d7d677f47fddfc21b448f02
2017-04-25 22:19:49 +00:00
Ningyuan Wang fe3f7bce54 Blacklist nan interfaces for wificond
Bug: 37644243
Test: manual tests
Change-Id: Ia08cbd50e67b9c0d4ee1b5837c81001e33049936
2017-04-25 11:13:04 -07:00
Ningyuan Wang 8ec7696f51 Add dump state for wificond interface classes
This allows wificond's ClientInterfaceImpl and
ApInterfaceImpl to dump state.

The dump state includes scan capabilities, wiphy features, and
number of current associated stations for AP mode.

This also adds the missing const keyword for IsAssociated().

Bug: 31336376
Test: compile, manual test

Sample dump output:
Current wiphy index: 0
Cached interfaces list from kernel message:
Interface index: 23, name: p2p0, mac address: 66:bc:0c:47:df:00
Interface index: 22, name: wlan0, mac address: 64:bc:0c:47:df:00
------- Dump of client interface with index: 22 and name: wlan0-------
Max number of ssids for single shot scan: 10
Max number of ssids for scheduled scan: 16
Max number of match sets for scheduled scan: 16
Device supports random MAC for single shot scan: 1
Device supports random MAC for scheduled scan: 1
------- Dump End -------
--------- 0.004s was the duration of dumpsys wificond

Change-Id: I862974af743ca6ca303dfc1a4f6c773dd5b7a03e
2017-04-19 17:25:45 -07:00
Ningyuan Wang 099ee0c764 wificond: Dump interface list
Bug: 31336376
Test: compile
Test: manual test, check bug report
For example, I can see the following dump state:
Cached interfaces list from kernel message:
Interface index: 23, name: p2p0, mac address: 66:bc:0c:47:df:00
Interface index: 22, name: wlan0, mac address: 64:bc:0c:47:df:00

Change-Id: Iae02bc85a73f211aa39fb16d77eb17d399651dce
2017-04-05 11:17:26 -07:00
Ningyuan Wang b340bb5604 Allow wificond to dump logs
This adds the dump() function for wificond to dump logs
to provided fd.

Bug: 31336376
Test: compile
Test: manual test, see wificond dump logs in bug report

Change-Id: Ia27cee9c14728095d9843dfc08994ec981283ee3
2017-04-05 10:41:41 -07:00
Ningyuan Wang 075145ad1d Cleanup p2p0 interface upon tearDownInterfaces().
This replaces NetlinkUtils::GetInterfaceInfo with NetlinkUtils::
GetInterfaces. Instead of picking client interface inside NetlinkUtils,
this change allows wificond main object(server) to dump all the interfaces
from kernel.
Being able to dump all interfaces, wificond main object therefore can mark
down all the interfaces upon cleanup.

Bug: 36139978
Bug: 35949498

Test: compile, unit tests, manual test, integration test

Change-Id: I66dd4f8c3b26087dd182591763de8fa4da29f1d6
2017-03-13 14:42:47 -07:00
Roshan Pius b5c68afba4 wificond: Use Vendor HAL for mode change
Also,
Removed the usage of DriverTool & HalTool from wificond.

Bug: 35765841
Test: Will send for integration tests.
Change-Id: Ie029816bec5b168e34b3b18892b9da82285c66c0
2017-03-02 09:49:34 -08:00
Ningyuan Wang 9136ae3b1e Cleanup AP logic after Hostapd is down
Bug: 35445677
Test: compile, unit tests, manual test

Change-Id: Ic7e6c593ded19955da7a85d60730bf8e9afd679a
2017-03-01 11:44:54 -08:00
Ningyuan Wang 495e5b35c9 Monitor regulatory domain change
This adds the function of regulatory domain change monitoring
on wificond.

This also allows wificond to print the supported bands/channels
upon regulatory domain change.

This also adds the corresponding unit tests.

Bug: 35150708
Test: compile, unit tests, manual tests
Change-Id: Idbcf9ebf25f4e7be3b371ec3531b6b52303476e8
2017-02-16 14:12:26 -08:00
Ningyuan Wang 2c74cae9b5 Expose wiphy capabilities to ScannerImpl
This adds a struct WiphyFeatures to save wiphy feature flags
from netlink wiphy message. Currently we only add fields for
randomized mac address support.

This also allows ClientInterfaceImpl to expose channel info, scan
capabilities and wiphy features to ScannerImpl object.

Bug: 33216906
Test: compile, unit tests, manual test

Change-Id: Iac9355e45a3cf2011120fc6a91ccfb2dee434951
2016-12-05 10:08:03 -08:00
Ningyuan Wang eb59d4dd54 Add RTTController and corresponding aidl interface to wificond
This add RttController interface as a lazy initialization object.
User can get an instance of RttController while register a RttClient
through wificond.

Currently HAL RttController has an optional parameter for choosing
on which network interface will RTT run. However, in order to
hide interface concept from RTT framework as well as keep simplicity,
we don't expose this interface choice via aidl to framework for now.

Bug: 31756849
Test: compile

Change-Id: I2a13374254fd8c6bd7911e5cfbe3297cde25e9e7
2016-10-19 11:08:13 -07:00
Christopher Wiley 4fc3792b54 Always set interface down in object destruction
We would like to reason about our interfaces as being up
when they are configured and ready for use, and down otherwise.
This helps when switching modes. For example, when setting up a SoftAP,
you can expect that the interface starts in a down state, and
transitions to up when hostapd is ready for business.  Note that we
cannot do this after firmware reload, because this may cause driver
de-initialization (see c#6 in b/31205821).

Bug: 31337216
Test: Integration tests pass

Change-Id: I03a71ea623e29ef9b023d97afc81cf836ebfb1ff
2016-09-26 15:49:09 -07:00
Ningyuan Wang a12253e46c Support fetching packet counters for wificond
BUG=30978872
TEST=compile, manual tests

Change-Id: Ifa0dd9ce794a1cdb6da7e357d6873992091e3ea0
2016-09-16 13:32:28 -07:00
Ningyuan Wang 29fca88171 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
2016-09-15 15:18:27 -07:00
Ningyuan Wang 8326436cf9 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
2016-09-12 14:05:05 -07:00
Ningyuan Wang dea7ebe307 Add binder interface for registering/unregistering interface changes
BUG=31349441
TEST=compile, unit tests
Change-Id: I0fa00ecdeec46246875f7de2479dab1470d102e5
2016-09-09 13:43:07 -07:00
Ningyuan Wang 3b89469905 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
2016-08-31 13:29:16 -07:00
Christopher Wiley fc6af08571 Tear down system state on wificond startup
Test: Added an integration test
Bug: 29620309

Change-Id: Ibf378dda9b6ca2dfa29cca3071d967a3e4f6b036
2016-08-25 10:54:58 -07:00
Christopher Wiley 537c1ba391 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
2016-08-25 10:53:09 -07:00
Christopher Wiley d42ca5abc3 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
2016-08-23 16:11:28 -07:00
Roshan Pius c62360e419 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
2016-08-23 13:15:08 -07:00
Ningyuan Wang 14de8b2ce5 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
2016-08-18 18:03:49 -07:00
Ningyuan Wang 9bc59a0588 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
2016-08-12 14:17:59 -07:00
Ningyuan Wang f28bd901d9 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
2016-08-03 12:56:30 -07:00
Christopher Wiley c139fbf821 Add support for creating client interfaces
Bug: 30041062
Test: unit/integration tests pass

Change-Id: I48a0adc338e474085c399750441198a4acae2cf5
2016-08-02 15:53:31 -07:00
Ningyuan Wang 45a655e6c6 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
2016-07-29 09:59:17 -07:00
Ningyuan Wang 47b3d35354 Do not use callback parameter for synchronous NL80211 interface
BUG=29454786
TEST=compile
TEST=unittests and intergration tests still pass

Change-Id: Ibaf15c82035837b73021c70922e96f870fcec36b
2016-07-28 13:03:50 -07:00