summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.bp35
-rw-r--r--aidl/android/net/wifi/nl80211/DeviceWiphyCapabilities.aidl19
-rw-r--r--aidl/android/net/wifi/nl80211/IApInterface.aidl (renamed from aidl/android/net/wifi/IApInterface.aidl)16
-rw-r--r--aidl/android/net/wifi/nl80211/IApInterfaceEventCallback.aidl (renamed from aidl/android/net/wifi/IApInterfaceEventCallback.aidl)11
-rw-r--r--aidl/android/net/wifi/nl80211/IClientInterface.aidl (renamed from aidl/android/net/wifi/IClientInterface.aidl)17
-rw-r--r--aidl/android/net/wifi/nl80211/IInterfaceEventCallback.aidl (renamed from aidl/android/net/wifi/IInterfaceEventCallback.aidl)11
-rw-r--r--aidl/android/net/wifi/nl80211/IPnoScanEvent.aidl (renamed from aidl/android/net/wifi/IPnoScanEvent.aidl)7
-rw-r--r--aidl/android/net/wifi/nl80211/IScanEvent.aidl (renamed from aidl/android/net/wifi/IScanEvent.aidl)7
-rw-r--r--aidl/android/net/wifi/nl80211/ISendMgmtFrameEvent.aidl (renamed from aidl/android/net/wifi/ISendMgmtFrameEvent.aidl)7
-rw-r--r--aidl/android/net/wifi/nl80211/IWifiScannerImpl.aidl (renamed from aidl/android/net/wifi/IWifiScannerImpl.aidl)15
-rw-r--r--aidl/android/net/wifi/nl80211/IWificond.aidl (renamed from aidl/android/net/wifi/IWificond.aidl)23
-rw-r--r--aidl/android/net/wifi/nl80211/NativeScanResult.aidl (renamed from aidl/com/android/server/wifi/wificond/NativeScanResult.aidl)2
-rw-r--r--aidl/android/net/wifi/nl80211/NativeWifiClient.aidl (renamed from aidl/com/android/server/wifi/wificond/NativeWifiClient.aidl)6
-rw-r--r--aidl/android/net/wifi/nl80211/PnoNetwork.aidl (renamed from aidl/com/android/server/wifi/wificond/PnoNetwork.aidl)2
-rw-r--r--aidl/android/net/wifi/nl80211/PnoSettings.aidl (renamed from aidl/com/android/server/wifi/wificond/PnoSettings.aidl)2
-rw-r--r--aidl/android/net/wifi/nl80211/SingleScanSettings.aidl (renamed from aidl/com/android/server/wifi/wificond/SingleScanSettings.aidl)2
-rw-r--r--ap_interface_binder.cpp16
-rw-r--r--ap_interface_binder.h16
-rw-r--r--ap_interface_impl.cpp52
-rw-r--r--ap_interface_impl.h10
-rw-r--r--client/native_wifi_client.cpp43
-rw-r--r--client/native_wifi_client.h47
-rw-r--r--client_interface_binder.cpp21
-rw-r--r--client_interface_binder.h12
-rw-r--r--client_interface_impl.cpp42
-rw-r--r--client_interface_impl.h10
-rw-r--r--device_wiphy_capabilities.cpp66
-rw-r--r--device_wiphy_capabilities.h57
-rw-r--r--ipc_constants.cpp2
-rw-r--r--main.cpp2
-rw-r--r--net/kernel-header-latest/nl80211.h1346
-rw-r--r--net/netlink_utils.cpp287
-rw-r--r--net/netlink_utils.h52
-rwxr-xr-xruntests.sh2
-rw-r--r--scanning/channel_settings.cpp10
-rw-r--r--scanning/channel_settings.h10
-rw-r--r--scanning/hidden_network.cpp10
-rw-r--r--scanning/hidden_network.h10
-rw-r--r--scanning/pno_network.cpp10
-rw-r--r--scanning/pno_network.h10
-rw-r--r--scanning/pno_settings.cpp16
-rw-r--r--scanning/pno_settings.h19
-rw-r--r--scanning/radio_chain_info.cpp10
-rw-r--r--scanning/radio_chain_info.h10
-rw-r--r--scanning/scan_result.cpp10
-rw-r--r--scanning/scan_result.h10
-rw-r--r--scanning/scan_utils.cpp14
-rw-r--r--scanning/scan_utils.h17
-rw-r--r--scanning/scanner_impl.cpp32
-rw-r--r--scanning/scanner_impl.h29
-rw-r--r--scanning/single_scan_settings.cpp14
-rw-r--r--scanning/single_scan_settings.h10
-rw-r--r--server.cpp63
-rw-r--r--server.h36
-rw-r--r--tests/ap_interface_impl_unittest.cpp60
-rw-r--r--tests/client_interface_impl_unittest.cpp43
-rw-r--r--tests/integration/ap_interface_test.cpp8
-rw-r--r--tests/integration/client_interface_test.cpp8
-rw-r--r--tests/integration/process_utils.cpp2
-rw-r--r--tests/integration/process_utils.h6
-rw-r--r--tests/integration/scanner_test.cpp10
-rw-r--r--tests/mock_ap_interface_event_callback.h8
-rw-r--r--tests/mock_i_send_mgmt_frame_event.h4
-rw-r--r--tests/mock_scan_utils.h5
-rw-r--r--tests/native_wifi_client_unittest.cpp58
-rw-r--r--tests/netlink_utils_unittest.cpp74
-rw-r--r--tests/scan_result_unittest.cpp4
-rw-r--r--tests/scan_settings_unittest.cpp16
-rw-r--r--tests/scan_utils_unittest.cpp17
-rw-r--r--tests/scanner_unittest.cpp49
-rw-r--r--tests/server_unittest.cpp6
71 files changed, 2356 insertions, 637 deletions
diff --git a/Android.bp b/Android.bp
index ce4869e..0578933 100644
--- a/Android.bp
+++ b/Android.bp
@@ -39,12 +39,14 @@ cc_binary {
shared_libs: [
"libbinder",
"libbase",
+ "libcrypto",
"libcutils",
"libhidlbase",
"libkeystore_aidl",
"libkeystore_binder",
"libkeystore_parcelables",
"libminijail",
+ "libssl",
"libutils",
"libwifi-system-iface",
"android.system.wifi.keystore@1.0",
@@ -66,7 +68,9 @@ cc_library_static {
"ap_interface_impl.cpp",
"client_interface_binder.cpp",
"client_interface_impl.cpp",
+ "device_wiphy_capabilities.cpp",
"logging_utils.cpp",
+ "client/native_wifi_client.cpp",
"scanning/channel_settings.cpp",
"scanning/hidden_network.cpp",
"scanning/pno_network.cpp",
@@ -135,8 +139,9 @@ cc_library_static {
},
srcs: [
"ipc_constants.cpp",
- ":libwificond_ipc_user_space_aidl",
":libwificond_ipc_aidl",
+ "client/native_wifi_client.cpp",
+ "device_wiphy_capabilities.cpp",
"scanning/channel_settings.cpp",
"scanning/hidden_network.cpp",
"scanning/pno_network.cpp",
@@ -151,28 +156,19 @@ cc_library_static {
filegroup {
name: "libwificond_ipc_aidl",
srcs: [
- "aidl/android/net/wifi/IApInterface.aidl",
- "aidl/android/net/wifi/IApInterfaceEventCallback.aidl",
- "aidl/android/net/wifi/IClientInterface.aidl",
- "aidl/android/net/wifi/IInterfaceEventCallback.aidl",
- "aidl/android/net/wifi/IPnoScanEvent.aidl",
- "aidl/android/net/wifi/IScanEvent.aidl",
- "aidl/android/net/wifi/ISendMgmtFrameEvent.aidl",
- "aidl/android/net/wifi/IWificond.aidl",
- "aidl/android/net/wifi/IWifiScannerImpl.aidl",
+ "aidl/android/net/wifi/nl80211/IApInterface.aidl",
+ "aidl/android/net/wifi/nl80211/IApInterfaceEventCallback.aidl",
+ "aidl/android/net/wifi/nl80211/IClientInterface.aidl",
+ "aidl/android/net/wifi/nl80211/IInterfaceEventCallback.aidl",
+ "aidl/android/net/wifi/nl80211/IPnoScanEvent.aidl",
+ "aidl/android/net/wifi/nl80211/IScanEvent.aidl",
+ "aidl/android/net/wifi/nl80211/ISendMgmtFrameEvent.aidl",
+ "aidl/android/net/wifi/nl80211/IWificond.aidl",
+ "aidl/android/net/wifi/nl80211/IWifiScannerImpl.aidl",
],
path: "aidl",
}
-filegroup {
- name: "libwificond_ipc_user_space_aidl",
- srcs: [
- "aidl/com/android/server/wifi/wificond/NativeWifiClient.aidl",
- ],
- path: "aidl",
-}
-
-
//
// test util library
//
@@ -207,6 +203,7 @@ cc_test {
"tests/mock_netlink_manager.cpp",
"tests/mock_netlink_utils.cpp",
"tests/mock_scan_utils.cpp",
+ "tests/native_wifi_client_unittest.cpp",
"tests/netlink_manager_unittest.cpp",
"tests/netlink_utils_unittest.cpp",
"tests/nl80211_attribute_unittest.cpp",
diff --git a/aidl/android/net/wifi/nl80211/DeviceWiphyCapabilities.aidl b/aidl/android/net/wifi/nl80211/DeviceWiphyCapabilities.aidl
new file mode 100644
index 0000000..baa9e84
--- /dev/null
+++ b/aidl/android/net/wifi/nl80211/DeviceWiphyCapabilities.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.wifi.nl80211;
+
+parcelable DeviceWiphyCapabilities cpp_header "wificond/device_wiphy_capabilities.h";
diff --git a/aidl/android/net/wifi/IApInterface.aidl b/aidl/android/net/wifi/nl80211/IApInterface.aidl
index e881b10..6e7e42f 100644
--- a/aidl/android/net/wifi/IApInterface.aidl
+++ b/aidl/android/net/wifi/nl80211/IApInterface.aidl
@@ -14,13 +14,16 @@
* limitations under the License.
*/
-package android.net.wifi;
+package android.net.wifi.nl80211;
-import android.net.wifi.IApInterfaceEventCallback;
-import com.android.server.wifi.wificond.NativeWifiClient;
+import android.net.wifi.nl80211.IApInterfaceEventCallback;
+import android.net.wifi.nl80211.NativeWifiClient;
-// IApInterface represents a network interface configured to act as a
-// WiFi access point.
+/**
+ * IApInterface represents a network interface configured to act as a
+ * WiFi access point.
+ * @hide
+ */
interface IApInterface {
const int ENCRYPTION_TYPE_NONE = 0;
@@ -37,7 +40,4 @@ interface IApInterface {
// IApInterface instance (e.g. "wlan0")
@utf8InCpp
String getInterfaceName();
-
- // @return Returns the associated devices to this hotspot.
- NativeWifiClient[] getConnectedClients();
}
diff --git a/aidl/android/net/wifi/IApInterfaceEventCallback.aidl b/aidl/android/net/wifi/nl80211/IApInterfaceEventCallback.aidl
index 245513e..26a92de 100644
--- a/aidl/android/net/wifi/IApInterfaceEventCallback.aidl
+++ b/aidl/android/net/wifi/nl80211/IApInterfaceEventCallback.aidl
@@ -14,11 +14,14 @@
* limitations under the License.
*/
-package android.net.wifi;
+package android.net.wifi.nl80211;
-import com.android.server.wifi.wificond.NativeWifiClient;
+import android.net.wifi.nl80211.NativeWifiClient;
-// A callback for receiving events related to soft AP.
+/**
+ * A callback for receiving events related to soft AP.
+ * @hide
+ */
oneway interface IApInterfaceEventCallback {
// Channel bandwidth type. Used in |onSoftApChannelSwitched|
@@ -33,7 +36,7 @@ oneway interface IApInterfaceEventCallback {
// Signals that the stations associated to this soft Ap have changed.
//
// @param clients The associated stations after change
- void onConnectedClientsChanged(in NativeWifiClient[] clients);
+ void onConnectedClientsChanged(in NativeWifiClient client, in boolean isConnected);
// Signals a channel switch event for this soft Ap.
//
diff --git a/aidl/android/net/wifi/IClientInterface.aidl b/aidl/android/net/wifi/nl80211/IClientInterface.aidl
index 1b8b404..59582d2 100644
--- a/aidl/android/net/wifi/IClientInterface.aidl
+++ b/aidl/android/net/wifi/nl80211/IClientInterface.aidl
@@ -14,13 +14,16 @@
* limitations under the License.
*/
-package android.net.wifi;
+package android.net.wifi.nl80211;
-import android.net.wifi.ISendMgmtFrameEvent;
-import android.net.wifi.IWifiScannerImpl;
+import android.net.wifi.nl80211.ISendMgmtFrameEvent;
+import android.net.wifi.nl80211.IWifiScannerImpl;
-// IClientInterface represents a network interface that can be used to connect
-// to access points and obtain internet connectivity.
+/**
+ * IClientInterface represents a network interface that can be used to connect
+ * to access points and obtain internet connectivity.
+ * @hide
+ */
interface IClientInterface {
// Get packet counters for this interface.
// First element in array is the number of successfully transmitted packets.
@@ -50,10 +53,6 @@ interface IClientInterface {
// Returns null when the underlying interface object is destroyed.
@nullable IWifiScannerImpl getWifiScannerImpl();
- // Set the MAC address of this interface
- // Returns true if the set was successful
- boolean setMacAddress(in byte[] mac);
-
// Sends an arbitrary 802.11 management frame on the current channel.
// @param frame Bytes of the 802.11 management frame to be sent, including the
// header, but not including the frame check sequence (FCS).
diff --git a/aidl/android/net/wifi/IInterfaceEventCallback.aidl b/aidl/android/net/wifi/nl80211/IInterfaceEventCallback.aidl
index d72ef35..ea7e61b 100644
--- a/aidl/android/net/wifi/IInterfaceEventCallback.aidl
+++ b/aidl/android/net/wifi/nl80211/IInterfaceEventCallback.aidl
@@ -14,12 +14,15 @@
* limitations under the License.
*/
-package android.net.wifi;
+package android.net.wifi.nl80211;
-import android.net.wifi.IApInterface;
-import android.net.wifi.IClientInterface;
+import android.net.wifi.nl80211.IApInterface;
+import android.net.wifi.nl80211.IClientInterface;
-// A callback for receiving events related to this chip.
+/**
+ * A callback for receiving events related to this chip.
+ * @hide
+ */
interface IInterfaceEventCallback {
// Signals that the provided interface is ready for future commands.
diff --git a/aidl/android/net/wifi/IPnoScanEvent.aidl b/aidl/android/net/wifi/nl80211/IPnoScanEvent.aidl
index 6488c19..1951d8e 100644
--- a/aidl/android/net/wifi/IPnoScanEvent.aidl
+++ b/aidl/android/net/wifi/nl80211/IPnoScanEvent.aidl
@@ -14,9 +14,12 @@
* limitations under the License.
*/
-package android.net.wifi;
+package android.net.wifi.nl80211;
-// A callback for receiving pno scanning events.
+/**
+ * A callback for receiving pno scanning events.
+ * @hide
+ */
interface IPnoScanEvent {
oneway void OnPnoNetworkFound();
oneway void OnPnoScanFailed();
diff --git a/aidl/android/net/wifi/IScanEvent.aidl b/aidl/android/net/wifi/nl80211/IScanEvent.aidl
index f93129a..3ee8195 100644
--- a/aidl/android/net/wifi/IScanEvent.aidl
+++ b/aidl/android/net/wifi/nl80211/IScanEvent.aidl
@@ -14,9 +14,12 @@
* limitations under the License.
*/
-package android.net.wifi;
+package android.net.wifi.nl80211;
-// A callback for receiving scanning events.
+/**
+ * A callback for receiving scanning events.
+ * @hide
+ */
interface IScanEvent {
oneway void OnScanResultReady();
oneway void OnScanFailed();
diff --git a/aidl/android/net/wifi/ISendMgmtFrameEvent.aidl b/aidl/android/net/wifi/nl80211/ISendMgmtFrameEvent.aidl
index 3af84aa..7fd6280 100644
--- a/aidl/android/net/wifi/ISendMgmtFrameEvent.aidl
+++ b/aidl/android/net/wifi/nl80211/ISendMgmtFrameEvent.aidl
@@ -14,9 +14,12 @@
* limitations under the License.
*/
-package android.net.wifi;
+package android.net.wifi.nl80211;
-// A callback to notify the results of sending a management frame.
+/**
+ * A callback to notify the results of sending a management frame.
+ * @hide
+ */
interface ISendMgmtFrameEvent {
// Error codes for OnFailure():
diff --git a/aidl/android/net/wifi/IWifiScannerImpl.aidl b/aidl/android/net/wifi/nl80211/IWifiScannerImpl.aidl
index 90afc05..4cf0c2b 100644
--- a/aidl/android/net/wifi/IWifiScannerImpl.aidl
+++ b/aidl/android/net/wifi/nl80211/IWifiScannerImpl.aidl
@@ -14,14 +14,17 @@
* limitations under the License.
*/
-package android.net.wifi;
+package android.net.wifi.nl80211;
-import android.net.wifi.IPnoScanEvent;
-import android.net.wifi.IScanEvent;
-import com.android.server.wifi.wificond.NativeScanResult;
-import com.android.server.wifi.wificond.PnoSettings;
-import com.android.server.wifi.wificond.SingleScanSettings;
+import android.net.wifi.nl80211.IPnoScanEvent;
+import android.net.wifi.nl80211.IScanEvent;
+import android.net.wifi.nl80211.NativeScanResult;
+import android.net.wifi.nl80211.PnoSettings;
+import android.net.wifi.nl80211.SingleScanSettings;
+/**
+ * @hide
+ */
interface IWifiScannerImpl {
// Type of scan request. This is used in |SingleScanSettings.scan_type|.
const int SCAN_TYPE_LOW_SPAN = 0;
diff --git a/aidl/android/net/wifi/IWificond.aidl b/aidl/android/net/wifi/nl80211/IWificond.aidl
index d3a3089..65560fd 100644
--- a/aidl/android/net/wifi/IWificond.aidl
+++ b/aidl/android/net/wifi/nl80211/IWificond.aidl
@@ -14,14 +14,18 @@
* limitations under the License.
*/
-package android.net.wifi;
+package android.net.wifi.nl80211;
-import android.net.wifi.IApInterface;
-import android.net.wifi.IClientInterface;
-import android.net.wifi.IInterfaceEventCallback;
+import android.net.wifi.nl80211.IApInterface;
+import android.net.wifi.nl80211.IClientInterface;
+import android.net.wifi.nl80211.IInterfaceEventCallback;
+import android.net.wifi.nl80211.DeviceWiphyCapabilities;
-// Service interface that exposes primitives for controlling the WiFi
-// subsystems of a device.
+/**
+ * Service interface that exposes primitives for controlling the WiFi
+ * subsystems of a device.
+ * @hide
+ */
interface IWificond {
// Create a network interface suitable for use as an AP.
@@ -59,6 +63,10 @@ interface IWificond {
// Returrns null on failure.
@nullable int[] getAvailableDFSChannels();
+ // Returns an array of available frequencies for 6GHz channels.
+ // Returrns null on failure.
+ @nullable int[] getAvailable6gChannels();
+
// Register a callback to receive interface status updates.
//
// Multiple callbacks can be registered simultaneously.
@@ -74,4 +82,7 @@ interface IWificond {
//
// @param callback object to remove from the set of registered callbacks.
oneway void UnregisterCallback(IInterfaceEventCallback callback);
+
+ // @return a device wiphy capabilities for an interface
+ @nullable DeviceWiphyCapabilities getDeviceWiphyCapabilities(@utf8InCpp String iface_name);
}
diff --git a/aidl/com/android/server/wifi/wificond/NativeScanResult.aidl b/aidl/android/net/wifi/nl80211/NativeScanResult.aidl
index 572c639..1412596 100644
--- a/aidl/com/android/server/wifi/wificond/NativeScanResult.aidl
+++ b/aidl/android/net/wifi/nl80211/NativeScanResult.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package com.android.server.wifi.wificond;
+package android.net.wifi.nl80211;
parcelable NativeScanResult cpp_header "wificond/scanning/scan_result.h";
diff --git a/aidl/com/android/server/wifi/wificond/NativeWifiClient.aidl b/aidl/android/net/wifi/nl80211/NativeWifiClient.aidl
index e8592e3..4049c6f 100644
--- a/aidl/com/android/server/wifi/wificond/NativeWifiClient.aidl
+++ b/aidl/android/net/wifi/nl80211/NativeWifiClient.aidl
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-package com.android.server.wifi.wificond;
+package android.net.wifi.nl80211;
-parcelable NativeWifiClient {
- byte[] macAddress;
-} \ No newline at end of file
+parcelable NativeWifiClient cpp_header "wificond/client/native_wifi_client.h";
diff --git a/aidl/com/android/server/wifi/wificond/PnoNetwork.aidl b/aidl/android/net/wifi/nl80211/PnoNetwork.aidl
index e1d2748..859bc47 100644
--- a/aidl/com/android/server/wifi/wificond/PnoNetwork.aidl
+++ b/aidl/android/net/wifi/nl80211/PnoNetwork.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package com.android.server.wifi.wificond;
+package android.net.wifi.nl80211;
parcelable PnoNetwork cpp_header "wificond/scanning/pno_network.h";
diff --git a/aidl/com/android/server/wifi/wificond/PnoSettings.aidl b/aidl/android/net/wifi/nl80211/PnoSettings.aidl
index 9902375..6372b1d 100644
--- a/aidl/com/android/server/wifi/wificond/PnoSettings.aidl
+++ b/aidl/android/net/wifi/nl80211/PnoSettings.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package com.android.server.wifi.wificond;
+package android.net.wifi.nl80211;
parcelable PnoSettings cpp_header "wificond/scanning/pno_settings.h";
diff --git a/aidl/com/android/server/wifi/wificond/SingleScanSettings.aidl b/aidl/android/net/wifi/nl80211/SingleScanSettings.aidl
index abae5fe..76542e3 100644
--- a/aidl/com/android/server/wifi/wificond/SingleScanSettings.aidl
+++ b/aidl/android/net/wifi/nl80211/SingleScanSettings.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package com.android.server.wifi.wificond;
+package android.net.wifi.nl80211;
parcelable SingleScanSettings cpp_header "wificond/scanning/single_scan_settings.h";
diff --git a/ap_interface_binder.cpp b/ap_interface_binder.cpp
index 66ea6ae..371fa61 100644
--- a/ap_interface_binder.cpp
+++ b/ap_interface_binder.cpp
@@ -20,8 +20,8 @@
#include "wificond/ap_interface_impl.h"
-using android::net::wifi::IApInterfaceEventCallback;
-using com::android::server::wifi::wificond::NativeWifiClient;
+using android::net::wifi::nl80211::IApInterfaceEventCallback;
+using android::net::wifi::nl80211::NativeWifiClient;
namespace android {
namespace wificond {
@@ -32,11 +32,9 @@ ApInterfaceBinder::ApInterfaceBinder(ApInterfaceImpl* impl)
ApInterfaceBinder::~ApInterfaceBinder() {
}
-void ApInterfaceBinder::NotifyConnectedClientsChanged(
- const std::vector<NativeWifiClient>& clients) {
+void ApInterfaceBinder::NotifyConnectedClientsChanged(const NativeWifiClient client, bool isConnected) {
if (ap_interface_event_callback_ != nullptr) {
- LOG(DEBUG) << "NotifyConnectedClientsChanged called returning clients count " << clients.size();
- ap_interface_event_callback_->onConnectedClientsChanged(clients);
+ ap_interface_event_callback_->onConnectedClientsChanged(client, isConnected);
}
}
@@ -87,11 +85,5 @@ binder::Status ApInterfaceBinder::getInterfaceName(std::string* out_name) {
return binder::Status::ok();
}
-binder::Status ApInterfaceBinder::getConnectedClients(
- std::vector<NativeWifiClient>* out_connected_clients) {
- *out_connected_clients = impl_->GetConnectedClients();
- return binder::Status::ok();
-}
-
} // namespace wificond
} // namespace android
diff --git a/ap_interface_binder.h b/ap_interface_binder.h
index 23bfad5..2977cb0 100644
--- a/ap_interface_binder.h
+++ b/ap_interface_binder.h
@@ -21,18 +21,18 @@
#include "wificond/net/netlink_manager.h"
-#include "android/net/wifi/BnApInterface.h"
-#include "android/net/wifi/IApInterfaceEventCallback.h"
+#include "android/net/wifi/nl80211/BnApInterface.h"
+#include "android/net/wifi/nl80211/IApInterfaceEventCallback.h"
-using android::net::wifi::IApInterfaceEventCallback;
-using com::android::server::wifi::wificond::NativeWifiClient;
+using android::net::wifi::nl80211::IApInterfaceEventCallback;
+using android::net::wifi::nl80211::NativeWifiClient;
namespace android {
namespace wificond {
class ApInterfaceImpl;
-class ApInterfaceBinder : public android::net::wifi::BnApInterface {
+class ApInterfaceBinder : public android::net::wifi::nl80211::BnApInterface {
public:
explicit ApInterfaceBinder(ApInterfaceImpl* impl);
~ApInterfaceBinder() override;
@@ -43,8 +43,7 @@ class ApInterfaceBinder : public android::net::wifi::BnApInterface {
void NotifyImplDead() { impl_ = nullptr; }
// Called by |impl_| every time the access point's connected clients change.
- void NotifyConnectedClientsChanged(const
- std::vector<NativeWifiClient>& clients);
+ void NotifyConnectedClientsChanged(const NativeWifiClient client, bool isConnected);
// Called by |impl_| on every channel switch event.
void NotifySoftApChannelSwitched(int frequency,
@@ -54,9 +53,6 @@ class ApInterfaceBinder : public android::net::wifi::BnApInterface {
const sp<IApInterfaceEventCallback>& callback,
bool* out_success) override;
binder::Status getInterfaceName(std::string* out_name) override;
- binder::Status getConnectedClients(
- std::vector<NativeWifiClient>*
- out_connected_clients) override;
private:
ApInterfaceImpl* impl_;
diff --git a/ap_interface_impl.cpp b/ap_interface_impl.cpp
index 18fdaf1..efc7c96 100644
--- a/ap_interface_impl.cpp
+++ b/ap_interface_impl.cpp
@@ -23,9 +23,9 @@
#include "wificond/ap_interface_binder.h"
#include "wificond/logging_utils.h"
-using android::net::wifi::IApInterface;
+using android::net::wifi::nl80211::IApInterface;
using android::wifi_system::InterfaceTool;
-using com::android::server::wifi::wificond::NativeWifiClient;
+using android::net::wifi::nl80211::NativeWifiClient;
using std::array;
using std::endl;
using std::string;
@@ -76,57 +76,31 @@ void ApInterfaceImpl::Dump(std::stringstream* ss) const {
*ss << "------- Dump of AP interface with index: "
<< interface_index_ << " and name: " << interface_name_
<< "-------" << endl;
- *ss << "Number of connected access point clients: "
- << connected_clients_.size() << endl;
*ss << "------- Dump End -------" << endl;
}
void ApInterfaceImpl::OnStationEvent(
StationEvent event,
const array<uint8_t, ETH_ALEN>& mac_address) {
+ vector<uint8_t> mac_return_address = vector<uint8_t>(mac_address.begin(), mac_address.end());
+
+ NativeWifiClient station;
+ station.mac_address_ = mac_return_address;
+
if (event == NEW_STATION) {
LOG(INFO) << "New station "
<< LoggingUtils::GetMacString(mac_address)
<< " connected to hotspot"
<< " using interface "
<< interface_name_;
-
- vector<uint8_t> mac_return_address = vector<uint8_t>(mac_address.begin(), mac_address.end());
- const auto iterator = std::find_if(connected_clients_.begin(), connected_clients_.end(),
- [&] (NativeWifiClient const& p) {
- return p.macAddress == mac_return_address;
- });
-
- if (iterator == connected_clients_.end()) {
- NativeWifiClient station;
- station.macAddress = mac_return_address;
- connected_clients_.push_back(station);
-
- LOG(INFO) << "Sending notifications for station event";
- binder_->NotifyConnectedClientsChanged(connected_clients_);
- }
+ LOG(INFO) << "Sending notifications for station add event";
+ binder_->NotifyConnectedClientsChanged(station, true);
} else if (event == DEL_STATION) {
LOG(INFO) << "Station "
<< LoggingUtils::GetMacString(mac_address)
<< " disassociated from hotspot";
- if (connected_clients_.size() <= 0) {
- LOG(ERROR) << "Received DEL_STATION event when station counter is: "
- << connected_clients_.size();
- return;
- } else {
- vector<uint8_t> mac_return_address = vector<uint8_t>(mac_address.begin(), mac_address.end());
- const auto iterator = std::find_if(connected_clients_.begin(), connected_clients_.end(),
- [&] (NativeWifiClient const& p) {
- return p.macAddress == mac_return_address;
- });
-
- if (iterator != connected_clients_.end()) {
- connected_clients_.erase(iterator);
-
- LOG(DEBUG) << "Sending notifications for station event";
- binder_->NotifyConnectedClientsChanged(connected_clients_);
- }
- }
+ LOG(DEBUG) << "Sending notifications for station leave event";
+ binder_->NotifyConnectedClientsChanged(station, false);
}
}
@@ -138,9 +112,5 @@ void ApInterfaceImpl::OnChannelSwitchEvent(uint32_t frequency,
binder_->NotifySoftApChannelSwitched(frequency, bandwidth);
}
-std::vector<NativeWifiClient> ApInterfaceImpl::GetConnectedClients() const {
- return connected_clients_;
-}
-
} // namespace wificond
} // namespace android
diff --git a/ap_interface_impl.h b/ap_interface_impl.h
index 558f43f..6c98293 100644
--- a/ap_interface_impl.h
+++ b/ap_interface_impl.h
@@ -28,10 +28,10 @@
#include "wificond/net/netlink_manager.h"
-#include "android/net/wifi/IApInterface.h"
+#include "android/net/wifi/nl80211/IApInterface.h"
-using android::net::wifi::IApInterface;
-using com::android::server::wifi::wificond::NativeWifiClient;
+using android::net::wifi::nl80211::IApInterface;
+using android::net::wifi::nl80211::NativeWifiClient;
namespace android {
namespace wificond {
@@ -55,7 +55,6 @@ class ApInterfaceImpl {
android::sp<IApInterface> GetBinder() const;
std::string GetInterfaceName() { return interface_name_; }
- std::vector<NativeWifiClient> GetConnectedClients() const;
void Dump(std::stringstream* ss) const;
private:
@@ -65,9 +64,6 @@ class ApInterfaceImpl {
wifi_system::InterfaceTool* const if_tool_;
const android::sp<ApInterfaceBinder> binder_;
- // Currently connected access point clients
- std::vector<NativeWifiClient> connected_clients_;
-
void OnStationEvent(StationEvent event,
const std::array<uint8_t, ETH_ALEN>& mac_address);
diff --git a/client/native_wifi_client.cpp b/client/native_wifi_client.cpp
new file mode 100644
index 0000000..50dcaee
--- /dev/null
+++ b/client/native_wifi_client.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "wificond/client/native_wifi_client.h"
+
+#include <android-base/logging.h>
+
+#include "wificond/parcelable_utils.h"
+
+using android::status_t;
+
+namespace android {
+namespace net {
+namespace wifi {
+namespace nl80211 {
+
+status_t NativeWifiClient::writeToParcel(::android::Parcel* parcel) const {
+ RETURN_IF_FAILED(parcel->writeByteVector(mac_address_));
+ return ::android::OK;
+}
+
+status_t NativeWifiClient::readFromParcel(const ::android::Parcel* parcel) {
+ RETURN_IF_FAILED(parcel->readByteVector(&mac_address_));
+ return ::android::OK;
+}
+
+} // namespace nl80211
+} // namespace wifi
+} // namespace net
+} // namespace android
diff --git a/client/native_wifi_client.h b/client/native_wifi_client.h
new file mode 100644
index 0000000..9a2cf26
--- /dev/null
+++ b/client/native_wifi_client.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef WIFICOND_NATIVE_WIFI_CLIENT_H_
+#define WIFICOND_NATIVE_WIFI_CLIENT_H_
+
+#include <vector>
+
+#include <binder/Parcel.h>
+#include <binder/Parcelable.h>
+
+namespace android {
+namespace net {
+namespace wifi {
+namespace nl80211 {
+
+class NativeWifiClient : public ::android::Parcelable {
+ public:
+ NativeWifiClient() = default;
+ bool operator==(const NativeWifiClient& rhs) const {
+ return mac_address_ == rhs.mac_address_;
+ }
+ ::android::status_t writeToParcel(::android::Parcel* parcel) const override;
+ ::android::status_t readFromParcel(const ::android::Parcel* parcel) override;
+
+ std::vector<uint8_t> mac_address_;
+};
+
+} // namespace nl80211
+} // namespace wifi
+} // namespace net
+} // namespace android
+
+#endif // WIFICOND_NATIVE_WIFI_CLIENT_H_
diff --git a/client_interface_binder.cpp b/client_interface_binder.cpp
index 960be8b..f5507e7 100644
--- a/client_interface_binder.cpp
+++ b/client_interface_binder.cpp
@@ -28,8 +28,8 @@
#include "wificond/client_interface_impl.h"
using android::binder::Status;
-using android::net::wifi::ISendMgmtFrameEvent;
-using android::net::wifi::IWifiScannerImpl;
+using android::net::wifi::nl80211::ISendMgmtFrameEvent;
+using android::net::wifi::nl80211::IWifiScannerImpl;
using std::vector;
namespace android {
@@ -87,23 +87,6 @@ Status ClientInterfaceBinder::getWifiScannerImpl(
return Status::ok();
}
-
-Status ClientInterfaceBinder::setMacAddress(const vector<uint8_t>& mac, bool* success) {
- if (impl_ == nullptr) {
- *success = false;
- return Status::ok();
- }
- if (mac.size() != ETH_ALEN) {
- LOG(ERROR) << "Invalid MAC length " << mac.size();
- *success = false;
- return Status::ok();
- }
- std::array<uint8_t, ETH_ALEN> mac_array;
- std::copy_n(mac.begin(), ETH_ALEN, mac_array.begin());
- *success = impl_->SetMacAddress(mac_array);
- return Status::ok();
-}
-
Status ClientInterfaceBinder::SendMgmtFrame(const vector<uint8_t>& frame,
const sp<ISendMgmtFrameEvent>& callback, int32_t mcs) {
if (impl_ == nullptr) {
diff --git a/client_interface_binder.h b/client_interface_binder.h
index b1fceea..d84d288 100644
--- a/client_interface_binder.h
+++ b/client_interface_binder.h
@@ -20,15 +20,15 @@
#include <android-base/macros.h>
#include <binder/Status.h>
-#include "android/net/wifi/BnClientInterface.h"
-#include "android/net/wifi/ISendMgmtFrameEvent.h"
+#include "android/net/wifi/nl80211/BnClientInterface.h"
+#include "android/net/wifi/nl80211/ISendMgmtFrameEvent.h"
namespace android {
namespace wificond {
class ClientInterfaceImpl;
-class ClientInterfaceBinder : public android::net::wifi::BnClientInterface {
+class ClientInterfaceBinder : public android::net::wifi::nl80211::BnClientInterface {
public:
explicit ClientInterfaceBinder(ClientInterfaceImpl* impl);
~ClientInterfaceBinder() override;
@@ -46,12 +46,10 @@ class ClientInterfaceBinder : public android::net::wifi::BnClientInterface {
std::vector<uint8_t>* out_mac_address) override;
::android::binder::Status getInterfaceName(std::string* out_name) override;
::android::binder::Status getWifiScannerImpl(
- ::android::sp<::android::net::wifi::IWifiScannerImpl>* out_wifi_scanner_impl) override;
- ::android::binder::Status setMacAddress(
- const ::std::vector<uint8_t>& mac, bool* success) override;
+ ::android::sp<::android::net::wifi::nl80211::IWifiScannerImpl>* out_wifi_scanner_impl) override;
::android::binder::Status SendMgmtFrame(
const ::std::vector<uint8_t>& frame,
- const sp<::android::net::wifi::ISendMgmtFrameEvent>& callback,
+ const sp<::android::net::wifi::nl80211::ISendMgmtFrameEvent>& callback,
int32_t mcs) override;
private:
ClientInterfaceImpl* impl_;
diff --git a/client_interface_impl.cpp b/client_interface_impl.cpp
index 3e1cbca..38a59ff 100644
--- a/client_interface_impl.cpp
+++ b/client_interface_impl.cpp
@@ -29,9 +29,9 @@
#include "wificond/scanning/scan_utils.h"
#include "wificond/scanning/scanner_impl.h"
-using android::net::wifi::IClientInterface;
-using android::net::wifi::ISendMgmtFrameEvent;
-using com::android::server::wifi::wificond::NativeScanResult;
+using android::net::wifi::nl80211::IClientInterface;
+using android::net::wifi::nl80211::ISendMgmtFrameEvent;
+using android::net::wifi::nl80211::NativeScanResult;
using android::sp;
using android::wifi_system::InterfaceTool;
@@ -40,6 +40,8 @@ using std::string;
using std::unique_ptr;
using std::vector;
+using namespace std::placeholders;
+
namespace android {
namespace wificond {
@@ -131,6 +133,9 @@ ClientInterfaceImpl::ClientInterfaceImpl(
}
});
+ netlink_utils_->SubscribeChannelSwitchEvent(interface_index_,
+ std::bind(&ClientInterfaceImpl::OnChannelSwitchEvent, this, _1));
+
if (!netlink_utils_->GetWiphyInfo(wiphy_index_,
&band_info_,
&scan_capabilities_,
@@ -154,10 +159,11 @@ ClientInterfaceImpl::~ClientInterfaceImpl() {
scanner_->Invalidate();
netlink_utils_->UnsubscribeFrameTxStatusEvent(interface_index_);
netlink_utils_->UnsubscribeMlmeEvent(interface_index_);
+ netlink_utils_->UnsubscribeChannelSwitchEvent(interface_index_);
if_tool_->SetUpState(interface_name_.c_str(), false);
}
-sp<android::net::wifi::IClientInterface> ClientInterfaceImpl::GetBinder() const {
+sp<android::net::wifi::nl80211::IClientInterface> ClientInterfaceImpl::GetBinder() const {
return binder_;
}
@@ -236,24 +242,6 @@ const std::array<uint8_t, ETH_ALEN>& ClientInterfaceImpl::GetMacAddress() {
return interface_mac_addr_;
}
-bool ClientInterfaceImpl::SetMacAddress(const std::array<uint8_t, ETH_ALEN>& mac) {
- if (!if_tool_->SetWifiUpState(false)) {
- LOG(ERROR) << "SetWifiUpState(false) failed.";
- return false;
- }
- if (!if_tool_->SetMacAddress(interface_name_.c_str(), mac)) {
- LOG(ERROR) << "SetMacAddress(" << interface_name_ << ", "
- << LoggingUtils::GetMacString(mac) << ") failed.";
- return false;
- }
- if (!if_tool_->SetWifiUpState(true)) {
- LOG(ERROR) << "SetWifiUpState(true) failed.";
- return false;
- }
- LOG(DEBUG) << "Successfully SetMacAddress.";
- return true;
-}
-
bool ClientInterfaceImpl::RefreshAssociateFreq() {
// wpa_supplicant fetches associate frequency using the latest scan result.
// We should follow the same method here before we find a better solution.
@@ -269,6 +257,16 @@ bool ClientInterfaceImpl::RefreshAssociateFreq() {
return false;
}
+bool ClientInterfaceImpl::OnChannelSwitchEvent(uint32_t frequency) {
+ if(!frequency) {
+ LOG(ERROR) << "Frequency value is null";
+ return false;
+ }
+ LOG(INFO) << "New channel on frequency: " << frequency;
+ associate_freq_ = frequency;
+ return true;
+}
+
bool ClientInterfaceImpl::IsAssociated() const {
return is_associated_;
}
diff --git a/client_interface_impl.h b/client_interface_impl.h
index 5a27484..4ecbf1d 100644
--- a/client_interface_impl.h
+++ b/client_interface_impl.h
@@ -26,8 +26,8 @@
#include <utils/StrongPointer.h>
#include <wifi_system/interface_tool.h>
-#include "android/net/wifi/IClientInterface.h"
-#include "android/net/wifi/ISendMgmtFrameEvent.h"
+#include "android/net/wifi/nl80211/IClientInterface.h"
+#include "android/net/wifi/nl80211/ISendMgmtFrameEvent.h"
#include "wificond/net/mlme_event_handler.h"
#include "wificond/net/netlink_utils.h"
#include "wificond/scanning/scanner_impl.h"
@@ -72,23 +72,23 @@ class ClientInterfaceImpl {
virtual ~ClientInterfaceImpl();
// Get a pointer to the binder representing this ClientInterfaceImpl.
- android::sp<android::net::wifi::IClientInterface> GetBinder() const;
+ android::sp<android::net::wifi::nl80211::IClientInterface> GetBinder() const;
bool GetPacketCounters(std::vector<int32_t>* out_packet_counters);
bool SignalPoll(std::vector<int32_t>* out_signal_poll_results);
const std::array<uint8_t, ETH_ALEN>& GetMacAddress();
const std::string& GetInterfaceName() const { return interface_name_; }
const android::sp<ScannerImpl> GetScanner() { return scanner_; };
- bool SetMacAddress(const std::array<uint8_t, ETH_ALEN>& mac);
virtual bool IsAssociated() const;
void Dump(std::stringstream* ss) const;
void SendMgmtFrame(
const std::vector<uint8_t>& frame,
- const sp<::android::net::wifi::ISendMgmtFrameEvent>& callback,
+ const sp<::android::net::wifi::nl80211::ISendMgmtFrameEvent>& callback,
int32_t mcs);
private:
bool RefreshAssociateFreq();
+ bool OnChannelSwitchEvent(uint32_t frequency);
const uint32_t wiphy_index_;
const std::string interface_name_;
diff --git a/device_wiphy_capabilities.cpp b/device_wiphy_capabilities.cpp
new file mode 100644
index 0000000..d932811
--- /dev/null
+++ b/device_wiphy_capabilities.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "device_wiphy_capabilities.h"
+
+#include <android-base/logging.h>
+
+#include "wificond/parcelable_utils.h"
+
+using android::status_t;
+
+namespace android {
+namespace net {
+namespace wifi {
+namespace nl80211 {
+
+DeviceWiphyCapabilities::DeviceWiphyCapabilities() {
+ is80211nSupported_ = false;
+ is80211acSupported_ = false;
+ is80211axSupported_ = false;
+ is160MhzSupported_ = false;
+ is80p80MhzSupported_ = false;
+ maxTxStreams_ = 1;
+ maxRxStreams_ = 1;
+}
+
+status_t DeviceWiphyCapabilities::writeToParcel(::android::Parcel* parcel) const {
+ RETURN_IF_FAILED(parcel->writeBool(is80211nSupported_));
+ RETURN_IF_FAILED(parcel->writeBool(is80211acSupported_));
+ RETURN_IF_FAILED(parcel->writeBool(is80211axSupported_));
+ RETURN_IF_FAILED(parcel->writeBool(is160MhzSupported_ ));
+ RETURN_IF_FAILED(parcel->writeBool(is80p80MhzSupported_));
+ RETURN_IF_FAILED(parcel->writeUint32(maxTxStreams_));
+ RETURN_IF_FAILED(parcel->writeUint32(maxRxStreams_));
+ return ::android::OK;
+}
+
+status_t DeviceWiphyCapabilities::readFromParcel(const ::android::Parcel* parcel) {
+ RETURN_IF_FAILED(parcel->readBool(&is80211nSupported_));
+ RETURN_IF_FAILED(parcel->readBool(&is80211acSupported_));
+ RETURN_IF_FAILED(parcel->readBool(&is80211axSupported_));
+ RETURN_IF_FAILED(parcel->readBool(&is160MhzSupported_));
+ RETURN_IF_FAILED(parcel->readBool(&is80p80MhzSupported_));
+ RETURN_IF_FAILED(parcel->readUint32(&maxTxStreams_));
+ RETURN_IF_FAILED(parcel->readUint32(&maxRxStreams_));
+
+ return ::android::OK;
+}
+
+} // namespace nl80211
+} // namespace wifi
+} // namespace net
+} // namespace android
diff --git a/device_wiphy_capabilities.h b/device_wiphy_capabilities.h
new file mode 100644
index 0000000..c50f99c
--- /dev/null
+++ b/device_wiphy_capabilities.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef WIFICOND_DEVICE_WIPHY_CAPABILITIES_H_
+#define WIFICOND_DEVICE_WIPHY_CAPABILITIES_H_
+
+#include <binder/Parcel.h>
+#include <binder/Parcelable.h>
+
+namespace android {
+namespace net {
+namespace wifi {
+namespace nl80211 {
+
+class DeviceWiphyCapabilities : public ::android::Parcelable {
+ public:
+ DeviceWiphyCapabilities();
+ bool operator==(const DeviceWiphyCapabilities& rhs) const {
+ return (is80211nSupported_ == rhs.is80211nSupported_
+ && is80211acSupported_ == rhs.is80211acSupported_
+ && is80211axSupported_ == rhs.is80211axSupported_
+ && is160MhzSupported_ == rhs.is160MhzSupported_
+ && is80p80MhzSupported_ == rhs.is80p80MhzSupported_
+ && maxTxStreams_ == rhs.maxTxStreams_
+ && maxRxStreams_ == rhs.maxRxStreams_);
+ }
+ ::android::status_t writeToParcel(::android::Parcel* parcel) const override;
+ ::android::status_t readFromParcel(const ::android::Parcel* parcel) override;
+
+ bool is80211nSupported_;
+ bool is80211acSupported_;
+ bool is80211axSupported_;
+ bool is160MhzSupported_;
+ bool is80p80MhzSupported_;
+ uint32_t maxTxStreams_;
+ uint32_t maxRxStreams_;
+};
+
+} // namespace nl80211
+} // namespace wifi
+} // namespace net
+} // namespace android
+
+#endif // WIFICOND_DEVICE_WIPHY_CAPABILITIES_H_
diff --git a/ipc_constants.cpp b/ipc_constants.cpp
index 110d07f..9dc887e 100644
--- a/ipc_constants.cpp
+++ b/ipc_constants.cpp
@@ -20,7 +20,7 @@ namespace android {
namespace wificond {
namespace ipc_constants {
-const char kServiceName[] = "wificond";
+const char kServiceName[] = "wifinl80211";
} // namespace ipc_constants
} // namespace wificond
diff --git a/main.cpp b/main.cpp
index b6054b1..e5e41aa 100644
--- a/main.cpp
+++ b/main.cpp
@@ -38,7 +38,7 @@
#include "wificond/server.h"
#include "wifi_keystore_hal_connector.h"
-using android::net::wifi::IWificond;
+using android::net::wifi::nl80211::IWificond;
using android::wifi_system::InterfaceTool;
using android::wificond::ipc_constants::kServiceName;
using android::wificond::WifiKeystoreHalConnector;
diff --git a/net/kernel-header-latest/nl80211.h b/net/kernel-header-latest/nl80211.h
index 3092188..341e0e8 100644
--- a/net/kernel-header-latest/nl80211.h
+++ b/net/kernel-header-latest/nl80211.h
@@ -10,7 +10,8 @@
* Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com>
* Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
* Copyright 2008 Colin McCabe <colin@cozybit.com>
- * Copyright 2015 Intel Deutschland GmbH
+ * Copyright 2015-2017 Intel Deutschland GmbH
+ * Copyright (C) 2018-2019 Intel Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -51,6 +52,11 @@
#define NL80211_MULTICAST_GROUP_NAN "nan"
#define NL80211_MULTICAST_GROUP_TESTMODE "testmode"
+#define NL80211_EDMG_BW_CONFIG_MIN 4
+#define NL80211_EDMG_BW_CONFIG_MAX 15
+#define NL80211_EDMG_CHANNELS_MIN 1
+#define NL80211_EDMG_CHANNELS_MAX 0x3c /* 0b00111100 */
+
/**
* DOC: Station handling
*
@@ -173,6 +179,29 @@
*/
/**
+ * DOC: WPA/WPA2 EAPOL handshake offload
+ *
+ * By setting @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK flag drivers
+ * can indicate they support offloading EAPOL handshakes for WPA/WPA2
+ * preshared key authentication. In %NL80211_CMD_CONNECT the preshared
+ * key should be specified using %NL80211_ATTR_PMK. Drivers supporting
+ * this offload may reject the %NL80211_CMD_CONNECT when no preshared
+ * key material is provided, for example when that driver does not
+ * support setting the temporal keys through %CMD_NEW_KEY.
+ *
+ * Similarly @NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X flag can be
+ * set by drivers indicating offload support of the PTK/GTK EAPOL
+ * handshakes during 802.1X authentication. In order to use the offload
+ * the %NL80211_CMD_CONNECT should have %NL80211_ATTR_WANT_1X_4WAY_HS
+ * attribute flag. Drivers supporting this offload may reject the
+ * %NL80211_CMD_CONNECT when the attribute flag is not present.
+ *
+ * For 802.1X the PMK or PMK-R0 are set by providing %NL80211_ATTR_PMK
+ * using %NL80211_CMD_SET_PMK. For offloaded FT support also
+ * %NL80211_ATTR_PMKR0_NAME must be provided.
+ */
+
+/**
* DOC: FILS shared key authentication offload
*
* FILS shared key authentication offload can be advertized by drivers by
@@ -180,7 +209,8 @@
* FILS shared key authentication offload should be able to construct the
* authentication and association frames for FILS shared key authentication and
* eventually do a key derivation as per IEEE 802.11ai. The below additional
- * parameters should be given to driver in %NL80211_CMD_CONNECT.
+ * parameters should be given to driver in %NL80211_CMD_CONNECT and/or in
+ * %NL80211_CMD_UPDATE_CONNECT_PARAMS.
* %NL80211_ATTR_FILS_ERP_USERNAME - used to construct keyname_nai
* %NL80211_ATTR_FILS_ERP_REALM - used to construct keyname_nai
* %NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM - used to construct erp message
@@ -191,7 +221,8 @@
* as specified in IETF RFC 6696.
*
* When FILS shared key authentication is completed, driver needs to provide the
- * below additional parameters to userspace.
+ * below additional parameters to userspace, which can be either after setting
+ * up a connection or after roaming.
* %NL80211_ATTR_FILS_KEK - used for key renewal
* %NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM - used in further EAP-RP exchanges
* %NL80211_ATTR_PMKID - used to identify the PMKSA used/generated
@@ -209,6 +240,31 @@
*/
/**
+ * DOC: SAE authentication offload
+ *
+ * By setting @NL80211_EXT_FEATURE_SAE_OFFLOAD flag drivers can indicate they
+ * support offloading SAE authentication for WPA3-Personal networks. In
+ * %NL80211_CMD_CONNECT the password for SAE should be specified using
+ * %NL80211_ATTR_SAE_PASSWORD.
+ */
+
+/**
+ * DOC: VLAN offload support for setting group keys and binding STAs to VLANs
+ *
+ * By setting @NL80211_EXT_FEATURE_VLAN_OFFLOAD flag drivers can indicate they
+ * support offloading VLAN functionality in a manner where the driver exposes a
+ * single netdev that uses VLAN tagged frames and separate VLAN-specific netdevs
+ * can then be added using RTM_NEWLINK/IFLA_VLAN_ID similarly to the Ethernet
+ * case. Frames received from stations that are not assigned to any VLAN are
+ * delivered on the main netdev and frames to such stations can be sent through
+ * that main netdev.
+ *
+ * %NL80211_CMD_NEW_KEY (for group keys), %NL80211_CMD_NEW_STATION, and
+ * %NL80211_CMD_SET_STATION will optionally specify vlan_id using
+ * %NL80211_ATTR_VLAN_ID.
+ */
+
+/**
* enum nl80211_commands - supported nl80211 commands
*
* @NL80211_CMD_UNSPEC: unspecified command to catch errors
@@ -387,7 +443,9 @@
* are used. Extra IEs can also be passed from the userspace by
* using the %NL80211_ATTR_IE attribute. The first cycle of the
* scheduled scan can be delayed by %NL80211_ATTR_SCHED_SCAN_DELAY
- * is supplied.
+ * is supplied. If the device supports multiple concurrent scheduled
+ * scans, it will allow such when the caller provides the flag attribute
+ * %NL80211_ATTR_SCHED_SCAN_MULTI to indicate user-space support for it.
* @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT if
* scheduled scan is not running. The caller may assume that as soon
* as the call returns, it is safe to start a new scheduled scan again.
@@ -517,7 +575,8 @@
* IEs in %NL80211_ATTR_IE, %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_USE_MFP,
* %NL80211_ATTR_MAC, %NL80211_ATTR_WIPHY_FREQ, %NL80211_ATTR_CONTROL_PORT,
* %NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
- * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT, %NL80211_ATTR_MAC_HINT, and
+ * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT,
+ * %NL80211_ATTR_CONTROL_PORT_OVER_NL80211, %NL80211_ATTR_MAC_HINT, and
* %NL80211_ATTR_WIPHY_FREQ_HINT.
* If included, %NL80211_ATTR_MAC and %NL80211_ATTR_WIPHY_FREQ are
* restrictions on BSS selection, i.e., they effectively prevent roaming
@@ -528,6 +587,14 @@
* set of BSSID,frequency parameters is used (i.e., either the enforcing
* %NL80211_ATTR_MAC,%NL80211_ATTR_WIPHY_FREQ or the less strict
* %NL80211_ATTR_MAC_HINT and %NL80211_ATTR_WIPHY_FREQ_HINT).
+ * Driver shall not modify the IEs specified through %NL80211_ATTR_IE if
+ * %NL80211_ATTR_MAC is included. However, if %NL80211_ATTR_MAC_HINT is
+ * included, these IEs through %NL80211_ATTR_IE are specified by the user
+ * space based on the best possible BSS selected. Thus, if the driver ends
+ * up selecting a different BSS, it can modify these IEs accordingly (e.g.
+ * userspace asks the driver to perform PMKSA caching with BSS1 and the
+ * driver ends up selecting BSS2 with different PMKSA cache entry; RSNIE
+ * has to get updated with the apt PMKID).
* %NL80211_ATTR_PREV_BSSID can be used to request a reassociation within
* the ESS in case the device is already associated and an association with
* a different BSS is desired.
@@ -544,14 +611,14 @@
* authentication/association or not receiving a response from the AP.
* Non-zero %NL80211_ATTR_STATUS_CODE value is indicated in that case as
* well to remain backwards compatible.
- * @NL80211_CMD_ROAM: request that the card roam (currently not implemented),
- * sent as an event when the card/driver roamed by itself.
- * When used as an event, and the driver roamed in a network that requires
- * 802.1X authentication, %NL80211_ATTR_PORT_AUTHORIZED should be set
- * if the 802.1X authentication was done by the driver or if roaming was
- * done using Fast Transition protocol (in which case 802.1X authentication
- * is not needed). If %NL80211_ATTR_PORT_AUTHORIZED is not set, user space
- * is responsible for the 802.1X authentication.
+ * When establishing a security association, drivers that support 4 way
+ * handshake offload should send %NL80211_CMD_PORT_AUTHORIZED event when
+ * the 4 way handshake is completed successfully.
+ * @NL80211_CMD_ROAM: Notification indicating the card/driver roamed by itself.
+ * When a security association was established with the new AP (e.g. if
+ * the FT protocol was used for roaming or the driver completed the 4 way
+ * handshake), this event should be followed by an
+ * %NL80211_CMD_PORT_AUTHORIZED event.
* @NL80211_CMD_DISCONNECT: drop a given connection; also used to notify
* userspace that a connection was dropped by the AP or due to other
* reasons, for this the %NL80211_ATTR_DISCONNECTED_BY_AP and
@@ -619,7 +686,9 @@
* is used during CSA period.
* @NL80211_CMD_FRAME_WAIT_CANCEL: When an off-channel TX was requested, this
* command may be used with the corresponding cookie to cancel the wait
- * time if it is known that it is no longer necessary.
+ * time if it is known that it is no longer necessary. This command is
+ * also sent as an event whenever the driver has completed the off-channel
+ * wait time.
* @NL80211_CMD_ACTION: Alias for @NL80211_CMD_FRAME for backward compatibility.
* @NL80211_CMD_FRAME_TX_STATUS: Report TX status of a management frame
* transmitted with %NL80211_CMD_FRAME. %NL80211_ATTR_COOKIE identifies
@@ -904,12 +973,15 @@
* cfg80211_scan_done().
*
* @NL80211_CMD_START_NAN: Start NAN operation, identified by its
- * %NL80211_ATTR_WDEV interface. This interface must have been previously
- * created with %NL80211_CMD_NEW_INTERFACE. After it has been started, the
- * NAN interface will create or join a cluster. This command must have a
- * valid %NL80211_ATTR_NAN_MASTER_PREF attribute and optional
- * %NL80211_ATTR_NAN_DUAL attributes.
- * After this command NAN functions can be added.
+ * %NL80211_ATTR_WDEV interface. This interface must have been
+ * previously created with %NL80211_CMD_NEW_INTERFACE. After it
+ * has been started, the NAN interface will create or join a
+ * cluster. This command must have a valid
+ * %NL80211_ATTR_NAN_MASTER_PREF attribute and optional
+ * %NL80211_ATTR_BANDS attributes. If %NL80211_ATTR_BANDS is
+ * omitted or set to 0, it means don't-care and the device will
+ * decide what to use. After this command NAN functions can be
+ * added.
* @NL80211_CMD_STOP_NAN: Stop the NAN operation, identified by
* its %NL80211_ATTR_WDEV interface.
* @NL80211_CMD_ADD_NAN_FUNCTION: Add a NAN function. The function is defined
@@ -930,10 +1002,14 @@
* This command is also used as a notification sent when a NAN function is
* terminated. This will contain a %NL80211_ATTR_NAN_FUNC_INST_ID
* and %NL80211_ATTR_COOKIE attributes.
- * @NL80211_CMD_CHANGE_NAN_CONFIG: Change current NAN configuration. NAN
- * must be operational (%NL80211_CMD_START_NAN was executed).
- * It must contain at least one of the following attributes:
- * %NL80211_ATTR_NAN_MASTER_PREF, %NL80211_ATTR_NAN_DUAL.
+ * @NL80211_CMD_CHANGE_NAN_CONFIG: Change current NAN
+ * configuration. NAN must be operational (%NL80211_CMD_START_NAN
+ * was executed). It must contain at least one of the following
+ * attributes: %NL80211_ATTR_NAN_MASTER_PREF,
+ * %NL80211_ATTR_BANDS. If %NL80211_ATTR_BANDS is omitted, the
+ * current configuration is not changed. If it is present but
+ * set to zero, the configuration is changed to don't-care
+ * (i.e. the device can decide what to do).
* @NL80211_CMD_NAN_FUNC_MATCH: Notification sent when a match is reported.
* This will contain a %NL80211_ATTR_NAN_MATCH nested attribute and
* %NL80211_ATTR_COOKIE.
@@ -944,6 +1020,111 @@
* does not result in a change for the current association. Currently,
* only the %NL80211_ATTR_IE data is used and updated with this command.
*
+ * @NL80211_CMD_SET_PMK: For offloaded 4-Way handshake, set the PMK or PMK-R0
+ * for the given authenticator address (specified with %NL80211_ATTR_MAC).
+ * When %NL80211_ATTR_PMKR0_NAME is set, %NL80211_ATTR_PMK specifies the
+ * PMK-R0, otherwise it specifies the PMK.
+ * @NL80211_CMD_DEL_PMK: For offloaded 4-Way handshake, delete the previously
+ * configured PMK for the authenticator address identified by
+ * %NL80211_ATTR_MAC.
+ * @NL80211_CMD_PORT_AUTHORIZED: An event that indicates that the 4 way
+ * handshake was completed successfully by the driver. The BSSID is
+ * specified with %NL80211_ATTR_MAC. Drivers that support 4 way handshake
+ * offload should send this event after indicating 802.11 association with
+ * %NL80211_CMD_CONNECT or %NL80211_CMD_ROAM. If the 4 way handshake failed
+ * %NL80211_CMD_DISCONNECT should be indicated instead.
+ *
+ * @NL80211_CMD_CONTROL_PORT_FRAME: Control Port (e.g. PAE) frame TX request
+ * and RX notification. This command is used both as a request to transmit
+ * a control port frame and as a notification that a control port frame
+ * has been received. %NL80211_ATTR_FRAME is used to specify the
+ * frame contents. The frame is the raw EAPoL data, without ethernet or
+ * 802.11 headers.
+ * When used as an event indication %NL80211_ATTR_CONTROL_PORT_ETHERTYPE,
+ * %NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT and %NL80211_ATTR_MAC are added
+ * indicating the protocol type of the received frame; whether the frame
+ * was received unencrypted and the MAC address of the peer respectively.
+ *
+ * @NL80211_CMD_RELOAD_REGDB: Request that the regdb firmware file is reloaded.
+ *
+ * @NL80211_CMD_EXTERNAL_AUTH: This interface is exclusively defined for host
+ * drivers that do not define separate commands for authentication and
+ * association, but rely on user space for the authentication to happen.
+ * This interface acts both as the event request (driver to user space)
+ * to trigger the authentication and command response (userspace to
+ * driver) to indicate the authentication status.
+ *
+ * User space uses the %NL80211_CMD_CONNECT command to the host driver to
+ * trigger a connection. The host driver selects a BSS and further uses
+ * this interface to offload only the authentication part to the user
+ * space. Authentication frames are passed between the driver and user
+ * space through the %NL80211_CMD_FRAME interface. Host driver proceeds
+ * further with the association after getting successful authentication
+ * status. User space indicates the authentication status through
+ * %NL80211_ATTR_STATUS_CODE attribute in %NL80211_CMD_EXTERNAL_AUTH
+ * command interface.
+ *
+ * Host driver reports this status on an authentication failure to the
+ * user space through the connect result as the user space would have
+ * initiated the connection through the connect request.
+ *
+ * @NL80211_CMD_STA_OPMODE_CHANGED: An event that notify station's
+ * ht opmode or vht opmode changes using any of %NL80211_ATTR_SMPS_MODE,
+ * %NL80211_ATTR_CHANNEL_WIDTH,%NL80211_ATTR_NSS attributes with its
+ * address(specified in %NL80211_ATTR_MAC).
+ *
+ * @NL80211_CMD_GET_FTM_RESPONDER_STATS: Retrieve FTM responder statistics, in
+ * the %NL80211_ATTR_FTM_RESPONDER_STATS attribute.
+ *
+ * @NL80211_CMD_PEER_MEASUREMENT_START: start a (set of) peer measurement(s)
+ * with the given parameters, which are encapsulated in the nested
+ * %NL80211_ATTR_PEER_MEASUREMENTS attribute. Optionally, MAC address
+ * randomization may be enabled and configured by specifying the
+ * %NL80211_ATTR_MAC and %NL80211_ATTR_MAC_MASK attributes.
+ * If a timeout is requested, use the %NL80211_ATTR_TIMEOUT attribute.
+ * A u64 cookie for further %NL80211_ATTR_COOKIE use is is returned in
+ * the netlink extended ack message.
+ *
+ * To cancel a measurement, close the socket that requested it.
+ *
+ * Measurement results are reported to the socket that requested the
+ * measurement using @NL80211_CMD_PEER_MEASUREMENT_RESULT when they
+ * become available, so applications must ensure a large enough socket
+ * buffer size.
+ *
+ * Depending on driver support it may or may not be possible to start
+ * multiple concurrent measurements.
+ * @NL80211_CMD_PEER_MEASUREMENT_RESULT: This command number is used for the
+ * result notification from the driver to the requesting socket.
+ * @NL80211_CMD_PEER_MEASUREMENT_COMPLETE: Notification only, indicating that
+ * the measurement completed, using the measurement cookie
+ * (%NL80211_ATTR_COOKIE).
+ *
+ * @NL80211_CMD_NOTIFY_RADAR: Notify the kernel that a radar signal was
+ * detected and reported by a neighboring device on the channel
+ * indicated by %NL80211_ATTR_WIPHY_FREQ and other attributes
+ * determining the width and type.
+ *
+ * @NL80211_CMD_UPDATE_OWE_INFO: This interface allows the host driver to
+ * offload OWE processing to user space. This intends to support
+ * OWE AKM by the host drivers that implement SME but rely
+ * on the user space for the cryptographic/DH IE processing in AP mode.
+ *
+ * @NL80211_CMD_PROBE_MESH_LINK: The requirement for mesh link metric
+ * refreshing, is that from one mesh point we be able to send some data
+ * frames to other mesh points which are not currently selected as a
+ * primary traffic path, but which are only 1 hop away. The absence of
+ * the primary path to the chosen node makes it necessary to apply some
+ * form of marking on a chosen packet stream so that the packets can be
+ * properly steered to the selected node for testing, and not by the
+ * regular mesh path lookup. Further, the packets must be of type data
+ * so that the rate control (often embedded in firmware) is used for
+ * rate selection.
+ *
+ * Here attribute %NL80211_ATTR_MAC is used to specify connected mesh
+ * peer MAC address and %NL80211_ATTR_FRAME is used to specify the frame
+ * content. The frame is ethernet data.
+ *
* @NL80211_CMD_MAX: highest used command number
* @__NL80211_CMD_AFTER_LAST: internal use
*/
@@ -1143,6 +1324,31 @@ enum nl80211_commands {
NL80211_CMD_UPDATE_CONNECT_PARAMS,
+ NL80211_CMD_SET_PMK,
+ NL80211_CMD_DEL_PMK,
+
+ NL80211_CMD_PORT_AUTHORIZED,
+
+ NL80211_CMD_RELOAD_REGDB,
+
+ NL80211_CMD_EXTERNAL_AUTH,
+
+ NL80211_CMD_STA_OPMODE_CHANGED,
+
+ NL80211_CMD_CONTROL_PORT_FRAME,
+
+ NL80211_CMD_GET_FTM_RESPONDER_STATS,
+
+ NL80211_CMD_PEER_MEASUREMENT_START,
+ NL80211_CMD_PEER_MEASUREMENT_RESULT,
+ NL80211_CMD_PEER_MEASUREMENT_COMPLETE,
+
+ NL80211_CMD_NOTIFY_RADAR,
+
+ NL80211_CMD_UPDATE_OWE_INFO,
+
+ NL80211_CMD_PROBE_MESH_LINK,
+
/* add new commands above here */
/* used to define NL80211_CMD_MAX below */
@@ -1365,8 +1571,12 @@ enum nl80211_commands {
*
* @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is
* used for the association (&enum nl80211_mfp, represented as a u32);
- * this attribute can be used
- * with %NL80211_CMD_ASSOCIATE and %NL80211_CMD_CONNECT requests
+ * this attribute can be used with %NL80211_CMD_ASSOCIATE and
+ * %NL80211_CMD_CONNECT requests. %NL80211_MFP_OPTIONAL is not allowed for
+ * %NL80211_CMD_ASSOCIATE since user space SME is expected and hence, it
+ * must have decided whether to use management frame protection or not.
+ * Setting %NL80211_MFP_OPTIONAL with a %NL80211_CMD_CONNECT request will
+ * let the driver (or the firmware) decide whether to use MFP or not.
*
* @NL80211_ATTR_STA_FLAGS2: Attribute containing a
* &struct nl80211_sta_flag_update.
@@ -1386,6 +1596,15 @@ enum nl80211_commands {
* @NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT: When included along with
* %NL80211_ATTR_CONTROL_PORT_ETHERTYPE, indicates that the custom
* ethertype frames used for key negotiation must not be encrypted.
+ * @NL80211_ATTR_CONTROL_PORT_OVER_NL80211: A flag indicating whether control
+ * port frames (e.g. of type given in %NL80211_ATTR_CONTROL_PORT_ETHERTYPE)
+ * will be sent directly to the network interface or sent via the NL80211
+ * socket. If this attribute is missing, then legacy behavior of sending
+ * control port frames directly to the network interface is used. If the
+ * flag is included, then control port frames are sent over NL80211 instead
+ * using %CMD_CONTROL_PORT_FRAME. If control port routing over NL80211 is
+ * to be used then userspace must also use the %NL80211_ATTR_SOCKET_OWNER
+ * flag.
*
* @NL80211_ATTR_TESTDATA: Testmode data blob, passed through to the driver.
* We recommend using nested, driver-specific attributes within this.
@@ -1410,6 +1629,12 @@ enum nl80211_commands {
* (a u32 with flags from &enum nl80211_wpa_versions).
* @NL80211_ATTR_AKM_SUITES: Used with CONNECT, ASSOCIATE, and NEW_BEACON to
* indicate which key management algorithm(s) to use (an array of u32).
+ * This attribute is also sent in response to @NL80211_CMD_GET_WIPHY,
+ * indicating the supported AKM suites, intended for specific drivers which
+ * implement SME and have constraints on which AKMs are supported and also
+ * the cases where an AKM support is offloaded to the driver/firmware.
+ * If there is no such notification from the driver, user space should
+ * assume the driver supports all the AKM suites.
*
* @NL80211_ATTR_REQ_IE: (Re)association request information elements as
* sent out by the card, for ROAM and successful CONNECT events.
@@ -1586,7 +1811,7 @@ enum nl80211_commands {
* the values passed in @NL80211_ATTR_SCAN_SSIDS (eg. if an SSID
* is included in the probe request, but the match attributes
* will never let it go through), -EINVAL may be returned.
- * If ommited, no filtering is done.
+ * If omitted, no filtering is done.
*
* @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported
* interface combinations. In each nested item, it contains attributes
@@ -1691,7 +1916,7 @@ enum nl80211_commands {
*
* @NL80211_ATTR_INACTIVITY_TIMEOUT: timeout value in seconds, this can be
* used by the drivers which has MLME in firmware and does not have support
- * to report per station tx/rx activity to free up the staion entry from
+ * to report per station tx/rx activity to free up the station entry from
* the list. This needs to be used when the driver advertises the
* capability to timeout the stations.
*
@@ -1822,7 +2047,9 @@ enum nl80211_commands {
*
* @NL80211_ATTR_OPMODE_NOTIF: Operating mode field from Operating Mode
* Notification Element based on association request when used with
- * %NL80211_CMD_NEW_STATION; u8 attribute.
+ * %NL80211_CMD_NEW_STATION or %NL80211_CMD_SET_STATION (only when
+ * %NL80211_FEATURE_FULL_AP_CLIENT_STATE is supported, or with TDLS);
+ * u8 attribute.
*
* @NL80211_ATTR_VENDOR_ID: The vendor ID, either a 24-bit OUI or, if
* %NL80211_VENDOR_ID_IS_LINUX is set, a special Linux ID (not used yet)
@@ -1865,11 +2092,18 @@ enum nl80211_commands {
* that configured the indoor setting, and the indoor operation would be
* cleared when the socket is closed.
* If set during NAN interface creation, the interface will be destroyed
- * if the socket is closed just like any other interface. Moreover, only
- * the netlink socket that created the interface will be allowed to add
- * and remove functions. NAN notifications will be sent in unicast to that
- * socket. Without this attribute, any socket can add functions and the
- * notifications will be sent to the %NL80211_MCGRP_NAN multicast group.
+ * if the socket is closed just like any other interface. Moreover, NAN
+ * notifications will be sent in unicast to that socket. Without this
+ * attribute, the notifications will be sent to the %NL80211_MCGRP_NAN
+ * multicast group.
+ * If set during %NL80211_CMD_ASSOCIATE or %NL80211_CMD_CONNECT the
+ * station will deauthenticate when the socket is closed.
+ * If set during %NL80211_CMD_JOIN_IBSS the IBSS will be automatically
+ * torn down when the socket is closed.
+ * If set during %NL80211_CMD_JOIN_MESH the mesh setup will be
+ * automatically torn down when the socket is closed.
+ * If set during %NL80211_CMD_START_AP the AP will be automatically
+ * disabled when the socket is closed.
*
* @NL80211_ATTR_TDLS_INITIATOR: flag attribute indicating the current end is
* the TDLS link initiator.
@@ -2009,10 +2243,13 @@ enum nl80211_commands {
* %NL80211_CMD_CHANGE_NAN_CONFIG. Its type is u8 and it can't be 0.
* Also, values 1 and 255 are reserved for certification purposes and
* should not be used during a normal device operation.
- * @NL80211_ATTR_NAN_DUAL: NAN dual band operation config (see
- * &enum nl80211_nan_dual_band_conf). This attribute is used with
- * %NL80211_CMD_START_NAN and optionally with
- * %NL80211_CMD_CHANGE_NAN_CONFIG.
+ * @NL80211_ATTR_BANDS: operating bands configuration. This is a u32
+ * bitmask of BIT(NL80211_BAND_*) as described in %enum
+ * nl80211_band. For instance, for NL80211_BAND_2GHZ, bit 0
+ * would be set. This attribute is used with
+ * %NL80211_CMD_START_NAN and %NL80211_CMD_CHANGE_NAN_CONFIG, and
+ * it is optional. If no bands are set, it means don't-care and
+ * the device will decide what to use.
* @NL80211_ATTR_NAN_FUNC: a function that can be added to NAN. See
* &enum nl80211_nan_func_attributes for description of this nested
* attribute.
@@ -2040,7 +2277,7 @@ enum nl80211_commands {
*
* @NL80211_ATTR_SCHED_SCAN_RSSI_ADJUST: When present the RSSI level for BSSs in
* the specified band is to be adjusted before doing
- * %NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI based comparision to figure out
+ * %NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI based comparison to figure out
* better BSSs. The attribute value is a packed structure
* value as specified by &struct nl80211_bss_select_rssi_adjust.
*
@@ -2070,12 +2307,98 @@ enum nl80211_commands {
* identifying the scope of PMKSAs. This is used with
* @NL80211_CMD_SET_PMKSA and @NL80211_CMD_DEL_PMKSA.
*
- * @NL80211_ATTR_PMK: PMK for the PMKSA identified by %NL80211_ATTR_PMKID.
- * This is used with @NL80211_CMD_SET_PMKSA.
- * @NL80211_ATTR_PORT_AUTHORIZED: flag attribute used in %NL80211_CMD_ROAMED
- * notification indicating that that 802.1X authentication was done by
- * the driver or is not needed (because roaming used the Fast Transition
- * protocol).
+ * @NL80211_ATTR_PMK: attribute for passing PMK key material. Used with
+ * %NL80211_CMD_SET_PMKSA for the PMKSA identified by %NL80211_ATTR_PMKID.
+ * For %NL80211_CMD_CONNECT it is used to provide PSK for offloading 4-way
+ * handshake for WPA/WPA2-PSK networks. For 802.1X authentication it is
+ * used with %NL80211_CMD_SET_PMK. For offloaded FT support this attribute
+ * specifies the PMK-R0 if NL80211_ATTR_PMKR0_NAME is included as well.
+ *
+ * @NL80211_ATTR_SCHED_SCAN_MULTI: flag attribute which user-space shall use to
+ * indicate that it supports multiple active scheduled scan requests.
+ * @NL80211_ATTR_SCHED_SCAN_MAX_REQS: indicates maximum number of scheduled
+ * scan request that may be active for the device (u32).
+ *
+ * @NL80211_ATTR_WANT_1X_4WAY_HS: flag attribute which user-space can include
+ * in %NL80211_CMD_CONNECT to indicate that for 802.1X authentication it
+ * wants to use the supported offload of the 4-way handshake.
+ * @NL80211_ATTR_PMKR0_NAME: PMK-R0 Name for offloaded FT.
+ * @NL80211_ATTR_PORT_AUTHORIZED: (reserved)
+ *
+ * @NL80211_ATTR_EXTERNAL_AUTH_ACTION: Identify the requested external
+ * authentication operation (u32 attribute with an
+ * &enum nl80211_external_auth_action value). This is used with the
+ * %NL80211_CMD_EXTERNAL_AUTH request event.
+ * @NL80211_ATTR_EXTERNAL_AUTH_SUPPORT: Flag attribute indicating that the user
+ * space supports external authentication. This attribute shall be used
+ * with %NL80211_CMD_CONNECT and %NL80211_CMD_START_AP request. The driver
+ * may offload authentication processing to user space if this capability
+ * is indicated in the respective requests from the user space.
+ *
+ * @NL80211_ATTR_NSS: Station's New/updated RX_NSS value notified using this
+ * u8 attribute. This is used with %NL80211_CMD_STA_OPMODE_CHANGED.
+ *
+ * @NL80211_ATTR_TXQ_STATS: TXQ statistics (nested attribute, see &enum
+ * nl80211_txq_stats)
+ * @NL80211_ATTR_TXQ_LIMIT: Total packet limit for the TXQ queues for this phy.
+ * The smaller of this and the memory limit is enforced.
+ * @NL80211_ATTR_TXQ_MEMORY_LIMIT: Total memory memory limit (in bytes) for the
+ * TXQ queues for this phy. The smaller of this and the packet limit is
+ * enforced.
+ * @NL80211_ATTR_TXQ_QUANTUM: TXQ scheduler quantum (bytes). Number of bytes
+ * a flow is assigned on each round of the DRR scheduler.
+ * @NL80211_ATTR_HE_CAPABILITY: HE Capability information element (from
+ * association request when used with NL80211_CMD_NEW_STATION). Can be set
+ * only if %NL80211_STA_FLAG_WME is set.
+ *
+ * @NL80211_ATTR_FTM_RESPONDER: nested attribute which user-space can include
+ * in %NL80211_CMD_START_AP or %NL80211_CMD_SET_BEACON for fine timing
+ * measurement (FTM) responder functionality and containing parameters as
+ * possible, see &enum nl80211_ftm_responder_attr
+ *
+ * @NL80211_ATTR_FTM_RESPONDER_STATS: Nested attribute with FTM responder
+ * statistics, see &enum nl80211_ftm_responder_stats.
+ *
+ * @NL80211_ATTR_TIMEOUT: Timeout for the given operation in milliseconds (u32),
+ * if the attribute is not given no timeout is requested. Note that 0 is an
+ * invalid value.
+ *
+ * @NL80211_ATTR_PEER_MEASUREMENTS: peer measurements request (and result)
+ * data, uses nested attributes specified in
+ * &enum nl80211_peer_measurement_attrs.
+ * This is also used for capability advertisement in the wiphy information,
+ * with the appropriate sub-attributes.
+ *
+ * @NL80211_ATTR_AIRTIME_WEIGHT: Station's weight when scheduled by the airtime
+ * scheduler.
+ *
+ * @NL80211_ATTR_STA_TX_POWER_SETTING: Transmit power setting type (u8) for
+ * station associated with the AP. See &enum nl80211_tx_power_setting for
+ * possible values.
+ * @NL80211_ATTR_STA_TX_POWER: Transmit power level (s16) in dBm units. This
+ * allows to set Tx power for a station. If this attribute is not included,
+ * the default per-interface tx power setting will be overriding. Driver
+ * should be picking up the lowest tx power, either tx power per-interface
+ * or per-station.
+ *
+ * @NL80211_ATTR_SAE_PASSWORD: attribute for passing SAE password material. It
+ * is used with %NL80211_CMD_CONNECT to provide password for offloading
+ * SAE authentication for WPA3-Personal networks.
+ *
+ * @NL80211_ATTR_TWT_RESPONDER: Enable target wait time responder support.
+ *
+ * @NL80211_ATTR_HE_OBSS_PD: nested attribute for OBSS Packet Detection
+ * functionality.
+ *
+ * @NL80211_ATTR_WIPHY_EDMG_CHANNELS: bitmap that indicates the 2.16 GHz
+ * channel(s) that are allowed to be used for EDMG transmissions.
+ * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251. (u8 attribute)
+ * @NL80211_ATTR_WIPHY_EDMG_BW_CONFIG: Channel BW Configuration subfield encodes
+ * the allowed channel bandwidth configurations. (u8 attribute)
+ * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13.
+ *
+ * @NL80211_ATTR_VLAN_ID: VLAN ID (1..4094) for the station and VLAN group key
+ * (u16).
*
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2472,7 +2795,7 @@ enum nl80211_attrs {
NL80211_ATTR_MESH_PEER_AID,
NL80211_ATTR_NAN_MASTER_PREF,
- NL80211_ATTR_NAN_DUAL,
+ NL80211_ATTR_BANDS,
NL80211_ATTR_NAN_FUNC,
NL80211_ATTR_NAN_MATCH,
@@ -2503,6 +2826,44 @@ enum nl80211_attrs {
NL80211_ATTR_PMKR0_NAME,
NL80211_ATTR_PORT_AUTHORIZED,
+ NL80211_ATTR_EXTERNAL_AUTH_ACTION,
+ NL80211_ATTR_EXTERNAL_AUTH_SUPPORT,
+
+ NL80211_ATTR_NSS,
+ NL80211_ATTR_ACK_SIGNAL,
+
+ NL80211_ATTR_CONTROL_PORT_OVER_NL80211,
+
+ NL80211_ATTR_TXQ_STATS,
+ NL80211_ATTR_TXQ_LIMIT,
+ NL80211_ATTR_TXQ_MEMORY_LIMIT,
+ NL80211_ATTR_TXQ_QUANTUM,
+
+ NL80211_ATTR_HE_CAPABILITY,
+
+ NL80211_ATTR_FTM_RESPONDER,
+
+ NL80211_ATTR_FTM_RESPONDER_STATS,
+
+ NL80211_ATTR_TIMEOUT,
+
+ NL80211_ATTR_PEER_MEASUREMENTS,
+
+ NL80211_ATTR_AIRTIME_WEIGHT,
+ NL80211_ATTR_STA_TX_POWER_SETTING,
+ NL80211_ATTR_STA_TX_POWER,
+
+ NL80211_ATTR_SAE_PASSWORD,
+
+ NL80211_ATTR_TWT_RESPONDER,
+
+ NL80211_ATTR_HE_OBSS_PD,
+
+ NL80211_ATTR_WIPHY_EDMG_CHANNELS,
+ NL80211_ATTR_WIPHY_EDMG_BW_CONFIG,
+
+ NL80211_ATTR_VLAN_ID,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@@ -2542,15 +2903,18 @@ enum nl80211_attrs {
#define NL80211_ATTR_KEYS NL80211_ATTR_KEYS
#define NL80211_ATTR_FEATURE_FLAGS NL80211_ATTR_FEATURE_FLAGS
+#define NL80211_WIPHY_NAME_MAXLEN 64
+
#define NL80211_MAX_SUPP_RATES 32
#define NL80211_MAX_SUPP_HT_RATES 77
-#define NL80211_MAX_SUPP_REG_RULES 64
+#define NL80211_MAX_SUPP_REG_RULES 128
#define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0
#define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16
#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24
#define NL80211_HT_CAPABILITY_LEN 26
#define NL80211_VHT_CAPABILITY_LEN 12
-
+#define NL80211_HE_MIN_CAPABILITY_LEN 16
+#define NL80211_HE_MAX_CAPABILITY_LEN 54
#define NL80211_MAX_NR_CIPHER_SUITES 5
#define NL80211_MAX_NR_AKM_SUITES 2
@@ -2678,6 +3042,38 @@ struct nl80211_sta_flag_update {
} __attribute__((packed));
/**
+ * enum nl80211_he_gi - HE guard interval
+ * @NL80211_RATE_INFO_HE_GI_0_8: 0.8 usec
+ * @NL80211_RATE_INFO_HE_GI_1_6: 1.6 usec
+ * @NL80211_RATE_INFO_HE_GI_3_2: 3.2 usec
+ */
+enum nl80211_he_gi {
+ NL80211_RATE_INFO_HE_GI_0_8,
+ NL80211_RATE_INFO_HE_GI_1_6,
+ NL80211_RATE_INFO_HE_GI_3_2,
+};
+
+/**
+ * enum nl80211_he_ru_alloc - HE RU allocation values
+ * @NL80211_RATE_INFO_HE_RU_ALLOC_26: 26-tone RU allocation
+ * @NL80211_RATE_INFO_HE_RU_ALLOC_52: 52-tone RU allocation
+ * @NL80211_RATE_INFO_HE_RU_ALLOC_106: 106-tone RU allocation
+ * @NL80211_RATE_INFO_HE_RU_ALLOC_242: 242-tone RU allocation
+ * @NL80211_RATE_INFO_HE_RU_ALLOC_484: 484-tone RU allocation
+ * @NL80211_RATE_INFO_HE_RU_ALLOC_996: 996-tone RU allocation
+ * @NL80211_RATE_INFO_HE_RU_ALLOC_2x996: 2x996-tone RU allocation
+ */
+enum nl80211_he_ru_alloc {
+ NL80211_RATE_INFO_HE_RU_ALLOC_26,
+ NL80211_RATE_INFO_HE_RU_ALLOC_52,
+ NL80211_RATE_INFO_HE_RU_ALLOC_106,
+ NL80211_RATE_INFO_HE_RU_ALLOC_242,
+ NL80211_RATE_INFO_HE_RU_ALLOC_484,
+ NL80211_RATE_INFO_HE_RU_ALLOC_996,
+ NL80211_RATE_INFO_HE_RU_ALLOC_2x996,
+};
+
+/**
* enum nl80211_rate_info - bitrate information
*
* These attribute types are used with %NL80211_STA_INFO_TXRATE
@@ -2709,6 +3105,13 @@ struct nl80211_sta_flag_update {
* @NL80211_RATE_INFO_5_MHZ_WIDTH: 5 MHz width - note that this is
* a legacy rate and will be reported as the actual bitrate, i.e.
* a quarter of the base (20 MHz) rate
+ * @NL80211_RATE_INFO_HE_MCS: HE MCS index (u8, 0-11)
+ * @NL80211_RATE_INFO_HE_NSS: HE NSS value (u8, 1-8)
+ * @NL80211_RATE_INFO_HE_GI: HE guard interval identifier
+ * (u8, see &enum nl80211_he_gi)
+ * @NL80211_RATE_INFO_HE_DCM: HE DCM value (u8, 0/1)
+ * @NL80211_RATE_INFO_RU_ALLOC: HE RU allocation, if not present then
+ * non-OFDMA was used (u8, see &enum nl80211_he_ru_alloc)
* @__NL80211_RATE_INFO_AFTER_LAST: internal use
*/
enum nl80211_rate_info {
@@ -2725,6 +3128,11 @@ enum nl80211_rate_info {
NL80211_RATE_INFO_160_MHZ_WIDTH,
NL80211_RATE_INFO_10_MHZ_WIDTH,
NL80211_RATE_INFO_5_MHZ_WIDTH,
+ NL80211_RATE_INFO_HE_MCS,
+ NL80211_RATE_INFO_HE_NSS,
+ NL80211_RATE_INFO_HE_GI,
+ NL80211_RATE_INFO_HE_DCM,
+ NL80211_RATE_INFO_HE_RU_ALLOC,
/* keep last */
__NL80211_RATE_INFO_AFTER_LAST,
@@ -2823,6 +3231,22 @@ enum nl80211_sta_bss_param {
* @NL80211_STA_INFO_RX_DURATION: aggregate PPDU duration for all frames
* received from the station (u64, usec)
* @NL80211_STA_INFO_PAD: attribute used for padding for 64-bit alignment
+ * @NL80211_STA_INFO_ACK_SIGNAL: signal strength of the last ACK frame(u8, dBm)
+ * @NL80211_STA_INFO_ACK_SIGNAL_AVG: avg signal strength of ACK frames (s8, dBm)
+ * @NL80211_STA_INFO_RX_MPDUS: total number of received packets (MPDUs)
+ * (u32, from this station)
+ * @NL80211_STA_INFO_FCS_ERROR_COUNT: total number of packets (MPDUs) received
+ * with an FCS error (u32, from this station). This count may not include
+ * some packets with an FCS error due to TA corruption. Hence this counter
+ * might not be fully accurate.
+ * @NL80211_STA_INFO_CONNECTED_TO_GATE: set to true if STA has a path to a
+ * mesh gate (u8, 0 or 1)
+ * @NL80211_STA_INFO_TX_DURATION: aggregate PPDU duration for all frames
+ * sent to the station (u64, usec)
+ * @NL80211_STA_INFO_AIRTIME_WEIGHT: current airtime weight for station (u16)
+ * @NL80211_STA_INFO_AIRTIME_LINK_METRIC: airtime link metric for mesh station
+ * @NL80211_STA_INFO_ASSOC_AT_BOOTTIME: Timestamp (CLOCK_BOOTTIME, nanoseconds)
+ * of STA's association
* @__NL80211_STA_INFO_AFTER_LAST: internal
* @NL80211_STA_INFO_MAX: highest possible station info attribute
*/
@@ -2861,12 +3285,25 @@ enum nl80211_sta_info {
NL80211_STA_INFO_TID_STATS,
NL80211_STA_INFO_RX_DURATION,
NL80211_STA_INFO_PAD,
+ NL80211_STA_INFO_ACK_SIGNAL,
+ NL80211_STA_INFO_ACK_SIGNAL_AVG,
+ NL80211_STA_INFO_RX_MPDUS,
+ NL80211_STA_INFO_FCS_ERROR_COUNT,
+ NL80211_STA_INFO_CONNECTED_TO_GATE,
+ NL80211_STA_INFO_TX_DURATION,
+ NL80211_STA_INFO_AIRTIME_WEIGHT,
+ NL80211_STA_INFO_AIRTIME_LINK_METRIC,
+ NL80211_STA_INFO_ASSOC_AT_BOOTTIME,
/* keep last */
__NL80211_STA_INFO_AFTER_LAST,
NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1
};
+/* we renamed this - stay compatible */
+#define NL80211_STA_INFO_DATA_ACK_SIGNAL_AVG NL80211_STA_INFO_ACK_SIGNAL_AVG
+
+
/**
* enum nl80211_tid_stats - per TID statistics attributes
* @__NL80211_TID_STATS_INVALID: attribute number 0 is reserved
@@ -2878,6 +3315,7 @@ enum nl80211_sta_info {
* @NL80211_TID_STATS_TX_MSDU_FAILED: number of failed transmitted
* MSDUs (u64)
* @NL80211_TID_STATS_PAD: attribute used for padding for 64-bit alignment
+ * @NL80211_TID_STATS_TXQ_STATS: TXQ stats (nested attribute)
* @NUM_NL80211_TID_STATS: number of attributes here
* @NL80211_TID_STATS_MAX: highest numbered attribute here
*/
@@ -2888,6 +3326,7 @@ enum nl80211_tid_stats {
NL80211_TID_STATS_TX_MSDU_RETRIES,
NL80211_TID_STATS_TX_MSDU_FAILED,
NL80211_TID_STATS_PAD,
+ NL80211_TID_STATS_TXQ_STATS,
/* keep last */
NUM_NL80211_TID_STATS,
@@ -2895,6 +3334,44 @@ enum nl80211_tid_stats {
};
/**
+ * enum nl80211_txq_stats - per TXQ statistics attributes
+ * @__NL80211_TXQ_STATS_INVALID: attribute number 0 is reserved
+ * @NUM_NL80211_TXQ_STATS: number of attributes here
+ * @NL80211_TXQ_STATS_BACKLOG_BYTES: number of bytes currently backlogged
+ * @NL80211_TXQ_STATS_BACKLOG_PACKETS: number of packets currently
+ * backlogged
+ * @NL80211_TXQ_STATS_FLOWS: total number of new flows seen
+ * @NL80211_TXQ_STATS_DROPS: total number of packet drops
+ * @NL80211_TXQ_STATS_ECN_MARKS: total number of packet ECN marks
+ * @NL80211_TXQ_STATS_OVERLIMIT: number of drops due to queue space overflow
+ * @NL80211_TXQ_STATS_OVERMEMORY: number of drops due to memory limit overflow
+ * (only for per-phy stats)
+ * @NL80211_TXQ_STATS_COLLISIONS: number of hash collisions
+ * @NL80211_TXQ_STATS_TX_BYTES: total number of bytes dequeued from TXQ
+ * @NL80211_TXQ_STATS_TX_PACKETS: total number of packets dequeued from TXQ
+ * @NL80211_TXQ_STATS_MAX_FLOWS: number of flow buckets for PHY
+ * @NL80211_TXQ_STATS_MAX: highest numbered attribute here
+ */
+enum nl80211_txq_stats {
+ __NL80211_TXQ_STATS_INVALID,
+ NL80211_TXQ_STATS_BACKLOG_BYTES,
+ NL80211_TXQ_STATS_BACKLOG_PACKETS,
+ NL80211_TXQ_STATS_FLOWS,
+ NL80211_TXQ_STATS_DROPS,
+ NL80211_TXQ_STATS_ECN_MARKS,
+ NL80211_TXQ_STATS_OVERLIMIT,
+ NL80211_TXQ_STATS_OVERMEMORY,
+ NL80211_TXQ_STATS_COLLISIONS,
+ NL80211_TXQ_STATS_TX_BYTES,
+ NL80211_TXQ_STATS_TX_PACKETS,
+ NL80211_TXQ_STATS_MAX_FLOWS,
+
+ /* keep last */
+ NUM_NL80211_TXQ_STATS,
+ NL80211_TXQ_STATS_MAX = NUM_NL80211_TXQ_STATS - 1
+};
+
+/**
* enum nl80211_mpath_flags - nl80211 mesh path flags
*
* @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active
@@ -2926,8 +3403,10 @@ enum nl80211_mpath_flags {
* &enum nl80211_mpath_flags;
* @NL80211_MPATH_INFO_DISCOVERY_TIMEOUT: total path discovery timeout, in msec
* @NL80211_MPATH_INFO_DISCOVERY_RETRIES: mesh path discovery retries
+ * @NL80211_MPATH_INFO_HOP_COUNT: hop count to destination
+ * @NL80211_MPATH_INFO_PATH_CHANGE: total number of path changes to destination
* @NL80211_MPATH_INFO_MAX: highest mesh path information attribute number
- * currently defind
+ * currently defined
* @__NL80211_MPATH_INFO_AFTER_LAST: internal use
*/
enum nl80211_mpath_info {
@@ -2939,6 +3418,8 @@ enum nl80211_mpath_info {
NL80211_MPATH_INFO_FLAGS,
NL80211_MPATH_INFO_DISCOVERY_TIMEOUT,
NL80211_MPATH_INFO_DISCOVERY_RETRIES,
+ NL80211_MPATH_INFO_HOP_COUNT,
+ NL80211_MPATH_INFO_PATH_CHANGE,
/* keep last */
__NL80211_MPATH_INFO_AFTER_LAST,
@@ -2946,6 +3427,38 @@ enum nl80211_mpath_info {
};
/**
+ * enum nl80211_band_iftype_attr - Interface type data attributes
+ *
+ * @__NL80211_BAND_IFTYPE_ATTR_INVALID: attribute number 0 is reserved
+ * @NL80211_BAND_IFTYPE_ATTR_IFTYPES: nested attribute containing a flag attribute
+ * for each interface type that supports the band data
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC: HE MAC capabilities as in HE
+ * capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY: HE PHY capabilities as in HE
+ * capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET: HE supported NSS/MCS as in HE
+ * capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE: HE PPE thresholds information as
+ * defined in HE capabilities IE
+ * @NL80211_BAND_IFTYPE_ATTR_MAX: highest band HE capability attribute currently
+ * defined
+ * @__NL80211_BAND_IFTYPE_ATTR_AFTER_LAST: internal use
+ */
+enum nl80211_band_iftype_attr {
+ __NL80211_BAND_IFTYPE_ATTR_INVALID,
+
+ NL80211_BAND_IFTYPE_ATTR_IFTYPES,
+ NL80211_BAND_IFTYPE_ATTR_HE_CAP_MAC,
+ NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY,
+ NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET,
+ NL80211_BAND_IFTYPE_ATTR_HE_CAP_PPE,
+
+ /* keep last */
+ __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST,
+ NL80211_BAND_IFTYPE_ATTR_MAX = __NL80211_BAND_IFTYPE_ATTR_AFTER_LAST - 1
+};
+
+/**
* enum nl80211_band_attr - band attributes
* @__NL80211_BAND_ATTR_INVALID: attribute number 0 is reserved
* @NL80211_BAND_ATTR_FREQS: supported frequencies in this band,
@@ -2960,6 +3473,14 @@ enum nl80211_mpath_info {
* @NL80211_BAND_ATTR_VHT_MCS_SET: 32-byte attribute containing the MCS set as
* defined in 802.11ac
* @NL80211_BAND_ATTR_VHT_CAPA: VHT capabilities, as in the HT information IE
+ * @NL80211_BAND_ATTR_IFTYPE_DATA: nested array attribute, with each entry using
+ * attributes from &enum nl80211_band_iftype_attr
+ * @NL80211_BAND_ATTR_EDMG_CHANNELS: bitmap that indicates the 2.16 GHz
+ * channel(s) that are allowed to be used for EDMG transmissions.
+ * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251.
+ * @NL80211_BAND_ATTR_EDMG_BW_CONFIG: Channel BW Configuration subfield encodes
+ * the allowed channel bandwidth configurations.
+ * Defined by IEEE P802.11ay/D4.0 section 9.4.2.251, Table 13.
* @NL80211_BAND_ATTR_MAX: highest band attribute currently defined
* @__NL80211_BAND_ATTR_AFTER_LAST: internal use
*/
@@ -2975,6 +3496,10 @@ enum nl80211_band_attr {
NL80211_BAND_ATTR_VHT_MCS_SET,
NL80211_BAND_ATTR_VHT_CAPA,
+ NL80211_BAND_ATTR_IFTYPE_DATA,
+
+ NL80211_BAND_ATTR_EDMG_CHANNELS,
+ NL80211_BAND_ATTR_EDMG_BW_CONFIG,
/* keep last */
__NL80211_BAND_ATTR_AFTER_LAST,
@@ -2984,6 +3509,29 @@ enum nl80211_band_attr {
#define NL80211_BAND_ATTR_HT_CAPA NL80211_BAND_ATTR_HT_CAPA
/**
+ * enum nl80211_wmm_rule - regulatory wmm rule
+ *
+ * @__NL80211_WMMR_INVALID: attribute number 0 is reserved
+ * @NL80211_WMMR_CW_MIN: Minimum contention window slot.
+ * @NL80211_WMMR_CW_MAX: Maximum contention window slot.
+ * @NL80211_WMMR_AIFSN: Arbitration Inter Frame Space.
+ * @NL80211_WMMR_TXOP: Maximum allowed tx operation time.
+ * @nl80211_WMMR_MAX: highest possible wmm rule.
+ * @__NL80211_WMMR_LAST: Internal use.
+ */
+enum nl80211_wmm_rule {
+ __NL80211_WMMR_INVALID,
+ NL80211_WMMR_CW_MIN,
+ NL80211_WMMR_CW_MAX,
+ NL80211_WMMR_AIFSN,
+ NL80211_WMMR_TXOP,
+
+ /* keep last */
+ __NL80211_WMMR_LAST,
+ NL80211_WMMR_MAX = __NL80211_WMMR_LAST - 1
+};
+
+/**
* enum nl80211_frequency_attr - frequency attributes
* @__NL80211_FREQUENCY_ATTR_INVALID: attribute number 0 is reserved
* @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz
@@ -3032,6 +3580,9 @@ enum nl80211_band_attr {
* on this channel in current regulatory domain.
* @NL80211_FREQUENCY_ATTR_NO_10MHZ: 10 MHz operation is not allowed
* on this channel in current regulatory domain.
+ * @NL80211_FREQUENCY_ATTR_WMM: this channel has wmm limitations.
+ * This is a nested attribute that contains the wmm limitation per AC.
+ * (see &enum nl80211_wmm_rule)
* @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
* currently defined
* @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
@@ -3060,6 +3611,7 @@ enum nl80211_frequency_attr {
NL80211_FREQUENCY_ATTR_IR_CONCURRENT,
NL80211_FREQUENCY_ATTR_NO_20MHZ,
NL80211_FREQUENCY_ATTR_NO_10MHZ,
+ NL80211_FREQUENCY_ATTR_WMM,
/* keep last */
__NL80211_FREQUENCY_ATTR_AFTER_LAST,
@@ -3187,6 +3739,7 @@ enum nl80211_reg_rule_attr {
* @__NL80211_SCHED_SCAN_MATCH_ATTR_INVALID: attribute number 0 is reserved
* @NL80211_SCHED_SCAN_MATCH_ATTR_SSID: SSID to be used for matching,
* only report BSS with matching SSID.
+ * (This cannot be used together with BSSID.)
* @NL80211_SCHED_SCAN_MATCH_ATTR_RSSI: RSSI threshold (in dBm) for reporting a
* BSS in scan results. Filtering is turned off if not specified. Note that
* if this attribute is in a match set of its own, then it is treated as
@@ -3202,6 +3755,16 @@ enum nl80211_reg_rule_attr {
* BSS-es in the specified band is to be adjusted before doing
* RSSI-based BSS selection. The attribute value is a packed structure
* value as specified by &struct nl80211_bss_select_rssi_adjust.
+ * @NL80211_SCHED_SCAN_MATCH_ATTR_BSSID: BSSID to be used for matching
+ * (this cannot be used together with SSID).
+ * @NL80211_SCHED_SCAN_MATCH_PER_BAND_RSSI: Nested attribute that carries the
+ * band specific minimum rssi thresholds for the bands defined in
+ * enum nl80211_band. The minimum rssi threshold value(s32) specific to a
+ * band shall be encapsulated in attribute with type value equals to one
+ * of the NL80211_BAND_* defined in enum nl80211_band. For example, the
+ * minimum rssi threshold value for 2.4GHZ band shall be encapsulated
+ * within an attribute of type NL80211_BAND_2GHZ. And one or more of such
+ * attributes will be nested within this attribute.
* @NL80211_SCHED_SCAN_MATCH_ATTR_MAX: highest scheduled scan filter
* attribute number currently defined
* @__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST: internal use
@@ -3213,6 +3776,8 @@ enum nl80211_sched_scan_match_attr {
NL80211_SCHED_SCAN_MATCH_ATTR_RSSI,
NL80211_SCHED_SCAN_MATCH_ATTR_RELATIVE_RSSI,
NL80211_SCHED_SCAN_MATCH_ATTR_RSSI_ADJUST,
+ NL80211_SCHED_SCAN_MATCH_ATTR_BSSID,
+ NL80211_SCHED_SCAN_MATCH_PER_BAND_RSSI,
/* keep last */
__NL80211_SCHED_SCAN_MATCH_ATTR_AFTER_LAST,
@@ -3239,7 +3804,7 @@ enum nl80211_sched_scan_match_attr {
* @NL80211_RRF_AUTO_BW: maximum available bandwidth should be calculated
* base on contiguous rules and wider channels will be allowed to cross
* multiple contiguous/overlapping frequency ranges.
- * @NL80211_RRF_IR_CONCURRENT: See &NL80211_FREQUENCY_ATTR_IR_CONCURRENT
+ * @NL80211_RRF_IR_CONCURRENT: See %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
* @NL80211_RRF_NO_HT40MINUS: channels can't be used in HT40- operation
* @NL80211_RRF_NO_HT40PLUS: channels can't be used in HT40+ operation
* @NL80211_RRF_NO_80MHZ: 80MHz operation not allowed
@@ -3334,6 +3899,8 @@ enum nl80211_user_reg_hint_type {
* @NL80211_SURVEY_INFO_TIME_SCAN: time the radio spent for scan
* (on this channel or globally)
* @NL80211_SURVEY_INFO_PAD: attribute used for padding for 64-bit alignment
+ * @NL80211_SURVEY_INFO_TIME_BSS_RX: amount of time the radio spent
+ * receiving frames destined to the local BSS
* @NL80211_SURVEY_INFO_MAX: highest survey info attribute number
* currently defined
* @__NL80211_SURVEY_INFO_AFTER_LAST: internal use
@@ -3350,6 +3917,7 @@ enum nl80211_survey_info {
NL80211_SURVEY_INFO_TIME_TX,
NL80211_SURVEY_INFO_TIME_SCAN,
NL80211_SURVEY_INFO_PAD,
+ NL80211_SURVEY_INFO_TIME_BSS_RX,
/* keep last */
__NL80211_SURVEY_INFO_AFTER_LAST,
@@ -3530,6 +4098,11 @@ enum nl80211_mesh_power_mode {
* remove it from the STA's list of peers. You may set this to 0 to disable
* the removal of the STA. Default is 30 minutes.
*
+ * @NL80211_MESHCONF_CONNECTED_TO_GATE: If set to true then this mesh STA
+ * will advertise that it is connected to a gate in the mesh formation
+ * field. If left unset then the mesh formation field will only
+ * advertise such if there is an active root mesh path.
+ *
* @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
*/
enum nl80211_meshconf_params {
@@ -3562,6 +4135,7 @@ enum nl80211_meshconf_params {
NL80211_MESHCONF_POWER_MODE,
NL80211_MESHCONF_AWAKE_WINDOW,
NL80211_MESHCONF_PLINK_TIMEOUT,
+ NL80211_MESHCONF_CONNECTED_TO_GATE,
/* keep last */
__NL80211_MESHCONF_ATTR_AFTER_LAST,
@@ -3692,6 +4266,27 @@ enum nl80211_channel_type {
};
/**
+ * enum nl80211_key_mode - Key mode
+ *
+ * @NL80211_KEY_RX_TX: (Default)
+ * Key can be used for Rx and Tx immediately
+ *
+ * The following modes can only be selected for unicast keys and when the
+ * driver supports @NL80211_EXT_FEATURE_EXT_KEY_ID:
+ *
+ * @NL80211_KEY_NO_TX: Only allowed in combination with @NL80211_CMD_NEW_KEY:
+ * Unicast key can only be used for Rx, Tx not allowed, yet
+ * @NL80211_KEY_SET_TX: Only allowed in combination with @NL80211_CMD_SET_KEY:
+ * The unicast key identified by idx and mac is cleared for Tx and becomes
+ * the preferred Tx key for the station.
+ */
+enum nl80211_key_mode {
+ NL80211_KEY_RX_TX,
+ NL80211_KEY_NO_TX,
+ NL80211_KEY_SET_TX
+};
+
+/**
* enum nl80211_chan_width - channel width definitions
*
* These values are used with the %NL80211_ATTR_CHANNEL_WIDTH
@@ -3885,15 +4480,18 @@ enum nl80211_key_type {
* enum nl80211_mfp - Management frame protection state
* @NL80211_MFP_NO: Management frame protection not used
* @NL80211_MFP_REQUIRED: Management frame protection required
+ * @NL80211_MFP_OPTIONAL: Management frame protection is optional
*/
enum nl80211_mfp {
NL80211_MFP_NO,
NL80211_MFP_REQUIRED,
+ NL80211_MFP_OPTIONAL,
};
enum nl80211_wpa_versions {
NL80211_WPA_VERSION_1 = 1 << 0,
NL80211_WPA_VERSION_2 = 1 << 1,
+ NL80211_WPA_VERSION_3 = 1 << 2,
};
/**
@@ -3932,6 +4530,9 @@ enum nl80211_key_default_types {
* @NL80211_KEY_DEFAULT_TYPES: A nested attribute containing flags
* attributes, specifying what a key should be set as default as.
* See &enum nl80211_key_default_types.
+ * @NL80211_KEY_MODE: the mode from enum nl80211_key_mode.
+ * Defaults to @NL80211_KEY_RX_TX.
+ *
* @__NL80211_KEY_AFTER_LAST: internal
* @NL80211_KEY_MAX: highest key attribute
*/
@@ -3945,6 +4546,7 @@ enum nl80211_key_attributes {
NL80211_KEY_DEFAULT_MGMT,
NL80211_KEY_TYPE,
NL80211_KEY_DEFAULT_TYPES,
+ NL80211_KEY_MODE,
/* keep last */
__NL80211_KEY_AFTER_LAST,
@@ -3999,7 +4601,8 @@ enum nl80211_txrate_gi {
* enum nl80211_band - Frequency band
* @NL80211_BAND_2GHZ: 2.4 GHz ISM band
* @NL80211_BAND_5GHZ: around 5 GHz band (4.9 - 5.7 GHz)
- * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
+ * @NL80211_BAND_60GHZ: around 60 GHz band (58.32 - 69.12 GHz)
+ * @NL80211_BAND_6GHZ: around 6 GHz band (5.9 - 7.2 GHz)
* @NUM_NL80211_BANDS: number of bands, avoid using this in userspace
* since newer kernel versions may support more bands
*/
@@ -4007,6 +4610,7 @@ enum nl80211_band {
NL80211_BAND_2GHZ,
NL80211_BAND_5GHZ,
NL80211_BAND_60GHZ,
+ NL80211_BAND_6GHZ,
NUM_NL80211_BANDS,
};
@@ -4026,7 +4630,10 @@ enum nl80211_ps_state {
* @__NL80211_ATTR_CQM_INVALID: invalid
* @NL80211_ATTR_CQM_RSSI_THOLD: RSSI threshold in dBm. This value specifies
* the threshold for the RSSI level at which an event will be sent. Zero
- * to disable.
+ * to disable. Alternatively, if %NL80211_EXT_FEATURE_CQM_RSSI_LIST is
+ * set, multiple values can be supplied as a low-to-high sorted array of
+ * threshold values in dBm. Events will be sent when the RSSI value
+ * crosses any of the thresholds.
* @NL80211_ATTR_CQM_RSSI_HYST: RSSI hysteresis in dBm. This value specifies
* the minimum amount the RSSI level must change after an event before a
* new event may be issued (to reduce effects of RSSI oscillation).
@@ -4046,6 +4653,8 @@ enum nl80211_ps_state {
* %NL80211_CMD_NOTIFY_CQM. Set to 0 to turn off TX error reporting.
* @NL80211_ATTR_CQM_BEACON_LOSS_EVENT: flag attribute that's set in a beacon
* loss event
+ * @NL80211_ATTR_CQM_RSSI_LEVEL: the RSSI value in dBm that triggered the
+ * RSSI threshold event.
* @__NL80211_ATTR_CQM_AFTER_LAST: internal
* @NL80211_ATTR_CQM_MAX: highest key attribute
*/
@@ -4059,6 +4668,7 @@ enum nl80211_attr_cqm {
NL80211_ATTR_CQM_TXE_PKTS,
NL80211_ATTR_CQM_TXE_INTVL,
NL80211_ATTR_CQM_BEACON_LOSS_EVENT,
+ NL80211_ATTR_CQM_RSSI_LEVEL,
/* keep last */
__NL80211_ATTR_CQM_AFTER_LAST,
@@ -4486,7 +5096,7 @@ enum nl80211_iface_limit_attrs {
* numbers = [ #{STA} <= 1, #{P2P-client,P2P-GO} <= 3 ], max = 4
* => allows a STA plus three P2P interfaces
*
- * The list of these four possiblities could completely be contained
+ * The list of these four possibilities could completely be contained
* within the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute to indicate
* that any of these groups must match.
*
@@ -4516,7 +5126,7 @@ enum nl80211_if_combination_attrs {
* enum nl80211_plink_state - state of a mesh peer link finite state machine
*
* @NL80211_PLINK_LISTEN: initial state, considered the implicit
- * state of non existant mesh peer links
+ * state of non existent mesh peer links
* @NL80211_PLINK_OPN_SNT: mesh plink open frame has been sent to
* this mesh peer
* @NL80211_PLINK_OPN_RCVD: mesh plink open frame has been received
@@ -4792,7 +5402,7 @@ enum nl80211_feature_flags {
NL80211_FEATURE_TDLS_CHANNEL_SWITCH = 1 << 28,
NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR = 1 << 29,
NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR = 1 << 30,
- NL80211_FEATURE_ND_RANDOM_MAC_ADDR = 1 << 31,
+ NL80211_FEATURE_ND_RANDOM_MAC_ADDR = 1U << 31,
};
/**
@@ -4860,6 +5470,52 @@ enum nl80211_feature_flags {
* @NL80211_EXT_FEATURE_LOW_SPAN_SCAN: Driver supports low span scan.
* @NL80211_EXT_FEATURE_LOW_POWER_SCAN: Driver supports low power scan.
* @NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN: Driver supports high accuracy scan.
+ * @NL80211_EXT_FEATURE_DFS_OFFLOAD: HW/driver will offload DFS actions.
+ * Device or driver will do all DFS-related actions by itself,
+ * informing user-space about CAC progress, radar detection event,
+ * channel change triggered by radar detection event.
+ * No need to start CAC from user-space, no need to react to
+ * "radar detected" event.
+ * @NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211: Driver supports sending and
+ * receiving control port frames over nl80211 instead of the netdevice.
+ * @NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT: This driver/device supports
+ * (average) ACK signal strength reporting.
+ * @NL80211_EXT_FEATURE_TXQS: Driver supports FQ-CoDel-enabled intermediate
+ * TXQs.
+ * @NL80211_EXT_FEATURE_SCAN_RANDOM_SN: Driver/device supports randomizing the
+ * SN in probe request frames if requested by %NL80211_SCAN_FLAG_RANDOM_SN.
+ * @NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT: Driver/device can omit all data
+ * except for supported rates from the probe request content if requested
+ * by the %NL80211_SCAN_FLAG_MIN_PREQ_CONTENT flag.
+ * @NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER: Driver supports enabling fine
+ * timing measurement responder role.
+ *
+ * @NL80211_EXT_FEATURE_CAN_REPLACE_PTK0: Driver/device confirm that they are
+ * able to rekey an in-use key correctly. Userspace must not rekey PTK keys
+ * if this flag is not set. Ignoring this can leak clear text packets and/or
+ * freeze the connection.
+ * @NL80211_EXT_FEATURE_EXT_KEY_ID: Driver supports "Extended Key ID for
+ * Individually Addressed Frames" from IEEE802.11-2016.
+ *
+ * @NL80211_EXT_FEATURE_AIRTIME_FAIRNESS: Driver supports getting airtime
+ * fairness for transmitted packets and has enabled airtime fairness
+ * scheduling.
+ *
+ * @NL80211_EXT_FEATURE_AP_PMKSA_CACHING: Driver/device supports PMKSA caching
+ * (set/del PMKSA operations) in AP mode.
+ *
+ * @NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD: Driver supports
+ * filtering of sched scan results using band specific RSSI thresholds.
+ *
+ * @NL80211_EXT_FEATURE_STA_TX_PWR: This driver supports controlling tx power
+ * to a station.
+ *
+ * @NL80211_EXT_FEATURE_SAE_OFFLOAD: Device wants to do SAE authentication in
+ * station mode (SAE password is passed as part of the connect command).
+ *
+ * @NL80211_EXT_FEATURE_VLAN_OFFLOAD: The driver supports a single netdev
+ * with VLAN tagged frames and separate VLAN-specific netdevs added using
+ * vconfig similarly to the Ethernet case.
*
* @NUM_NL80211_EXT_FEATURES: number of extended features.
* @MAX_NL80211_EXT_FEATURES: highest extended feature index.
@@ -4890,6 +5546,23 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_LOW_SPAN_SCAN,
NL80211_EXT_FEATURE_LOW_POWER_SCAN,
NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN,
+ NL80211_EXT_FEATURE_DFS_OFFLOAD,
+ NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211,
+ NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT,
+ /* we renamed this - stay compatible */
+ NL80211_EXT_FEATURE_DATA_ACK_SIGNAL_SUPPORT = NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT,
+ NL80211_EXT_FEATURE_TXQS,
+ NL80211_EXT_FEATURE_SCAN_RANDOM_SN,
+ NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT,
+ NL80211_EXT_FEATURE_CAN_REPLACE_PTK0,
+ NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER,
+ NL80211_EXT_FEATURE_AIRTIME_FAIRNESS,
+ NL80211_EXT_FEATURE_AP_PMKSA_CACHING,
+ NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD,
+ NL80211_EXT_FEATURE_EXT_KEY_ID,
+ NL80211_EXT_FEATURE_STA_TX_PWR,
+ NL80211_EXT_FEATURE_SAE_OFFLOAD,
+ NL80211_EXT_FEATURE_VLAN_OFFLOAD,
/* add new features before the definition below */
NUM_NL80211_EXT_FEATURES,
@@ -4970,6 +5643,17 @@ enum nl80211_timeout_reason {
* locally administered 1, multicast 0) is assumed.
* This flag must not be requested when the feature isn't supported, check
* the nl80211 feature flags for the device.
+ * @NL80211_SCAN_FLAG_FILS_MAX_CHANNEL_TIME: fill the dwell time in the FILS
+ * request parameters IE in the probe request
+ * @NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP: accept broadcast probe responses
+ * @NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE: send probe request frames at
+ * rate of at least 5.5M. In case non OCE AP is discovered in the channel,
+ * only the first probe req in the channel will be sent in high rate.
+ * @NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION: allow probe request
+ * tx deferral (dot11FILSProbeDelay shall be set to 15ms)
+ * and suppression (if it has received a broadcast Probe Response frame,
+ * Beacon frame or FILS Discovery frame from an AP that the STA considers
+ * a suitable candidate for (re-)association - suitable in terms of
* SSID and/or RSSI.
* @NL80211_SCAN_FLAG_LOW_SPAN: Span corresponds to the total time taken to
* accomplish the scan. Thus, this flag intends the driver to perform the
@@ -4984,15 +5668,27 @@ enum nl80211_timeout_reason {
* possible scan results. This flag hints the driver to use the best
* possible scan configuration to improve the accuracy in scanning.
* Latency and power use may get impacted with this flag.
+ * @NL80211_SCAN_FLAG_RANDOM_SN: randomize the sequence number in probe
+ * request frames from this scan to avoid correlation/tracking being
+ * possible.
+ * @NL80211_SCAN_FLAG_MIN_PREQ_CONTENT: minimize probe request content to
+ * only have supported rates and no additional capabilities (unless
+ * added by userspace explicitly.)
*/
enum nl80211_scan_flags {
- NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0,
- NL80211_SCAN_FLAG_FLUSH = 1<<1,
- NL80211_SCAN_FLAG_AP = 1<<2,
- NL80211_SCAN_FLAG_RANDOM_ADDR = 1<<3,
- NL80211_SCAN_FLAG_LOW_SPAN = 1<<8,
- NL80211_SCAN_FLAG_LOW_POWER = 1<<9,
- NL80211_SCAN_FLAG_HIGH_ACCURACY = 1<<10,
+ NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0,
+ NL80211_SCAN_FLAG_FLUSH = 1<<1,
+ NL80211_SCAN_FLAG_AP = 1<<2,
+ NL80211_SCAN_FLAG_RANDOM_ADDR = 1<<3,
+ NL80211_SCAN_FLAG_FILS_MAX_CHANNEL_TIME = 1<<4,
+ NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP = 1<<5,
+ NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE = 1<<6,
+ NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION = 1<<7,
+ NL80211_SCAN_FLAG_LOW_SPAN = 1<<8,
+ NL80211_SCAN_FLAG_LOW_POWER = 1<<9,
+ NL80211_SCAN_FLAG_HIGH_ACCURACY = 1<<10,
+ NL80211_SCAN_FLAG_RANDOM_SN = 1<<11,
+ NL80211_SCAN_FLAG_MIN_PREQ_CONTENT = 1<<12,
};
/**
@@ -5046,12 +5742,20 @@ enum nl80211_smps_mode {
* change to the channel status.
* @NL80211_RADAR_NOP_FINISHED: The Non-Occupancy Period for this channel is
* over, channel becomes usable.
+ * @NL80211_RADAR_PRE_CAC_EXPIRED: Channel Availability Check done on this
+ * non-operating channel is expired and no longer valid. New CAC must
+ * be done on this channel before starting the operation. This is not
+ * applicable for ETSI dfs domain where pre-CAC is valid for ever.
+ * @NL80211_RADAR_CAC_STARTED: Channel Availability Check has been started,
+ * should be generated by HW if NL80211_EXT_FEATURE_DFS_OFFLOAD is enabled.
*/
enum nl80211_radar_event {
NL80211_RADAR_DETECTED,
NL80211_RADAR_CAC_FINISHED,
NL80211_RADAR_CAC_ABORTED,
NL80211_RADAR_NOP_FINISHED,
+ NL80211_RADAR_PRE_CAC_EXPIRED,
+ NL80211_RADAR_CAC_STARTED,
};
/**
@@ -5110,9 +5814,14 @@ enum nl80211_crit_proto_id {
* Used by cfg80211_rx_mgmt()
*
* @NL80211_RXMGMT_FLAG_ANSWERED: frame was answered by device/driver.
+ * @NL80211_RXMGMT_FLAG_EXTERNAL_AUTH: Host driver intends to offload
+ * the authentication. Exclusively defined for host drivers that
+ * advertises the SME functionality but would like the userspace
+ * to handle certain authentication algorithms (e.g. SAE).
*/
enum nl80211_rxmgmt_flags {
NL80211_RXMGMT_FLAG_ANSWERED = 1 << 0,
+ NL80211_RXMGMT_FLAG_EXTERNAL_AUTH = 1 << 1,
};
/*
@@ -5178,8 +5887,9 @@ enum nl80211_sched_scan_plan {
/**
* struct nl80211_bss_select_rssi_adjust - RSSI adjustment parameters.
*
- * @band: band of BSS that must match for RSSI value adjustment.
- * @delta: value used to adjust the RSSI value of matching BSS.
+ * @band: band of BSS that must match for RSSI value adjustment. The value
+ * of this field is according to &enum nl80211_band.
+ * @delta: value used to adjust the RSSI value of matching BSS in dB.
*/
struct nl80211_bss_select_rssi_adjust {
__u8 band;
@@ -5220,21 +5930,6 @@ enum nl80211_bss_select_attr {
};
/**
- * enum nl80211_nan_dual_band_conf - NAN dual band configuration
- *
- * Defines the NAN dual band mode of operation
- *
- * @NL80211_NAN_BAND_DEFAULT: device default mode
- * @NL80211_NAN_BAND_2GHZ: 2.4GHz mode
- * @NL80211_NAN_BAND_5GHZ: 5GHz mode
- */
-enum nl80211_nan_dual_band_conf {
- NL80211_NAN_BAND_DEFAULT = 1 << 0,
- NL80211_NAN_BAND_2GHZ = 1 << 1,
- NL80211_NAN_BAND_5GHZ = 1 << 2,
-};
-
-/**
* enum nl80211_nan_function_type - NAN function type
*
* Defines the function type of a NAN function
@@ -5357,11 +6052,11 @@ enum nl80211_nan_func_attributes {
* @NL80211_NAN_SRF_INCLUDE: present if the include bit of the SRF set.
* This is a flag.
* @NL80211_NAN_SRF_BF: Bloom Filter. Present if and only if
- * &NL80211_NAN_SRF_MAC_ADDRS isn't present. This attribute is binary.
+ * %NL80211_NAN_SRF_MAC_ADDRS isn't present. This attribute is binary.
* @NL80211_NAN_SRF_BF_IDX: index of the Bloom Filter. Mandatory if
- * &NL80211_NAN_SRF_BF is present. This is a u8.
+ * %NL80211_NAN_SRF_BF is present. This is a u8.
* @NL80211_NAN_SRF_MAC_ADDRS: list of MAC addresses for the SRF. Present if
- * and only if &NL80211_NAN_SRF_BF isn't present. This is a nested
+ * and only if %NL80211_NAN_SRF_BF isn't present. This is a nested
* attribute. Each nested attribute is a MAC address.
* @NUM_NL80211_NAN_SRF_ATTR: internal
* @NL80211_NAN_SRF_ATTR_MAX: highest NAN SRF attribute
@@ -5401,4 +6096,491 @@ enum nl80211_nan_match_attributes {
NL80211_NAN_MATCH_ATTR_MAX = NUM_NL80211_NAN_MATCH_ATTR - 1
};
+/**
+ * nl80211_external_auth_action - Action to perform with external
+ * authentication request. Used by NL80211_ATTR_EXTERNAL_AUTH_ACTION.
+ * @NL80211_EXTERNAL_AUTH_START: Start the authentication.
+ * @NL80211_EXTERNAL_AUTH_ABORT: Abort the ongoing authentication.
+ */
+enum nl80211_external_auth_action {
+ NL80211_EXTERNAL_AUTH_START,
+ NL80211_EXTERNAL_AUTH_ABORT,
+};
+
+/**
+ * enum nl80211_ftm_responder_attributes - fine timing measurement
+ * responder attributes
+ * @__NL80211_FTM_RESP_ATTR_INVALID: Invalid
+ * @NL80211_FTM_RESP_ATTR_ENABLED: FTM responder is enabled
+ * @NL80211_FTM_RESP_ATTR_LCI: The content of Measurement Report Element
+ * (9.4.2.22 in 802.11-2016) with type 8 - LCI (9.4.2.22.10),
+ * i.e. starting with the measurement token
+ * @NL80211_FTM_RESP_ATTR_CIVIC: The content of Measurement Report Element
+ * (9.4.2.22 in 802.11-2016) with type 11 - Civic (Section 9.4.2.22.13),
+ * i.e. starting with the measurement token
+ * @__NL80211_FTM_RESP_ATTR_LAST: Internal
+ * @NL80211_FTM_RESP_ATTR_MAX: highest FTM responder attribute.
+ */
+enum nl80211_ftm_responder_attributes {
+ __NL80211_FTM_RESP_ATTR_INVALID,
+
+ NL80211_FTM_RESP_ATTR_ENABLED,
+ NL80211_FTM_RESP_ATTR_LCI,
+ NL80211_FTM_RESP_ATTR_CIVICLOC,
+
+ /* keep last */
+ __NL80211_FTM_RESP_ATTR_LAST,
+ NL80211_FTM_RESP_ATTR_MAX = __NL80211_FTM_RESP_ATTR_LAST - 1,
+};
+
+/*
+ * enum nl80211_ftm_responder_stats - FTM responder statistics
+ *
+ * These attribute types are used with %NL80211_ATTR_FTM_RESPONDER_STATS
+ * when getting FTM responder statistics.
+ *
+ * @__NL80211_FTM_STATS_INVALID: attribute number 0 is reserved
+ * @NL80211_FTM_STATS_SUCCESS_NUM: number of FTM sessions in which all frames
+ * were ssfully answered (u32)
+ * @NL80211_FTM_STATS_PARTIAL_NUM: number of FTM sessions in which part of the
+ * frames were successfully answered (u32)
+ * @NL80211_FTM_STATS_FAILED_NUM: number of failed FTM sessions (u32)
+ * @NL80211_FTM_STATS_ASAP_NUM: number of ASAP sessions (u32)
+ * @NL80211_FTM_STATS_NON_ASAP_NUM: number of non-ASAP sessions (u32)
+ * @NL80211_FTM_STATS_TOTAL_DURATION_MSEC: total sessions durations - gives an
+ * indication of how much time the responder was busy (u64, msec)
+ * @NL80211_FTM_STATS_UNKNOWN_TRIGGERS_NUM: number of unknown FTM triggers -
+ * triggers from initiators that didn't finish successfully the negotiation
+ * phase with the responder (u32)
+ * @NL80211_FTM_STATS_RESCHEDULE_REQUESTS_NUM: number of FTM reschedule requests
+ * - initiator asks for a new scheduling although it already has scheduled
+ * FTM slot (u32)
+ * @NL80211_FTM_STATS_OUT_OF_WINDOW_TRIGGERS_NUM: number of FTM triggers out of
+ * scheduled window (u32)
+ * @NL80211_FTM_STATS_PAD: used for padding, ignore
+ * @__NL80211_TXQ_ATTR_AFTER_LAST: Internal
+ * @NL80211_FTM_STATS_MAX: highest possible FTM responder stats attribute
+ */
+enum nl80211_ftm_responder_stats {
+ __NL80211_FTM_STATS_INVALID,
+ NL80211_FTM_STATS_SUCCESS_NUM,
+ NL80211_FTM_STATS_PARTIAL_NUM,
+ NL80211_FTM_STATS_FAILED_NUM,
+ NL80211_FTM_STATS_ASAP_NUM,
+ NL80211_FTM_STATS_NON_ASAP_NUM,
+ NL80211_FTM_STATS_TOTAL_DURATION_MSEC,
+ NL80211_FTM_STATS_UNKNOWN_TRIGGERS_NUM,
+ NL80211_FTM_STATS_RESCHEDULE_REQUESTS_NUM,
+ NL80211_FTM_STATS_OUT_OF_WINDOW_TRIGGERS_NUM,
+ NL80211_FTM_STATS_PAD,
+
+ /* keep last */
+ __NL80211_FTM_STATS_AFTER_LAST,
+ NL80211_FTM_STATS_MAX = __NL80211_FTM_STATS_AFTER_LAST - 1
+};
+
+/**
+ * enum nl80211_preamble - frame preamble types
+ * @NL80211_PREAMBLE_LEGACY: legacy (HR/DSSS, OFDM, ERP PHY) preamble
+ * @NL80211_PREAMBLE_HT: HT preamble
+ * @NL80211_PREAMBLE_VHT: VHT preamble
+ * @NL80211_PREAMBLE_DMG: DMG preamble
+ */
+enum nl80211_preamble {
+ NL80211_PREAMBLE_LEGACY,
+ NL80211_PREAMBLE_HT,
+ NL80211_PREAMBLE_VHT,
+ NL80211_PREAMBLE_DMG,
+};
+
+/**
+ * enum nl80211_peer_measurement_type - peer measurement types
+ * @NL80211_PMSR_TYPE_INVALID: invalid/unused, needed as we use
+ * these numbers also for attributes
+ *
+ * @NL80211_PMSR_TYPE_FTM: flight time measurement
+ *
+ * @NUM_NL80211_PMSR_TYPES: internal
+ * @NL80211_PMSR_TYPE_MAX: highest type number
+ */
+enum nl80211_peer_measurement_type {
+ NL80211_PMSR_TYPE_INVALID,
+
+ NL80211_PMSR_TYPE_FTM,
+
+ NUM_NL80211_PMSR_TYPES,
+ NL80211_PMSR_TYPE_MAX = NUM_NL80211_PMSR_TYPES - 1
+};
+
+/**
+ * enum nl80211_peer_measurement_status - peer measurement status
+ * @NL80211_PMSR_STATUS_SUCCESS: measurement completed successfully
+ * @NL80211_PMSR_STATUS_REFUSED: measurement was locally refused
+ * @NL80211_PMSR_STATUS_TIMEOUT: measurement timed out
+ * @NL80211_PMSR_STATUS_FAILURE: measurement failed, a type-dependent
+ * reason may be available in the response data
+ */
+enum nl80211_peer_measurement_status {
+ NL80211_PMSR_STATUS_SUCCESS,
+ NL80211_PMSR_STATUS_REFUSED,
+ NL80211_PMSR_STATUS_TIMEOUT,
+ NL80211_PMSR_STATUS_FAILURE,
+};
+
+/**
+ * enum nl80211_peer_measurement_req - peer measurement request attributes
+ * @__NL80211_PMSR_REQ_ATTR_INVALID: invalid
+ *
+ * @NL80211_PMSR_REQ_ATTR_DATA: This is a nested attribute with measurement
+ * type-specific request data inside. The attributes used are from the
+ * enums named nl80211_peer_measurement_<type>_req.
+ * @NL80211_PMSR_REQ_ATTR_GET_AP_TSF: include AP TSF timestamp, if supported
+ * (flag attribute)
+ *
+ * @NUM_NL80211_PMSR_REQ_ATTRS: internal
+ * @NL80211_PMSR_REQ_ATTR_MAX: highest attribute number
+ */
+enum nl80211_peer_measurement_req {
+ __NL80211_PMSR_REQ_ATTR_INVALID,
+
+ NL80211_PMSR_REQ_ATTR_DATA,
+ NL80211_PMSR_REQ_ATTR_GET_AP_TSF,
+
+ /* keep last */
+ NUM_NL80211_PMSR_REQ_ATTRS,
+ NL80211_PMSR_REQ_ATTR_MAX = NUM_NL80211_PMSR_REQ_ATTRS - 1
+};
+
+/**
+ * enum nl80211_peer_measurement_resp - peer measurement response attributes
+ * @__NL80211_PMSR_RESP_ATTR_INVALID: invalid
+ *
+ * @NL80211_PMSR_RESP_ATTR_DATA: This is a nested attribute with measurement
+ * type-specific results inside. The attributes used are from the enums
+ * named nl80211_peer_measurement_<type>_resp.
+ * @NL80211_PMSR_RESP_ATTR_STATUS: u32 value with the measurement status
+ * (using values from &enum nl80211_peer_measurement_status.)
+ * @NL80211_PMSR_RESP_ATTR_HOST_TIME: host time (%CLOCK_BOOTTIME) when the
+ * result was measured; this value is not expected to be accurate to
+ * more than 20ms. (u64, nanoseconds)
+ * @NL80211_PMSR_RESP_ATTR_AP_TSF: TSF of the AP that the interface
+ * doing the measurement is connected to when the result was measured.
+ * This shall be accurately reported if supported and requested
+ * (u64, usec)
+ * @NL80211_PMSR_RESP_ATTR_FINAL: If results are sent to the host partially
+ * (*e.g. with FTM per-burst data) this flag will be cleared on all but
+ * the last result; if all results are combined it's set on the single
+ * result.
+ * @NL80211_PMSR_RESP_ATTR_PAD: padding for 64-bit attributes, ignore
+ *
+ * @NUM_NL80211_PMSR_RESP_ATTRS: internal
+ * @NL80211_PMSR_RESP_ATTR_MAX: highest attribute number
+ */
+enum nl80211_peer_measurement_resp {
+ __NL80211_PMSR_RESP_ATTR_INVALID,
+
+ NL80211_PMSR_RESP_ATTR_DATA,
+ NL80211_PMSR_RESP_ATTR_STATUS,
+ NL80211_PMSR_RESP_ATTR_HOST_TIME,
+ NL80211_PMSR_RESP_ATTR_AP_TSF,
+ NL80211_PMSR_RESP_ATTR_FINAL,
+ NL80211_PMSR_RESP_ATTR_PAD,
+
+ /* keep last */
+ NUM_NL80211_PMSR_RESP_ATTRS,
+ NL80211_PMSR_RESP_ATTR_MAX = NUM_NL80211_PMSR_RESP_ATTRS - 1
+};
+
+/**
+ * enum nl80211_peer_measurement_peer_attrs - peer attributes for measurement
+ * @__NL80211_PMSR_PEER_ATTR_INVALID: invalid
+ *
+ * @NL80211_PMSR_PEER_ATTR_ADDR: peer's MAC address
+ * @NL80211_PMSR_PEER_ATTR_CHAN: channel definition, nested, using top-level
+ * attributes like %NL80211_ATTR_WIPHY_FREQ etc.
+ * @NL80211_PMSR_PEER_ATTR_REQ: This is a nested attribute indexed by
+ * measurement type, with attributes from the
+ * &enum nl80211_peer_measurement_req inside.
+ * @NL80211_PMSR_PEER_ATTR_RESP: This is a nested attribute indexed by
+ * measurement type, with attributes from the
+ * &enum nl80211_peer_measurement_resp inside.
+ *
+ * @NUM_NL80211_PMSR_PEER_ATTRS: internal
+ * @NL80211_PMSR_PEER_ATTR_MAX: highest attribute number
+ */
+enum nl80211_peer_measurement_peer_attrs {
+ __NL80211_PMSR_PEER_ATTR_INVALID,
+
+ NL80211_PMSR_PEER_ATTR_ADDR,
+ NL80211_PMSR_PEER_ATTR_CHAN,
+ NL80211_PMSR_PEER_ATTR_REQ,
+ NL80211_PMSR_PEER_ATTR_RESP,
+
+ /* keep last */
+ NUM_NL80211_PMSR_PEER_ATTRS,
+ NL80211_PMSR_PEER_ATTR_MAX = NUM_NL80211_PMSR_PEER_ATTRS - 1,
+};
+
+/**
+ * enum nl80211_peer_measurement_attrs - peer measurement attributes
+ * @__NL80211_PMSR_ATTR_INVALID: invalid
+ *
+ * @NL80211_PMSR_ATTR_MAX_PEERS: u32 attribute used for capability
+ * advertisement only, indicates the maximum number of peers
+ * measurements can be done with in a single request
+ * @NL80211_PMSR_ATTR_REPORT_AP_TSF: flag attribute in capability
+ * indicating that the connected AP's TSF can be reported in
+ * measurement results
+ * @NL80211_PMSR_ATTR_RANDOMIZE_MAC_ADDR: flag attribute in capability
+ * indicating that MAC address randomization is supported.
+ * @NL80211_PMSR_ATTR_TYPE_CAPA: capabilities reported by the device,
+ * this contains a nesting indexed by measurement type, and
+ * type-specific capabilities inside, which are from the enums
+ * named nl80211_peer_measurement_<type>_capa.
+ * @NL80211_PMSR_ATTR_PEERS: nested attribute, the nesting index is
+ * meaningless, just a list of peers to measure with, with the
+ * sub-attributes taken from
+ * &enum nl80211_peer_measurement_peer_attrs.
+ *
+ * @NUM_NL80211_PMSR_ATTR: internal
+ * @NL80211_PMSR_ATTR_MAX: highest attribute number
+ */
+enum nl80211_peer_measurement_attrs {
+ __NL80211_PMSR_ATTR_INVALID,
+
+ NL80211_PMSR_ATTR_MAX_PEERS,
+ NL80211_PMSR_ATTR_REPORT_AP_TSF,
+ NL80211_PMSR_ATTR_RANDOMIZE_MAC_ADDR,
+ NL80211_PMSR_ATTR_TYPE_CAPA,
+ NL80211_PMSR_ATTR_PEERS,
+
+ /* keep last */
+ NUM_NL80211_PMSR_ATTR,
+ NL80211_PMSR_ATTR_MAX = NUM_NL80211_PMSR_ATTR - 1
+};
+
+/**
+ * enum nl80211_peer_measurement_ftm_capa - FTM capabilities
+ * @__NL80211_PMSR_FTM_CAPA_ATTR_INVALID: invalid
+ *
+ * @NL80211_PMSR_FTM_CAPA_ATTR_ASAP: flag attribute indicating ASAP mode
+ * is supported
+ * @NL80211_PMSR_FTM_CAPA_ATTR_NON_ASAP: flag attribute indicating non-ASAP
+ * mode is supported
+ * @NL80211_PMSR_FTM_CAPA_ATTR_REQ_LCI: flag attribute indicating if LCI
+ * data can be requested during the measurement
+ * @NL80211_PMSR_FTM_CAPA_ATTR_REQ_CIVICLOC: flag attribute indicating if civic
+ * location data can be requested during the measurement
+ * @NL80211_PMSR_FTM_CAPA_ATTR_PREAMBLES: u32 bitmap attribute of bits
+ * from &enum nl80211_preamble.
+ * @NL80211_PMSR_FTM_CAPA_ATTR_BANDWIDTHS: bitmap of values from
+ * &enum nl80211_chan_width indicating the supported channel
+ * bandwidths for FTM. Note that a higher channel bandwidth may be
+ * configured to allow for other measurements types with different
+ * bandwidth requirement in the same measurement.
+ * @NL80211_PMSR_FTM_CAPA_ATTR_MAX_BURSTS_EXPONENT: u32 attribute indicating
+ * the maximum bursts exponent that can be used (if not present anything
+ * is valid)
+ * @NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST: u32 attribute indicating
+ * the maximum FTMs per burst (if not present anything is valid)
+ *
+ * @NUM_NL80211_PMSR_FTM_CAPA_ATTR: internal
+ * @NL80211_PMSR_FTM_CAPA_ATTR_MAX: highest attribute number
+ */
+enum nl80211_peer_measurement_ftm_capa {
+ __NL80211_PMSR_FTM_CAPA_ATTR_INVALID,
+
+ NL80211_PMSR_FTM_CAPA_ATTR_ASAP,
+ NL80211_PMSR_FTM_CAPA_ATTR_NON_ASAP,
+ NL80211_PMSR_FTM_CAPA_ATTR_REQ_LCI,
+ NL80211_PMSR_FTM_CAPA_ATTR_REQ_CIVICLOC,
+ NL80211_PMSR_FTM_CAPA_ATTR_PREAMBLES,
+ NL80211_PMSR_FTM_CAPA_ATTR_BANDWIDTHS,
+ NL80211_PMSR_FTM_CAPA_ATTR_MAX_BURSTS_EXPONENT,
+ NL80211_PMSR_FTM_CAPA_ATTR_MAX_FTMS_PER_BURST,
+
+ /* keep last */
+ NUM_NL80211_PMSR_FTM_CAPA_ATTR,
+ NL80211_PMSR_FTM_CAPA_ATTR_MAX = NUM_NL80211_PMSR_FTM_CAPA_ATTR - 1
+};
+
+/**
+ * enum nl80211_peer_measurement_ftm_req - FTM request attributes
+ * @__NL80211_PMSR_FTM_REQ_ATTR_INVALID: invalid
+ *
+ * @NL80211_PMSR_FTM_REQ_ATTR_ASAP: ASAP mode requested (flag)
+ * @NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE: preamble type (see
+ * &enum nl80211_preamble), optional for DMG (u32)
+ * @NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP: number of bursts exponent as in
+ * 802.11-2016 9.4.2.168 "Fine Timing Measurement Parameters element"
+ * (u8, 0-15, optional with default 15 i.e. "no preference")
+ * @NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD: interval between bursts in units
+ * of 100ms (u16, optional with default 0)
+ * @NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION: burst duration, as in 802.11-2016
+ * Table 9-257 "Burst Duration field encoding" (u8, 0-15, optional with
+ * default 15 i.e. "no preference")
+ * @NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST: number of successful FTM frames
+ * requested per burst
+ * (u8, 0-31, optional with default 0 i.e. "no preference")
+ * @NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES: number of FTMR frame retries
+ * (u8, default 3)
+ * @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI: request LCI data (flag)
+ * @NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC: request civic location data
+ * (flag)
+ *
+ * @NUM_NL80211_PMSR_FTM_REQ_ATTR: internal
+ * @NL80211_PMSR_FTM_REQ_ATTR_MAX: highest attribute number
+ */
+enum nl80211_peer_measurement_ftm_req {
+ __NL80211_PMSR_FTM_REQ_ATTR_INVALID,
+
+ NL80211_PMSR_FTM_REQ_ATTR_ASAP,
+ NL80211_PMSR_FTM_REQ_ATTR_PREAMBLE,
+ NL80211_PMSR_FTM_REQ_ATTR_NUM_BURSTS_EXP,
+ NL80211_PMSR_FTM_REQ_ATTR_BURST_PERIOD,
+ NL80211_PMSR_FTM_REQ_ATTR_BURST_DURATION,
+ NL80211_PMSR_FTM_REQ_ATTR_FTMS_PER_BURST,
+ NL80211_PMSR_FTM_REQ_ATTR_NUM_FTMR_RETRIES,
+ NL80211_PMSR_FTM_REQ_ATTR_REQUEST_LCI,
+ NL80211_PMSR_FTM_REQ_ATTR_REQUEST_CIVICLOC,
+
+ /* keep last */
+ NUM_NL80211_PMSR_FTM_REQ_ATTR,
+ NL80211_PMSR_FTM_REQ_ATTR_MAX = NUM_NL80211_PMSR_FTM_REQ_ATTR - 1
+};
+
+/**
+ * enum nl80211_peer_measurement_ftm_failure_reasons - FTM failure reasons
+ * @NL80211_PMSR_FTM_FAILURE_UNSPECIFIED: unspecified failure, not used
+ * @NL80211_PMSR_FTM_FAILURE_NO_RESPONSE: no response from the FTM responder
+ * @NL80211_PMSR_FTM_FAILURE_REJECTED: FTM responder rejected measurement
+ * @NL80211_PMSR_FTM_FAILURE_WRONG_CHANNEL: we already know the peer is
+ * on a different channel, so can't measure (if we didn't know, we'd
+ * try and get no response)
+ * @NL80211_PMSR_FTM_FAILURE_PEER_NOT_CAPABLE: peer can't actually do FTM
+ * @NL80211_PMSR_FTM_FAILURE_INVALID_TIMESTAMP: invalid T1/T4 timestamps
+ * received
+ * @NL80211_PMSR_FTM_FAILURE_PEER_BUSY: peer reports busy, you may retry
+ * later (see %NL80211_PMSR_FTM_RESP_ATTR_BUSY_RETRY_TIME)
+ * @NL80211_PMSR_FTM_FAILURE_BAD_CHANGED_PARAMS: parameters were changed
+ * by the peer and are no longer supported
+ */
+enum nl80211_peer_measurement_ftm_failure_reasons {
+ NL80211_PMSR_FTM_FAILURE_UNSPECIFIED,
+ NL80211_PMSR_FTM_FAILURE_NO_RESPONSE,
+ NL80211_PMSR_FTM_FAILURE_REJECTED,
+ NL80211_PMSR_FTM_FAILURE_WRONG_CHANNEL,
+ NL80211_PMSR_FTM_FAILURE_PEER_NOT_CAPABLE,
+ NL80211_PMSR_FTM_FAILURE_INVALID_TIMESTAMP,
+ NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
+ NL80211_PMSR_FTM_FAILURE_BAD_CHANGED_PARAMS,
+};
+
+/**
+ * enum nl80211_peer_measurement_ftm_resp - FTM response attributes
+ * @__NL80211_PMSR_FTM_RESP_ATTR_INVALID: invalid
+ *
+ * @NL80211_PMSR_FTM_RESP_ATTR_FAIL_REASON: FTM-specific failure reason
+ * (u32, optional)
+ * @NL80211_PMSR_FTM_RESP_ATTR_BURST_INDEX: optional, if bursts are reported
+ * as separate results then it will be the burst index 0...(N-1) and
+ * the top level will indicate partial results (u32)
+ * @NL80211_PMSR_FTM_RESP_ATTR_NUM_FTMR_ATTEMPTS: number of FTM Request frames
+ * transmitted (u32, optional)
+ * @NL80211_PMSR_FTM_RESP_ATTR_NUM_FTMR_SUCCESSES: number of FTM Request frames
+ * that were acknowleged (u32, optional)
+ * @NL80211_PMSR_FTM_RESP_ATTR_BUSY_RETRY_TIME: retry time received from the
+ * busy peer (u32, seconds)
+ * @NL80211_PMSR_FTM_RESP_ATTR_NUM_BURSTS_EXP: actual number of bursts exponent
+ * used by the responder (similar to request, u8)
+ * @NL80211_PMSR_FTM_RESP_ATTR_BURST_DURATION: actual burst duration used by
+ * the responder (similar to request, u8)
+ * @NL80211_PMSR_FTM_RESP_ATTR_FTMS_PER_BURST: actual FTMs per burst used
+ * by the responder (similar to request, u8)
+ * @NL80211_PMSR_FTM_RESP_ATTR_RSSI_AVG: average RSSI across all FTM action
+ * frames (optional, s32, 1/2 dBm)
+ * @NL80211_PMSR_FTM_RESP_ATTR_RSSI_SPREAD: RSSI spread across all FTM action
+ * frames (optional, s32, 1/2 dBm)
+ * @NL80211_PMSR_FTM_RESP_ATTR_TX_RATE: bitrate we used for the response to the
+ * FTM action frame (optional, nested, using &enum nl80211_rate_info
+ * attributes)
+ * @NL80211_PMSR_FTM_RESP_ATTR_RX_RATE: bitrate the responder used for the FTM
+ * action frame (optional, nested, using &enum nl80211_rate_info attrs)
+ * @NL80211_PMSR_FTM_RESP_ATTR_RTT_AVG: average RTT (s64, picoseconds, optional
+ * but one of RTT/DIST must be present)
+ * @NL80211_PMSR_FTM_RESP_ATTR_RTT_VARIANCE: RTT variance (u64, ps^2, note that
+ * standard deviation is the square root of variance, optional)
+ * @NL80211_PMSR_FTM_RESP_ATTR_RTT_SPREAD: RTT spread (u64, picoseconds,
+ * optional)
+ * @NL80211_PMSR_FTM_RESP_ATTR_DIST_AVG: average distance (s64, mm, optional
+ * but one of RTT/DIST must be present)
+ * @NL80211_PMSR_FTM_RESP_ATTR_DIST_VARIANCE: distance variance (u64, mm^2, note
+ * that standard deviation is the square root of variance, optional)
+ * @NL80211_PMSR_FTM_RESP_ATTR_DIST_SPREAD: distance spread (u64, mm, optional)
+ * @NL80211_PMSR_FTM_RESP_ATTR_LCI: LCI data from peer (binary, optional);
+ * this is the contents of the Measurement Report Element (802.11-2016
+ * 9.4.2.22.1) starting with the Measurement Token, with Measurement
+ * Type 8.
+ * @NL80211_PMSR_FTM_RESP_ATTR_CIVICLOC: civic location data from peer
+ * (binary, optional);
+ * this is the contents of the Measurement Report Element (802.11-2016
+ * 9.4.2.22.1) starting with the Measurement Token, with Measurement
+ * Type 11.
+ * @NL80211_PMSR_FTM_RESP_ATTR_PAD: ignore, for u64/s64 padding only
+ *
+ * @NUM_NL80211_PMSR_FTM_RESP_ATTR: internal
+ * @NL80211_PMSR_FTM_RESP_ATTR_MAX: highest attribute number
+ */
+enum nl80211_peer_measurement_ftm_resp {
+ __NL80211_PMSR_FTM_RESP_ATTR_INVALID,
+
+ NL80211_PMSR_FTM_RESP_ATTR_FAIL_REASON,
+ NL80211_PMSR_FTM_RESP_ATTR_BURST_INDEX,
+ NL80211_PMSR_FTM_RESP_ATTR_NUM_FTMR_ATTEMPTS,
+ NL80211_PMSR_FTM_RESP_ATTR_NUM_FTMR_SUCCESSES,
+ NL80211_PMSR_FTM_RESP_ATTR_BUSY_RETRY_TIME,
+ NL80211_PMSR_FTM_RESP_ATTR_NUM_BURSTS_EXP,
+ NL80211_PMSR_FTM_RESP_ATTR_BURST_DURATION,
+ NL80211_PMSR_FTM_RESP_ATTR_FTMS_PER_BURST,
+ NL80211_PMSR_FTM_RESP_ATTR_RSSI_AVG,
+ NL80211_PMSR_FTM_RESP_ATTR_RSSI_SPREAD,
+ NL80211_PMSR_FTM_RESP_ATTR_TX_RATE,
+ NL80211_PMSR_FTM_RESP_ATTR_RX_RATE,
+ NL80211_PMSR_FTM_RESP_ATTR_RTT_AVG,
+ NL80211_PMSR_FTM_RESP_ATTR_RTT_VARIANCE,
+ NL80211_PMSR_FTM_RESP_ATTR_RTT_SPREAD,
+ NL80211_PMSR_FTM_RESP_ATTR_DIST_AVG,
+ NL80211_PMSR_FTM_RESP_ATTR_DIST_VARIANCE,
+ NL80211_PMSR_FTM_RESP_ATTR_DIST_SPREAD,
+ NL80211_PMSR_FTM_RESP_ATTR_LCI,
+ NL80211_PMSR_FTM_RESP_ATTR_CIVICLOC,
+ NL80211_PMSR_FTM_RESP_ATTR_PAD,
+
+ /* keep last */
+ NUM_NL80211_PMSR_FTM_RESP_ATTR,
+ NL80211_PMSR_FTM_RESP_ATTR_MAX = NUM_NL80211_PMSR_FTM_RESP_ATTR - 1
+};
+
+/**
+ * enum nl80211_obss_pd_attributes - OBSS packet detection attributes
+ * @__NL80211_HE_OBSS_PD_ATTR_INVALID: Invalid
+ *
+ * @NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET: the OBSS PD minimum tx power offset.
+ * @NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET: the OBSS PD maximum tx power offset.
+ *
+ * @__NL80211_HE_OBSS_PD_ATTR_LAST: Internal
+ * @NL80211_HE_OBSS_PD_ATTR_MAX: highest OBSS PD attribute.
+ */
+enum nl80211_obss_pd_attributes {
+ __NL80211_HE_OBSS_PD_ATTR_INVALID,
+
+ NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET,
+ NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET,
+
+ /* keep last */
+ __NL80211_HE_OBSS_PD_ATTR_LAST,
+ NL80211_HE_OBSS_PD_ATTR_MAX = __NL80211_HE_OBSS_PD_ATTR_LAST - 1,
+};
+
+
#endif /* __LINUX_NL80211_H */
diff --git a/net/netlink_utils.cpp b/net/netlink_utils.cpp
index f395d92..c31249d 100644
--- a/net/netlink_utils.cpp
+++ b/net/netlink_utils.cpp
@@ -37,6 +37,7 @@ using std::make_pair;
using std::make_unique;
using std::map;
using std::move;
+using std::pair;
using std::string;
using std::unique_ptr;
using std::vector;
@@ -52,7 +53,22 @@ uint32_t k2GHzFrequencyUpperBound = 2500;
uint32_t k5GHzFrequencyLowerBound = 5000;
// This upper bound will exclude any 5.9Ghz channels which belong to 802.11p
// for "vehicular communication systems".
-uint32_t k5GHzFrequencyUpperBound = 5850;
+uint32_t k5GHzFrequencyUpperBound = 5865;
+
+uint32_t k6GHzFrequencyLowerBound = 5925;
+uint32_t k6GHzFrequencyUpperBound = 7125;
+
+constexpr uint8_t kHtMcsSetNumByte = 16;
+constexpr uint8_t kVhtMcsSetNumByte = 8;
+constexpr uint8_t kHeMcsSetNumByteMin = 4;
+constexpr uint8_t kMaxStreams = 8;
+constexpr uint8_t kVht160MhzBitMask = 0x4;
+constexpr uint8_t kVht80p80MhzBitMask = 0x8;
+// Some old Linux kernel versions set it to 9.
+// 9 is OK because only 1st byte is used
+constexpr uint8_t kHeCapPhyNumByte = 9; // Should be 11
+constexpr uint8_t kHe160MhzBitMask = 0x8;
+constexpr uint8_t kHe80p80MhzBitMask = 0x10;
bool IsExtFeatureFlagSet(
const std::vector<uint8_t>& ext_feature_flags_bytes,
@@ -416,62 +432,243 @@ bool NetlinkUtils::ParseBandInfo(const NL80211Packet* const packet,
LOG(ERROR) << "Failed to get bands within NL80211_ATTR_WIPHY_BANDS";
return false;
}
- vector<uint32_t> frequencies_2g;
- vector<uint32_t> frequencies_5g;
- vector<uint32_t> frequencies_dfs;
- for (unsigned int band_index = 0; band_index < bands.size(); band_index++) {
+
+ *out_band_info = BandInfo();
+ for (auto& band : bands) {
NL80211NestedAttr freqs_attr(0);
- if (!bands[band_index].GetAttribute(NL80211_BAND_ATTR_FREQS, &freqs_attr)) {
- LOG(DEBUG) << "Failed to get NL80211_BAND_ATTR_FREQS";
+ if (band.GetAttribute(NL80211_BAND_ATTR_FREQS, &freqs_attr)) {
+ handleBandFreqAttributes(freqs_attr, out_band_info);
+ }
+ if (band.HasAttribute(NL80211_BAND_ATTR_HT_CAPA)) {
+ out_band_info->is_80211n_supported = true;
+ }
+ if (band.HasAttribute(NL80211_BAND_ATTR_VHT_CAPA)) {
+ out_band_info->is_80211ac_supported = true;
+ }
+
+ NL80211NestedAttr iftype_data_attr(0);
+ if (band.GetAttribute(NL80211_BAND_ATTR_IFTYPE_DATA,
+ &iftype_data_attr)) {
+ ParseIfTypeDataAttributes(iftype_data_attr, out_band_info);
+ }
+ ParseHtVhtPhyCapabilities(band, out_band_info);
+ }
+
+ return true;
+}
+
+void NetlinkUtils::ParseIfTypeDataAttributes(
+ const NL80211NestedAttr& iftype_data_attr,
+ BandInfo* out_band_info) {
+ vector<NL80211NestedAttr> attrs;
+ if (!iftype_data_attr.GetListOfNestedAttributes(&attrs) || attrs.empty()) {
+ LOG(ERROR) << "Failed to get the list of attributes under iftype_data_attr";
+ return;
+ }
+ NL80211NestedAttr attr = attrs[0];
+ if (attr.HasAttribute(NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY)) {
+ out_band_info->is_80211ax_supported = true;
+ ParseHeCapPhyAttribute(attr, out_band_info);
+ }
+ if (attr.HasAttribute(NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET)) {
+ ParseHeMcsSetAttribute(attr, out_band_info);
+ }
+ return;
+}
+
+void NetlinkUtils::handleBandFreqAttributes(const NL80211NestedAttr& freqs_attr,
+ BandInfo* out_band_info) {
+ vector<NL80211NestedAttr> freqs;
+ if (!freqs_attr.GetListOfNestedAttributes(&freqs)) {
+ LOG(ERROR) << "Failed to get frequency attributes";
+ return;
+ }
+
+ for (auto& freq : freqs) {
+ uint32_t frequency_value;
+ if (!freq.GetAttributeValue(NL80211_FREQUENCY_ATTR_FREQ,
+ &frequency_value)) {
+ LOG(DEBUG) << "Failed to get NL80211_FREQUENCY_ATTR_FREQ";
continue;
}
- vector<NL80211NestedAttr> freqs;
- if (!freqs_attr.GetListOfNestedAttributes(&freqs)) {
- LOG(ERROR) << "Failed to get frequencies within NL80211_BAND_ATTR_FREQS";
+ // Channel is disabled in current regulatory domain.
+ if (freq.HasAttribute(NL80211_FREQUENCY_ATTR_DISABLED)) {
continue;
}
- for (auto& freq : freqs) {
- uint32_t frequency_value;
- if (!freq.GetAttributeValue(NL80211_FREQUENCY_ATTR_FREQ,
- &frequency_value)) {
- LOG(DEBUG) << "Failed to get NL80211_FREQUENCY_ATTR_FREQ";
+
+ if (frequency_value > k2GHzFrequencyLowerBound &&
+ frequency_value < k2GHzFrequencyUpperBound) {
+ out_band_info->band_2g.push_back(frequency_value);
+ } else if (frequency_value > k5GHzFrequencyLowerBound &&
+ frequency_value <= k5GHzFrequencyUpperBound) {
+ // If this is an available/usable DFS frequency, we should save it to
+ // DFS frequencies list.
+ uint32_t dfs_state;
+ if (freq.GetAttributeValue(NL80211_FREQUENCY_ATTR_DFS_STATE,
+ &dfs_state) &&
+ (dfs_state == NL80211_DFS_AVAILABLE ||
+ dfs_state == NL80211_DFS_USABLE)) {
+ out_band_info->band_dfs.push_back(frequency_value);
continue;
}
- // Channel is disabled in current regulatory domain.
- if (freq.HasAttribute(NL80211_FREQUENCY_ATTR_DISABLED)) {
+
+ // Put non-dfs passive-only channels into the dfs category.
+ // This aligns with what framework always assumes.
+ if (freq.HasAttribute(NL80211_FREQUENCY_ATTR_NO_IR)) {
+ out_band_info->band_dfs.push_back(frequency_value);
continue;
}
- if (frequency_value > k2GHzFrequencyLowerBound &&
- frequency_value < k2GHzFrequencyUpperBound) {
- frequencies_2g.push_back(frequency_value);
- } else if (frequency_value > k5GHzFrequencyLowerBound &&
- frequency_value < k5GHzFrequencyUpperBound) {
- // If this is an available/usable DFS frequency, we should save it to
- // DFS frequencies list.
- uint32_t dfs_state;
- if (freq.GetAttributeValue(NL80211_FREQUENCY_ATTR_DFS_STATE,
- &dfs_state) &&
- (dfs_state == NL80211_DFS_AVAILABLE ||
- dfs_state == NL80211_DFS_USABLE)) {
- frequencies_dfs.push_back(frequency_value);
- continue;
- }
-
- // Put non-dfs passive-only channels into the dfs category.
- // This aligns with what framework always assumes.
- if (freq.HasAttribute(NL80211_FREQUENCY_ATTR_NO_IR)) {
- frequencies_dfs.push_back(frequency_value);
- continue;
- }
-
- // Otherwise, this is a regular 5g frequency.
- frequencies_5g.push_back(frequency_value);
- }
+ // Otherwise, this is a regular 5g frequency.
+ out_band_info->band_5g.push_back(frequency_value);
+ } else if (frequency_value > k6GHzFrequencyLowerBound &&
+ frequency_value < k6GHzFrequencyUpperBound) {
+ out_band_info->band_6g.push_back(frequency_value);
}
}
- *out_band_info = BandInfo(frequencies_2g, frequencies_5g, frequencies_dfs);
- return true;
+}
+
+void NetlinkUtils::ParseHtVhtPhyCapabilities(const NL80211NestedAttr& band,
+ BandInfo* out_band_info) {
+ ParseHtMcsSetAttribute(band, out_band_info);
+ ParseVhtMcsSetAttribute(band, out_band_info);
+ ParseVhtCapAttribute(band, out_band_info);
+}
+
+void NetlinkUtils::ParseHtMcsSetAttribute(const NL80211NestedAttr& band,
+ BandInfo* out_band_info) {
+ vector<uint8_t> ht_mcs_set;
+ if (!band.GetAttributeValue(NL80211_BAND_ATTR_HT_MCS_SET, &ht_mcs_set)) {
+ return;
+ }
+ if (ht_mcs_set.size() < kHtMcsSetNumByte) {
+ LOG(ERROR) << "HT MCS set size is incorrect";
+ return;
+ }
+ pair<uint32_t, uint32_t> max_streams_ht = ParseHtMcsSet(ht_mcs_set);
+ out_band_info->max_tx_streams = std::max(out_band_info->max_tx_streams,
+ max_streams_ht.first);
+ out_band_info->max_rx_streams = std::max(out_band_info->max_rx_streams,
+ max_streams_ht.second);
+}
+
+pair<uint32_t, uint32_t> NetlinkUtils::ParseHtMcsSet(
+ const vector<uint8_t>& ht_mcs_set) {
+ uint32_t max_rx_streams = 1;
+ for (int i = 4; i >= 1; i--) {
+ if (ht_mcs_set[i - 1] > 0) {
+ max_rx_streams = i;
+ break;
+ }
+ }
+
+ uint32_t max_tx_streams = max_rx_streams;
+ uint8_t supported_tx_mcs_set = ht_mcs_set[12];
+ uint8_t tx_mcs_set_defined = supported_tx_mcs_set & 0x1;
+ uint8_t tx_rx_mcs_set_not_equal = (supported_tx_mcs_set >> 1) & 0x1;
+ if (tx_mcs_set_defined && tx_rx_mcs_set_not_equal) {
+ uint8_t max_nss_tx_field_value = (supported_tx_mcs_set >> 2) & 0x3;
+ // The maximum number of Tx streams is 1 more than the field value.
+ max_tx_streams = max_nss_tx_field_value + 1;
+ }
+
+ return std::make_pair(max_tx_streams, max_rx_streams);
+}
+
+void NetlinkUtils::ParseVhtMcsSetAttribute(const NL80211NestedAttr& band,
+ BandInfo* out_band_info) {
+ vector<uint8_t> vht_mcs_set;
+ if (!band.GetAttributeValue(NL80211_BAND_ATTR_VHT_MCS_SET, &vht_mcs_set)) {
+ return;
+ }
+ if (vht_mcs_set.size() < kVhtMcsSetNumByte) {
+ LOG(ERROR) << "VHT MCS set size is incorrect";
+ return;
+ }
+ uint16_t vht_mcs_set_rx = (vht_mcs_set[1] << 8) | vht_mcs_set[0];
+ uint32_t max_rx_streams_vht = ParseMcsMap(vht_mcs_set_rx);
+ uint16_t vht_mcs_set_tx = (vht_mcs_set[5] << 8) | vht_mcs_set[4];
+ uint32_t max_tx_streams_vht = ParseMcsMap(vht_mcs_set_tx);
+ out_band_info->max_tx_streams = std::max(out_band_info->max_tx_streams,
+ max_tx_streams_vht);
+ out_band_info->max_rx_streams = std::max(out_band_info->max_rx_streams,
+ max_rx_streams_vht);
+}
+
+void NetlinkUtils::ParseHeMcsSetAttribute(const NL80211NestedAttr& attribute,
+ BandInfo* out_band_info) {
+ vector<uint8_t> he_mcs_set;
+ if (!attribute.GetAttributeValue(
+ NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET,
+ &he_mcs_set)) {
+ LOG(ERROR) << " HE MCS set is not found ";
+ return;
+ }
+ if (he_mcs_set.size() < kHeMcsSetNumByteMin) {
+ LOG(ERROR) << "HE MCS set size is incorrect";
+ return;
+ }
+ uint16_t he_mcs_map_rx = (he_mcs_set[1] << 8) | he_mcs_set[0];
+ uint32_t max_rx_streams_he = ParseMcsMap(he_mcs_map_rx);
+ uint16_t he_mcs_map_tx = (he_mcs_set[3] << 8) | he_mcs_set[2];
+ uint32_t max_tx_streams_he = ParseMcsMap(he_mcs_map_tx);
+ out_band_info->max_tx_streams = std::max(out_band_info->max_tx_streams,
+ max_tx_streams_he);
+ out_band_info->max_rx_streams = std::max(out_band_info->max_rx_streams,
+ max_rx_streams_he);
+}
+
+uint32_t NetlinkUtils::ParseMcsMap(uint16_t mcs_map)
+{
+ uint32_t max_nss = 1;
+ for (int i = kMaxStreams; i >= 1; i--) {
+ uint16_t stream_map = (mcs_map >> ((i - 1) * 2)) & 0x3;
+ // 0x3 means unsupported
+ if (stream_map != 0x3) {
+ max_nss = i;
+ break;
+ }
+ }
+ return max_nss;
+}
+
+void NetlinkUtils::ParseVhtCapAttribute(const NL80211NestedAttr& band,
+ BandInfo* out_band_info) {
+ uint32_t vht_cap;
+ if (!band.GetAttributeValue(NL80211_BAND_ATTR_VHT_CAPA, &vht_cap)) {
+ return;
+ }
+
+ if (vht_cap & kVht160MhzBitMask) {
+ out_band_info->is_160_mhz_supported = true;
+ }
+ if (vht_cap & kVht80p80MhzBitMask) {
+ out_band_info->is_80p80_mhz_supported = true;
+ }
+
+}
+
+void NetlinkUtils::ParseHeCapPhyAttribute(const NL80211NestedAttr& attribute,
+ BandInfo* out_band_info) {
+
+ vector<uint8_t> he_cap_phy;
+ if (!attribute.GetAttributeValue(
+ NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY,
+ &he_cap_phy)) {
+ LOG(ERROR) << " HE CAP PHY is not found";
+ return;
+ }
+
+ if (he_cap_phy.size() < kHeCapPhyNumByte) {
+ LOG(ERROR) << "HE Cap PHY size is incorrect";
+ return;
+ }
+ if (he_cap_phy[0] & kHe160MhzBitMask) {
+ out_band_info->is_160_mhz_supported = true;
+ }
+ if (he_cap_phy[0] & kHe80p80MhzBitMask) {
+ out_band_info->is_80p80_mhz_supported = true;
+ }
}
bool NetlinkUtils::GetStationInfo(uint32_t interface_index,
diff --git a/net/netlink_utils.h b/net/netlink_utils.h
index b3c34d3..df92e7d 100644
--- a/net/netlink_utils.h
+++ b/net/netlink_utils.h
@@ -28,6 +28,7 @@
#include "wificond/net/kernel-header-latest/nl80211.h"
#include "wificond/net/netlink_manager.h"
+#include "wificond/net/nl80211_packet.h"
namespace android {
namespace wificond {
@@ -49,19 +50,36 @@ struct InterfaceInfo {
};
struct BandInfo {
- BandInfo() = default;
- BandInfo(std::vector<uint32_t>& band_2g_,
- std::vector<uint32_t>& band_5g_,
- std::vector<uint32_t>& band_dfs_)
- : band_2g(band_2g_),
- band_5g(band_5g_),
- band_dfs(band_dfs_) {}
+ BandInfo():
+ is_80211n_supported(false),
+ is_80211ac_supported(false),
+ is_80211ax_supported(false),
+ is_160_mhz_supported(false),
+ is_80p80_mhz_supported(false),
+ max_tx_streams(1),
+ max_rx_streams(1) {};
// Frequencies for 2.4 GHz band.
std::vector<uint32_t> band_2g;
// Frequencies for 5 GHz band without DFS.
std::vector<uint32_t> band_5g;
// Frequencies for DFS.
std::vector<uint32_t> band_dfs;
+ // Frequencies for 6 GHz band.
+ std::vector<uint32_t> band_6g;
+ // support for 802.11n
+ bool is_80211n_supported;
+ // support for 802.11ac
+ bool is_80211ac_supported;
+ // support for 802.11ax
+ bool is_80211ax_supported;
+ // support for 160Mhz channel width
+ bool is_160_mhz_supported;
+ // support for 80+80Mhz channel width
+ bool is_80p80_mhz_supported;
+ // Max number of transmit spatial streams
+ uint32_t max_tx_streams;
+ // Max number of receive spatial streams
+ uint32_t max_rx_streams;
};
struct ScanCapabilities {
@@ -279,12 +297,32 @@ class NetlinkUtils {
WiphyFeatures* out_wiphy_features);
bool ParseBandInfo(const NL80211Packet* const packet,
BandInfo* out_band_info);
+ void ParseIfTypeDataAttributes(const NL80211NestedAttr& iftype_data_attr,
+ BandInfo* out_band_info);
+ void ParseHtVhtPhyCapabilities(const NL80211NestedAttr& band,
+ BandInfo* out_band_info);
+ void ParseHtMcsSetAttribute(const NL80211NestedAttr& band,
+ BandInfo* out_band_info);
+ void ParseVhtMcsSetAttribute(const NL80211NestedAttr& band,
+ BandInfo* out_band_info);
+ void ParseHeMcsSetAttribute(const NL80211NestedAttr& attribute,
+ BandInfo* out_band_info);
+ std::pair<uint32_t, uint32_t> ParseHtMcsSet(
+ const std::vector<uint8_t>& ht_mcs_set);
+ uint32_t ParseMcsMap(uint16_t mcs_map);
+ void ParseVhtCapAttribute(const NL80211NestedAttr& band,
+ BandInfo* out_band_info);
+ void ParseHeCapPhyAttribute(const NL80211NestedAttr& attribute,
+ BandInfo* out_band_info);
+
bool ParseScanCapabilities(const NL80211Packet* const packet,
ScanCapabilities* out_scan_capabilities);
bool MergePacketsForSplitWiphyDump(
const std::vector<std::unique_ptr<const NL80211Packet>>& split_dump_info,
std::vector<NL80211Packet>* packet_per_wiphy);
+ void handleBandFreqAttributes(const NL80211NestedAttr& freqs_attr,
+ BandInfo* out_band_info);
NetlinkManager* netlink_manager_;
diff --git a/runtests.sh b/runtests.sh
index 54d9eb9..7cb9e88 100755
--- a/runtests.sh
+++ b/runtests.sh
@@ -25,7 +25,7 @@ set -e # fail early
# NOTE We can't actually run these commands, since they rely on functions added by
# build/envsetup.sh to the bash shell environment.
echo "+ mmma -j32 $ANDROID_BUILD_TOP/system/connectivity/wificond"
-make -j32 -C $ANDROID_BUILD_TOP -f build/core/main.mk \
+$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode \
MODULES-IN-system-connectivity-wificond \
MODULES-IN-frameworks-opt-net-wifi-libwifi_system
diff --git a/scanning/channel_settings.cpp b/scanning/channel_settings.cpp
index b7c4fb8..5b12e4a 100644
--- a/scanning/channel_settings.cpp
+++ b/scanning/channel_settings.cpp
@@ -22,11 +22,10 @@
using android::status_t;
-namespace com {
namespace android {
-namespace server {
+namespace net {
namespace wifi {
-namespace wificond {
+namespace nl80211 {
status_t ChannelSettings::writeToParcel(::android::Parcel* parcel) const {
RETURN_IF_FAILED(parcel->writeInt32(frequency_));
@@ -38,8 +37,7 @@ status_t ChannelSettings::readFromParcel(const ::android::Parcel* parcel) {
return ::android::OK;
}
-} // namespace wificond
+} // namespace nl80211
} // namespace wifi
-} // namespace server
+} // namespace net
} // namespace android
-} // namespace com
diff --git a/scanning/channel_settings.h b/scanning/channel_settings.h
index 3ff4e55..748e39b 100644
--- a/scanning/channel_settings.h
+++ b/scanning/channel_settings.h
@@ -20,11 +20,10 @@
#include <binder/Parcel.h>
#include <binder/Parcelable.h>
-namespace com {
namespace android {
-namespace server {
+namespace net {
namespace wifi {
-namespace wificond {
+namespace nl80211 {
class ChannelSettings : public ::android::Parcelable {
public:
@@ -39,10 +38,9 @@ class ChannelSettings : public ::android::Parcelable {
int32_t frequency_;
};
-} // namespace wificond
+} // namespace nl80211
} // namespace wifi
-} // namespace server
+} // namespace net
} // namespace android
-} // namespace com
#endif // WIFICOND_SCANNING_CHANNEL_SETTINGS_H_
diff --git a/scanning/hidden_network.cpp b/scanning/hidden_network.cpp
index 686d5da..ce35b69 100644
--- a/scanning/hidden_network.cpp
+++ b/scanning/hidden_network.cpp
@@ -22,11 +22,10 @@
using android::status_t;
-namespace com {
namespace android {
-namespace server {
+namespace net {
namespace wifi {
-namespace wificond {
+namespace nl80211 {
status_t HiddenNetwork::writeToParcel(::android::Parcel* parcel) const {
RETURN_IF_FAILED(parcel->writeByteVector(ssid_));
@@ -38,8 +37,7 @@ status_t HiddenNetwork::readFromParcel(const ::android::Parcel* parcel) {
return ::android::OK;
}
-} // namespace wificond
+} // namespace nl80211
} // namespace wifi
-} // namespace server
+} // namespace net
} // namespace android
-} // namespace com
diff --git a/scanning/hidden_network.h b/scanning/hidden_network.h
index 646bc06..02ac466 100644
--- a/scanning/hidden_network.h
+++ b/scanning/hidden_network.h
@@ -22,11 +22,10 @@
#include <binder/Parcel.h>
#include <binder/Parcelable.h>
-namespace com {
namespace android {
-namespace server {
+namespace net {
namespace wifi {
-namespace wificond {
+namespace nl80211 {
class HiddenNetwork : public ::android::Parcelable {
public:
@@ -40,10 +39,9 @@ class HiddenNetwork : public ::android::Parcelable {
std::vector<uint8_t> ssid_;
};
-} // namespace wificond
+} // namespace nl80211
} // namespace wifi
-} // namespace server
+} // namespace net
} // namespace android
-} // namespace com
#endif // WIFICOND_SCANNING_HIDDEN_NETWORK_H_
diff --git a/scanning/pno_network.cpp b/scanning/pno_network.cpp
index 02f8e5f..17b5cdc 100644
--- a/scanning/pno_network.cpp
+++ b/scanning/pno_network.cpp
@@ -22,11 +22,10 @@
using android::status_t;
-namespace com {
namespace android {
-namespace server {
+namespace net {
namespace wifi {
-namespace wificond {
+namespace nl80211 {
status_t PnoNetwork::writeToParcel(::android::Parcel* parcel) const {
RETURN_IF_FAILED(parcel->writeInt32(is_hidden_ ? 1 : 0));
@@ -44,8 +43,7 @@ status_t PnoNetwork::readFromParcel(const ::android::Parcel* parcel) {
return ::android::OK;
}
-} // namespace wificond
+} // namespace nl80211
} // namespace wifi
-} // namespace server
+} // namespace net
} // namespace android
-} // namespace com
diff --git a/scanning/pno_network.h b/scanning/pno_network.h
index bd5d6cb..1cb5ded 100644
--- a/scanning/pno_network.h
+++ b/scanning/pno_network.h
@@ -22,11 +22,10 @@
#include <binder/Parcel.h>
#include <binder/Parcelable.h>
-namespace com {
namespace android {
-namespace server {
+namespace net {
namespace wifi {
-namespace wificond {
+namespace nl80211 {
class PnoNetwork : public ::android::Parcelable {
public:
@@ -43,10 +42,9 @@ class PnoNetwork : public ::android::Parcelable {
std::vector<int32_t> frequencies_;
};
-} // namespace wificond
+} // namespace nl80211
} // namespace wifi
-} // namespace server
+} // namespace net
} // namespace android
-} // namespace com
#endif // WIFICOND_SCANNING_PNO_NETWORK_H_
diff --git a/scanning/pno_settings.cpp b/scanning/pno_settings.cpp
index be051dd..6307ea7 100644
--- a/scanning/pno_settings.cpp
+++ b/scanning/pno_settings.cpp
@@ -22,19 +22,19 @@
using android::status_t;
-namespace com {
namespace android {
-namespace server {
+namespace net {
namespace wifi {
-namespace wificond {
+namespace nl80211 {
const uint32_t PnoSettings::kFastScanIterations = 3;
const uint32_t PnoSettings::kSlowScanIntervalMultiplier = 3;
status_t PnoSettings::writeToParcel(::android::Parcel* parcel) const {
- RETURN_IF_FAILED(parcel->writeInt32(interval_ms_));
+ RETURN_IF_FAILED(parcel->writeInt64(interval_ms_));
RETURN_IF_FAILED(parcel->writeInt32(min_2g_rssi_));
RETURN_IF_FAILED(parcel->writeInt32(min_5g_rssi_));
+ RETURN_IF_FAILED(parcel->writeInt32(min_6g_rssi_));
RETURN_IF_FAILED(parcel->writeInt32(pno_networks_.size()));
for (const auto& network : pno_networks_) {
// For Java readTypedList():
@@ -46,9 +46,10 @@ status_t PnoSettings::writeToParcel(::android::Parcel* parcel) const {
}
status_t PnoSettings::readFromParcel(const ::android::Parcel* parcel) {
- RETURN_IF_FAILED(parcel->readInt32(&interval_ms_));
+ RETURN_IF_FAILED(parcel->readInt64(&interval_ms_));
RETURN_IF_FAILED(parcel->readInt32(&min_2g_rssi_));
RETURN_IF_FAILED(parcel->readInt32(&min_5g_rssi_));
+ RETURN_IF_FAILED(parcel->readInt32(&min_6g_rssi_));
int32_t num_pno_networks = 0;
RETURN_IF_FAILED(parcel->readInt32(&num_pno_networks));
for (int i = 0; i < num_pno_networks; i++) {
@@ -69,8 +70,7 @@ status_t PnoSettings::readFromParcel(const ::android::Parcel* parcel) {
return ::android::OK;
}
-} // namespace wificond
+} // namespace nl80211
} // namespace wifi
-} // namespace server
+} // namespace net
} // namespace android
-} // namespace com
diff --git a/scanning/pno_settings.h b/scanning/pno_settings.h
index a606b0f..f0e0826 100644
--- a/scanning/pno_settings.h
+++ b/scanning/pno_settings.h
@@ -24,11 +24,10 @@
#include "wificond/scanning/pno_network.h"
-namespace com {
namespace android {
-namespace server {
+namespace net {
namespace wifi {
-namespace wificond {
+namespace nl80211 {
class PnoSettings : public ::android::Parcelable {
public:
@@ -38,25 +37,27 @@ class PnoSettings : public ::android::Parcelable {
PnoSettings()
: interval_ms_(0),
min_2g_rssi_(0),
- min_5g_rssi_(0) {}
+ min_5g_rssi_(0),
+ min_6g_rssi_(0) {}
bool operator==(const PnoSettings& rhs) const {
return (pno_networks_ == rhs.pno_networks_ &&
min_2g_rssi_ == rhs.min_2g_rssi_ &&
- min_5g_rssi_ == rhs.min_5g_rssi_);
+ min_5g_rssi_ == rhs.min_5g_rssi_ &&
+ min_6g_rssi_ == rhs.min_6g_rssi_);
}
::android::status_t writeToParcel(::android::Parcel* parcel) const override;
::android::status_t readFromParcel(const ::android::Parcel* parcel) override;
- int32_t interval_ms_;
+ int64_t interval_ms_;
int32_t min_2g_rssi_;
int32_t min_5g_rssi_;
+ int32_t min_6g_rssi_;
std::vector<PnoNetwork> pno_networks_;
};
-} // namespace wificond
+} // namespace nl80211
} // namespace wifi
-} // namespace server
+} // namespace net
} // namespace android
-} // namespace com
#endif // WIFICOND_SCANNING_PNO_SETTINGS_H_
diff --git a/scanning/radio_chain_info.cpp b/scanning/radio_chain_info.cpp
index 274dc20..64506e4 100644
--- a/scanning/radio_chain_info.cpp
+++ b/scanning/radio_chain_info.cpp
@@ -21,11 +21,10 @@
using android::status_t;
-namespace com {
namespace android {
-namespace server {
+namespace net {
namespace wifi {
-namespace wificond {
+namespace nl80211 {
status_t RadioChainInfo::writeToParcel(::android::Parcel* parcel) const {
RETURN_IF_FAILED(parcel->writeInt32(chain_id));
@@ -39,8 +38,7 @@ status_t RadioChainInfo::readFromParcel(const ::android::Parcel* parcel) {
return ::android::OK;
}
-} // namespace wificond
+} // namespace nl80211
} // namespace wifi
-} // namespace server
+} // namespace net
} // namespace android
-} // namespace com
diff --git a/scanning/radio_chain_info.h b/scanning/radio_chain_info.h
index 1642b8b..551ab45 100644
--- a/scanning/radio_chain_info.h
+++ b/scanning/radio_chain_info.h
@@ -20,11 +20,10 @@
#include <binder/Parcel.h>
#include <binder/Parcelable.h>
-namespace com {
namespace android {
-namespace server {
+namespace net {
namespace wifi {
-namespace wificond {
+namespace nl80211 {
class RadioChainInfo : public ::android::Parcelable {
public:
@@ -42,10 +41,9 @@ class RadioChainInfo : public ::android::Parcelable {
int32_t level;
};
-} // namespace wificond
+} // namespace nl80211
} // namespace wifi
-} // namespace server
+} // namespace net
} // namespace android
-} // namespace com
#endif // WIFICOND_SCANNING_RADIO_CHAIN_INFO_H_
diff --git a/scanning/scan_result.cpp b/scanning/scan_result.cpp
index fa85981..ff00ab9 100644
--- a/scanning/scan_result.cpp
+++ b/scanning/scan_result.cpp
@@ -27,11 +27,10 @@ using android::status_t;
using android::OK;
using std::string;
-namespace com {
namespace android {
-namespace server {
+namespace net {
namespace wifi {
-namespace wificond {
+namespace nl80211 {
NativeScanResult::NativeScanResult(std::vector<uint8_t>& ssid_,
std::array<uint8_t, ETH_ALEN>& bssid_,
@@ -135,8 +134,7 @@ void NativeScanResult::DebugLog() {
}
-} // namespace wificond
+} // namespace nl80211
} // namespace wifi
-} // namespace server
+} // namespace net
} // namespace android
-} // namespace com
diff --git a/scanning/scan_result.h b/scanning/scan_result.h
index bd9dc98..43c6a15 100644
--- a/scanning/scan_result.h
+++ b/scanning/scan_result.h
@@ -27,11 +27,10 @@
#include "wificond/scanning/radio_chain_info.h"
-namespace com {
namespace android {
-namespace server {
+namespace net {
namespace wifi {
-namespace wificond {
+namespace nl80211 {
// This is the class to represent a scan result for wificond internal use.
class NativeScanResult : public ::android::Parcelable {
@@ -87,10 +86,9 @@ class NativeScanResult : public ::android::Parcelable {
std::vector<RadioChainInfo> radio_chain_infos;
};
-} // namespace wificond
+} // namespace nl80211
} // namespace wifi
-} // namespace server
+} // namespace net
} // namespace android
-} // namespace com
#endif // WIFICOND_SCANNING_SCAN_RESULT_H_
diff --git a/scanning/scan_utils.cpp b/scanning/scan_utils.cpp
index 65f8f8c..4b65a56 100644
--- a/scanning/scan_utils.cpp
+++ b/scanning/scan_utils.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "android/net/wifi/IWifiScannerImpl.h"
+#include "android/net/wifi/nl80211/IWifiScannerImpl.h"
#include "wificond/scanning/scan_utils.h"
#include <array>
@@ -30,9 +30,9 @@
#include "wificond/net/nl80211_packet.h"
#include "wificond/scanning/scan_result.h"
-using android::net::wifi::IWifiScannerImpl;
-using com::android::server::wifi::wificond::NativeScanResult;
-using com::android::server::wifi::wificond::RadioChainInfo;
+using android::net::wifi::nl80211::IWifiScannerImpl;
+using android::net::wifi::nl80211::NativeScanResult;
+using android::net::wifi::nl80211::RadioChainInfo;
using std::array;
using std::unique_ptr;
using std::vector;
@@ -132,7 +132,7 @@ bool ScanUtils::GetScanResult(uint32_t interface_index,
bool ScanUtils::ParseScanResult(unique_ptr<const NL80211Packet> packet,
NativeScanResult* scan_result) {
if (packet->GetCommand() != NL80211_CMD_NEW_SCAN_RESULTS) {
- LOG(ERROR) << "Wrong command command for new scan result message";
+ LOG(ERROR) << "Wrong command for new scan result message";
return false;
}
NL80211NestedAttr bss(0);
@@ -405,6 +405,7 @@ bool ScanUtils::StartScheduledScan(
const SchedScanIntervalSetting& interval_setting,
int32_t rssi_threshold_2g,
int32_t rssi_threshold_5g,
+ int32_t rssi_threshold_6g,
const SchedScanReqFlags& req_flags,
const std::vector<std::vector<uint8_t>>& scan_ssids,
const std::vector<std::vector<uint8_t>>& match_ssids,
@@ -456,6 +457,9 @@ bool ScanUtils::StartScheduledScan(
start_sched_scan.AddAttribute(rssi_adjust_attr);
}
+ //TODO: No adjustment is possible now for 6GHz due to lack of definition in
+ //nl80211.h for NL80211_BAND_6GHZ attribute
+
// Append all attributes to the NL80211_CMD_START_SCHED_SCAN packet.
start_sched_scan.AddAttribute(
NL80211Attr<uint32_t>(NL80211_ATTR_IFINDEX, interface_index));
diff --git a/scanning/scan_utils.h b/scanning/scan_utils.h
index d160123..bc190c6 100644
--- a/scanning/scan_utils.h
+++ b/scanning/scan_utils.h
@@ -24,20 +24,18 @@
#include "wificond/net/netlink_manager.h"
-namespace com {
namespace android {
-namespace server {
+namespace net {
namespace wifi {
-namespace wificond {
+namespace nl80211 {
class NativeScanResult;
class RadioChainInfo;
-} // namespace wificond
+} // namespace nl80211
} // namespace wifi
-} // namespace server
+} // namespace net
} // namespace android
-} // namespace com
namespace android {
namespace wificond {
@@ -75,7 +73,7 @@ class ScanUtils {
// Returns true on success.
virtual bool GetScanResult(
uint32_t interface_index,
- std::vector<::com::android::server::wifi::wificond::NativeScanResult>* out_scan_results);
+ std::vector<android::net::wifi::nl80211::NativeScanResult>* out_scan_results);
// Send scan request to kernel for interface with index |interface_index|.
// - |request_random_mac| If true, request device/driver to use a random MAC
@@ -135,6 +133,7 @@ class ScanUtils {
const SchedScanIntervalSetting& interval_setting,
int32_t rssi_threshold_2g,
int32_t rssi_threshold_5g,
+ int32_t rssi_threshold_6g,
const SchedScanReqFlags& req_flags,
const std::vector<std::vector<uint8_t>>& scan_ssids,
const std::vector<std::vector<uint8_t>>& match_ssids,
@@ -189,14 +188,14 @@ class ScanUtils {
uint64_t* last_seen_since_boot_microseconds);
bool ParseRadioChainInfos(
const NL80211NestedAttr& bss,
- std::vector<::com::android::server::wifi::wificond::RadioChainInfo>
+ std::vector<android::net::wifi::nl80211::RadioChainInfo>
*radio_chain_infos);
bool GetSSIDFromInfoElement(const std::vector<uint8_t>& ie,
std::vector<uint8_t>* ssid);
// Converts a NL80211_CMD_NEW_SCAN_RESULTS packet to a ScanResult object.
bool ParseScanResult(
std::unique_ptr<const NL80211Packet> packet,
- ::com::android::server::wifi::wificond::NativeScanResult* scan_result);
+ android::net::wifi::nl80211::NativeScanResult* scan_result);
NetlinkManager* netlink_manager_;
diff --git a/scanning/scanner_impl.cpp b/scanning/scanner_impl.cpp
index 77b1e76..83eceb2 100644
--- a/scanning/scanner_impl.cpp
+++ b/scanning/scanner_impl.cpp
@@ -26,13 +26,13 @@
#include "wificond/scanning/scan_utils.h"
using android::binder::Status;
-using android::net::wifi::IPnoScanEvent;
-using android::net::wifi::IScanEvent;
-using android::net::wifi::IWifiScannerImpl;
using android::sp;
-using com::android::server::wifi::wificond::NativeScanResult;
-using com::android::server::wifi::wificond::PnoSettings;
-using com::android::server::wifi::wificond::SingleScanSettings;
+using android::net::wifi::nl80211::IPnoScanEvent;
+using android::net::wifi::nl80211::IScanEvent;
+using android::net::wifi::nl80211::IWifiScannerImpl;
+using android::net::wifi::nl80211::NativeScanResult;
+using android::net::wifi::nl80211::PnoSettings;
+using android::net::wifi::nl80211::SingleScanSettings;
using std::string;
using std::vector;
@@ -73,6 +73,7 @@ ScannerImpl::ScannerImpl(uint32_t interface_index,
: valid_(true),
scan_started_(false),
pno_scan_started_(false),
+ nodev_counter_(0),
interface_index_(interface_index),
scan_capabilities_(scan_capabilities),
wiphy_features_(wiphy_features),
@@ -174,10 +175,16 @@ Status ScannerImpl::scan(const SingleScanSettings& scan_settings,
int error_code = 0;
if (!scan_utils_->Scan(interface_index_, request_random_mac, scan_type,
ssids, freqs, &error_code)) {
- CHECK(error_code != ENODEV) << "Driver is in a bad state, restarting wificond";
+ if (error_code == ENODEV) {
+ nodev_counter_ ++;
+ LOG(WARNING) << "Scan failed with error=nodev. counter=" << nodev_counter_;
+ }
+ CHECK(error_code != ENODEV || nodev_counter_ <= 3)
+ << "Driver is in a bad state, restarting wificond";
*out_success = false;
return Status::ok();
}
+ nodev_counter_ = 0;
scan_started_ = true;
*out_success = true;
return Status::ok();
@@ -274,13 +281,19 @@ bool ScannerImpl::StartPnoScanDefault(const PnoSettings& pno_settings) {
GenerateIntervalSetting(pno_settings),
pno_settings.min_2g_rssi_,
pno_settings.min_5g_rssi_,
+ pno_settings.min_6g_rssi_,
req_flags,
scan_ssids,
match_ssids,
freqs,
&error_code)) {
+ if (error_code == ENODEV) {
+ nodev_counter_ ++;
+ LOG(WARNING) << "Pno Scan failed with error=nodev. counter=" << nodev_counter_;
+ }
LOG(ERROR) << "Failed to start pno scan";
- CHECK(error_code != ENODEV) << "Driver is in a bad state, restarting wificond";
+ CHECK(error_code != ENODEV || nodev_counter_ <= 3)
+ << "Driver is in a bad state, restarting wificond";
return false;
}
string freq_string;
@@ -293,6 +306,7 @@ bool ScannerImpl::StartPnoScanDefault(const PnoSettings& pno_settings) {
}
}
LOG(INFO) << "Pno scan started " << freq_string;
+ nodev_counter_ = 0;
pno_scan_started_ = true;
return true;
}
@@ -410,7 +424,7 @@ void ScannerImpl::OnSchedScanResultsReady(uint32_t interface_index,
}
SchedScanIntervalSetting ScannerImpl::GenerateIntervalSetting(
- const ::com::android::server::wifi::wificond::PnoSettings&
+ const android::net::wifi::nl80211::PnoSettings&
pno_settings) const {
bool support_num_scan_plans = scan_capabilities_.max_num_scan_plans >= 2;
bool support_scan_plan_interval =
diff --git a/scanning/scanner_impl.h b/scanning/scanner_impl.h
index 3c1a4c7..6e23ea7 100644
--- a/scanning/scanner_impl.h
+++ b/scanning/scanner_impl.h
@@ -22,7 +22,7 @@
#include <android-base/macros.h>
#include <binder/Status.h>
-#include "android/net/wifi/BnWifiScannerImpl.h"
+#include "android/net/wifi/nl80211/BnWifiScannerImpl.h"
#include "wificond/net/netlink_utils.h"
#include "wificond/scanning/scan_utils.h"
@@ -32,7 +32,7 @@ namespace wificond {
class ClientInterfaceImpl;
class ScanUtils;
-class ScannerImpl : public android::net::wifi::BnWifiScannerImpl {
+class ScannerImpl : public android::net::wifi::nl80211::BnWifiScannerImpl {
public:
ScannerImpl(uint32_t interface_index,
const ScanCapabilities& scan_capabilities,
@@ -42,28 +42,28 @@ class ScannerImpl : public android::net::wifi::BnWifiScannerImpl {
~ScannerImpl();
// Get the latest single scan results from kernel.
::android::binder::Status getScanResults(
- std::vector<com::android::server::wifi::wificond::NativeScanResult>*
+ std::vector<android::net::wifi::nl80211::NativeScanResult>*
out_scan_results) override;
// Get the latest pno scan results from the interface that most recently
// completed PNO scans
::android::binder::Status getPnoScanResults(
- std::vector<com::android::server::wifi::wificond::NativeScanResult>*
+ std::vector<android::net::wifi::nl80211::NativeScanResult>*
out_scan_results) override;
::android::binder::Status scan(
- const ::com::android::server::wifi::wificond::SingleScanSettings&
+ const android::net::wifi::nl80211::SingleScanSettings&
scan_settings,
bool* out_success) override;
::android::binder::Status startPnoScan(
- const ::com::android::server::wifi::wificond::PnoSettings& pno_settings,
+ const android::net::wifi::nl80211::PnoSettings& pno_settings,
bool* out_success) override;
::android::binder::Status stopPnoScan(bool* out_success) override;
::android::binder::Status abortScan() override;
::android::binder::Status subscribeScanEvents(
- const ::android::sp<::android::net::wifi::IScanEvent>& handler) override;
+ const ::android::sp<::android::net::wifi::nl80211::IScanEvent>& handler) override;
::android::binder::Status unsubscribeScanEvents() override;
::android::binder::Status subscribePnoScanEvents(
- const ::android::sp<::android::net::wifi::IPnoScanEvent>& handler)
+ const ::android::sp<::android::net::wifi::nl80211::IPnoScanEvent>& handler)
override;
::android::binder::Status unsubscribePnoScanEvents() override;
void Invalidate();
@@ -77,22 +77,23 @@ class ScannerImpl : public android::net::wifi::BnWifiScannerImpl {
void LogSsidList(std::vector<std::vector<uint8_t>>& ssid_list,
std::string prefix);
bool StartPnoScanDefault(
- const ::com::android::server::wifi::wificond::PnoSettings& pno_settings);
+ const android::net::wifi::nl80211::PnoSettings& pno_settings);
bool StopPnoScanDefault();
void ParsePnoSettings(
- const ::com::android::server::wifi::wificond::PnoSettings& pno_settings,
+ const android::net::wifi::nl80211::PnoSettings& pno_settings,
std::vector<std::vector<uint8_t>>* scan_ssids,
std::vector<std::vector<uint8_t>>* match_ssids,
std::vector<uint32_t>* freqs, std::vector<uint8_t>* match_security);
SchedScanIntervalSetting GenerateIntervalSetting(
- const ::com::android::server::wifi::wificond::PnoSettings& pno_settings) const;
+ const android::net::wifi::nl80211::PnoSettings& pno_settings) const;
// Boolean variables describing current scanner status.
bool valid_;
bool scan_started_;
bool pno_scan_started_;
- ::com::android::server::wifi::wificond::PnoSettings pno_settings_;
+ android::net::wifi::nl80211::PnoSettings pno_settings_;
+ uint32_t nodev_counter_;
const uint32_t interface_index_;
// Scanning relevant capability information for this wiphy/interface.
@@ -101,8 +102,8 @@ class ScannerImpl : public android::net::wifi::BnWifiScannerImpl {
ClientInterfaceImpl* client_interface_;
ScanUtils* const scan_utils_;
- ::android::sp<::android::net::wifi::IPnoScanEvent> pno_scan_event_handler_;
- ::android::sp<::android::net::wifi::IScanEvent> scan_event_handler_;
+ ::android::sp<::android::net::wifi::nl80211::IPnoScanEvent> pno_scan_event_handler_;
+ ::android::sp<::android::net::wifi::nl80211::IScanEvent> scan_event_handler_;
DISALLOW_COPY_AND_ASSIGN(ScannerImpl);
};
diff --git a/scanning/single_scan_settings.cpp b/scanning/single_scan_settings.cpp
index fa6a079..ec89259 100644
--- a/scanning/single_scan_settings.cpp
+++ b/scanning/single_scan_settings.cpp
@@ -14,21 +14,20 @@
* limitations under the License.
*/
-#include "android/net/wifi/IWifiScannerImpl.h"
+#include "android/net/wifi/nl80211/IWifiScannerImpl.h"
#include "wificond/scanning/single_scan_settings.h"
#include <android-base/logging.h>
#include "wificond/parcelable_utils.h"
-using android::net::wifi::IWifiScannerImpl;
+using android::net::wifi::nl80211::IWifiScannerImpl;
using android::status_t;
-namespace com {
namespace android {
-namespace server {
+namespace net {
namespace wifi {
-namespace wificond {
+namespace nl80211 {
bool SingleScanSettings::isValidScanType() const {
return (scan_type_ == IWifiScannerImpl::SCAN_TYPE_LOW_SPAN ||
scan_type_ == IWifiScannerImpl::SCAN_TYPE_LOW_POWER ||
@@ -109,8 +108,7 @@ status_t SingleScanSettings::readFromParcel(const ::android::Parcel* parcel) {
return ::android::OK;
}
-} // namespace wificond
+} // namespace nl80211
} // namespace wifi
-} // namespace server
+} // namespace net
} // namespace android
-} // namespace com
diff --git a/scanning/single_scan_settings.h b/scanning/single_scan_settings.h
index 9f61d41..6c70e71 100644
--- a/scanning/single_scan_settings.h
+++ b/scanning/single_scan_settings.h
@@ -25,11 +25,10 @@
#include "wificond/scanning/channel_settings.h"
#include "wificond/scanning/hidden_network.h"
-namespace com {
namespace android {
-namespace server {
+namespace net {
namespace wifi {
-namespace wificond {
+namespace nl80211 {
class SingleScanSettings : public ::android::Parcelable {
public:
@@ -50,10 +49,9 @@ class SingleScanSettings : public ::android::Parcelable {
bool isValidScanType() const;
};
-} // namespace wificond
+} // namespace nl80211
} // namespace wifi
-} // namespace server
+} // namespace net
} // namespace android
-} // namespace com
#endif // WIFICOND_SCANNING_SINGLE_SCAN_SETTINGS_H_
diff --git a/server.cpp b/server.cpp
index f6fefa1..2f7104b 100644
--- a/server.cpp
+++ b/server.cpp
@@ -32,9 +32,10 @@ using android::base::WriteStringToFd;
using android::binder::Status;
using android::sp;
using android::IBinder;
-using android::net::wifi::IApInterface;
-using android::net::wifi::IClientInterface;
-using android::net::wifi::IInterfaceEventCallback;
+using android::net::wifi::nl80211::IApInterface;
+using android::net::wifi::nl80211::IClientInterface;
+using android::net::wifi::nl80211::IInterfaceEventCallback;
+using android::net::wifi::nl80211::DeviceWiphyCapabilities;
using android::wifi_system::InterfaceTool;
using std::endl;
@@ -295,6 +296,57 @@ Status Server::getAvailableDFSChannels(
return Status::ok();
}
+Status Server::getAvailable6gChannels(
+ std::optional<vector<int32_t>>* out_frequencies) {
+ BandInfo band_info;
+ ScanCapabilities scan_capabilities_ignored;
+ WiphyFeatures wiphy_features_ignored;
+
+ if (!netlink_utils_->GetWiphyInfo(wiphy_index_, &band_info,
+ &scan_capabilities_ignored,
+ &wiphy_features_ignored)) {
+ LOG(ERROR) << "Failed to get wiphy info from kernel";
+ out_frequencies->reset();
+ return Status::ok();
+ }
+
+ out_frequencies->emplace(band_info.band_6g.begin(), band_info.band_6g.end());
+ return Status::ok();
+}
+
+Status Server::getDeviceWiphyCapabilities(
+ const std::string& iface_name,
+ std::optional<DeviceWiphyCapabilities>* capabilities) {
+ if (!RefreshWiphyIndex(iface_name)) {
+ capabilities = nullptr;
+ return Status::ok();
+ }
+
+ BandInfo band_info;
+ ScanCapabilities scan_capabilities_ignored;
+ WiphyFeatures wiphy_features_ignored;
+
+ if (!netlink_utils_->GetWiphyInfo(wiphy_index_, &band_info,
+ &scan_capabilities_ignored,
+ &wiphy_features_ignored)) {
+ LOG(ERROR) << "Failed to get wiphy info from kernel";
+ capabilities = nullptr;
+ return Status::ok();
+ }
+
+ capabilities->emplace();
+
+ capabilities->value().is80211nSupported_ = band_info.is_80211n_supported;
+ capabilities->value().is80211acSupported_ = band_info.is_80211ac_supported;
+ capabilities->value().is80211axSupported_ = band_info.is_80211ax_supported;
+ capabilities->value().is160MhzSupported_ = band_info.is_160_mhz_supported;
+ capabilities->value().is80p80MhzSupported_ = band_info.is_80p80_mhz_supported;
+ capabilities->value().maxTxStreams_ = band_info.max_tx_streams;
+ capabilities->value().maxRxStreams_ = band_info.max_rx_streams;
+
+ return Status::ok();
+}
+
bool Server::SetupInterface(const std::string& iface_name,
InterfaceInfo* interface) {
if (!RefreshWiphyIndex(iface_name)) {
@@ -367,6 +419,11 @@ void Server::LogSupportedBands() {
ss << " " << band_info.band_dfs[i];
}
LOG(INFO) << "5Ghz DFS frequencies:"<< ss.str();
+
+ for (unsigned int i = 0; i < band_info.band_6g.size(); i++) {
+ ss << " " << band_info.band_6g[i];
+ }
+ LOG(INFO) << "6Ghz frequencies:"<< ss.str();
}
void Server::BroadcastClientInterfaceReady(
diff --git a/server.h b/server.h
index a48ff20..8477671 100644
--- a/server.h
+++ b/server.h
@@ -24,10 +24,10 @@
#include <android-base/macros.h>
#include <wifi_system/interface_tool.h>
-#include "android/net/wifi/BnWificond.h"
-#include "android/net/wifi/IApInterface.h"
-#include "android/net/wifi/IClientInterface.h"
-#include "android/net/wifi/IInterfaceEventCallback.h"
+#include "android/net/wifi/nl80211/BnWificond.h"
+#include "android/net/wifi/nl80211/IApInterface.h"
+#include "android/net/wifi/nl80211/IClientInterface.h"
+#include "android/net/wifi/nl80211/IInterfaceEventCallback.h"
#include "wificond/ap_interface_impl.h"
#include "wificond/client_interface_impl.h"
@@ -41,7 +41,7 @@ class ScanUtils;
struct InterfaceInfo;
-class Server : public android::net::wifi::BnWificond {
+class Server : public android::net::wifi::nl80211::BnWificond {
public:
Server(std::unique_ptr<wifi_system::InterfaceTool> if_tool,
NetlinkUtils* netlink_utils,
@@ -49,10 +49,10 @@ class Server : public android::net::wifi::BnWificond {
~Server() override = default;
android::binder::Status RegisterCallback(
- const android::sp<android::net::wifi::IInterfaceEventCallback>&
+ const android::sp<android::net::wifi::nl80211::IInterfaceEventCallback>&
callback) override;
android::binder::Status UnregisterCallback(
- const android::sp<android::net::wifi::IInterfaceEventCallback>&
+ const android::sp<android::net::wifi::nl80211::IInterfaceEventCallback>&
callback) override;
// Returns a vector of available frequencies for 2.4GHz channels.
android::binder::Status getAvailable2gChannels(
@@ -63,15 +63,18 @@ class Server : public android::net::wifi::BnWificond {
// Returns a vector of available frequencies for DFS channels.
android::binder::Status getAvailableDFSChannels(
::std::optional<::std::vector<int32_t>>* out_frequencies) override;
+ // Returns a vector of available frequencies for 6GHz channels.
+ android::binder::Status getAvailable6gChannels(
+ ::std::optional<::std::vector<int32_t>>* out_frequencies) override;
android::binder::Status createApInterface(
const std::string& iface_name,
- android::sp<android::net::wifi::IApInterface>*
+ android::sp<android::net::wifi::nl80211::IApInterface>*
created_interface) override;
android::binder::Status createClientInterface(
const std::string& iface_name,
- android::sp<android::net::wifi::IClientInterface>*
+ android::sp<android::net::wifi::nl80211::IClientInterface>*
created_interface) override;
android::binder::Status tearDownApInterface(
@@ -90,6 +93,11 @@ class Server : public android::net::wifi::BnWificond {
std::vector<android::sp<android::IBinder>>* out_ap_ifs) override;
status_t dump(int fd, const Vector<String16>& args) override;
+ // Returns device wiphy capabilities for an interface
+ android::binder::Status getDeviceWiphyCapabilities(
+ const std::string& iface_name,
+ ::std::optional<net::wifi::nl80211::DeviceWiphyCapabilities>* capabilities) override;
+
private:
// Request interface information from kernel and setup local interface object.
// This assumes that interface should be in STATION mode. Even if we setup
@@ -101,13 +109,13 @@ class Server : public android::net::wifi::BnWificond {
void LogSupportedBands();
void OnRegDomainChanged(std::string& country_code);
void BroadcastClientInterfaceReady(
- android::sp<android::net::wifi::IClientInterface> network_interface);
+ android::sp<android::net::wifi::nl80211::IClientInterface> network_interface);
void BroadcastApInterfaceReady(
- android::sp<android::net::wifi::IApInterface> network_interface);
+ android::sp<android::net::wifi::nl80211::IApInterface> network_interface);
void BroadcastClientInterfaceTornDown(
- android::sp<android::net::wifi::IClientInterface> network_interface);
+ android::sp<android::net::wifi::nl80211::IClientInterface> network_interface);
void BroadcastApInterfaceTornDown(
- android::sp<android::net::wifi::IApInterface> network_interface);
+ android::sp<android::net::wifi::nl80211::IApInterface> network_interface);
void MarkDownAllInterfaces();
const std::unique_ptr<wifi_system::InterfaceTool> if_tool_;
@@ -117,7 +125,7 @@ class Server : public android::net::wifi::BnWificond {
uint32_t wiphy_index_;
std::map<std::string, std::unique_ptr<ApInterfaceImpl>> ap_interfaces_;
std::map<std::string, std::unique_ptr<ClientInterfaceImpl>> client_interfaces_;
- std::vector<android::sp<android::net::wifi::IInterfaceEventCallback>>
+ std::vector<android::sp<android::net::wifi::nl80211::IInterfaceEventCallback>>
interface_event_callbacks_;
// Cached interface list from kernel.
diff --git a/tests/ap_interface_impl_unittest.cpp b/tests/ap_interface_impl_unittest.cpp
index 59d9c0f..35e8161 100644
--- a/tests/ap_interface_impl_unittest.cpp
+++ b/tests/ap_interface_impl_unittest.cpp
@@ -32,7 +32,7 @@
#include "wificond/ap_interface_impl.h"
using android::wifi_system::MockInterfaceTool;
-using com::android::server::wifi::wificond::NativeWifiClient;
+using android::net::wifi::nl80211::NativeWifiClient;
using std::array;
using std::placeholders::_1;
using std::placeholders::_2;
@@ -90,60 +90,6 @@ class ApInterfaceImplTest : public ::testing::Test {
} // namespace
-TEST_F(ApInterfaceImplTest, CanGetConnectedClients) {
- OnStationEventHandler handler;
- EXPECT_CALL(*netlink_utils_,
- SubscribeStationEvent(kTestInterfaceIndex, _)).
- WillOnce(Invoke(bind(CaptureStationEventHandler, &handler, _1, _2)));
-
- ap_interface_.reset(new ApInterfaceImpl(
- kTestInterfaceName,
- kTestInterfaceIndex,
- netlink_utils_.get(),
- if_tool_.get()));
-
- array<uint8_t, ETH_ALEN> fake_mac_address_01 = kFakeMacAddress01;
- array<uint8_t, ETH_ALEN> fake_mac_address_02 = kFakeMacAddress02;
- std::vector<NativeWifiClient> associated_stations =
- ap_interface_->GetConnectedClients();
- int numberOfStations = static_cast<int>(associated_stations.size());
- EXPECT_EQ(0, numberOfStations);
- handler(NEW_STATION, fake_mac_address_01);
- associated_stations = ap_interface_->GetConnectedClients();
- numberOfStations = static_cast<int>(associated_stations.size());
- EXPECT_EQ(1, numberOfStations);
- handler(NEW_STATION, fake_mac_address_02);
- associated_stations = ap_interface_->GetConnectedClients();
- numberOfStations = static_cast<int>(associated_stations.size());
- EXPECT_EQ(2, numberOfStations);
- handler(DEL_STATION, fake_mac_address_01);
- associated_stations = ap_interface_->GetConnectedClients();
- numberOfStations = static_cast<int>(associated_stations.size());
- EXPECT_EQ(1, numberOfStations);
-}
-
-TEST_F(ApInterfaceImplTest, CanGetConnectedClientsSetsValues) {
- OnStationEventHandler handler;
- EXPECT_CALL(*netlink_utils_,
- SubscribeStationEvent(kTestInterfaceIndex, _)).
- WillOnce(Invoke(bind(CaptureStationEventHandler, &handler, _1, _2)));
-
- ap_interface_.reset(new ApInterfaceImpl(
- kTestInterfaceName,
- kTestInterfaceIndex,
- netlink_utils_.get(),
- if_tool_.get()));
-
- array<uint8_t, ETH_ALEN> fake_mac_address_01 = kFakeMacAddress01;
- vector<uint8_t> expected_mac_address =
- vector<uint8_t>(fake_mac_address_01.begin(), fake_mac_address_01.end());
- handler(NEW_STATION, fake_mac_address_01);
- std::vector<NativeWifiClient> associated_stations =
- ap_interface_->GetConnectedClients();
- NativeWifiClient station = associated_stations[0];
- EXPECT_EQ(expected_mac_address, station.macAddress);
-}
-
TEST_F(ApInterfaceImplTest, CallbackIsCalledOnConnectedClientsChanged) {
OnStationEventHandler handler;
EXPECT_CALL(*netlink_utils_, SubscribeStationEvent(kTestInterfaceIndex, _))
@@ -160,7 +106,7 @@ TEST_F(ApInterfaceImplTest, CallbackIsCalledOnConnectedClientsChanged) {
array<uint8_t, ETH_ALEN> fake_mac_address_01 = kFakeMacAddress01;
array<uint8_t, ETH_ALEN> fake_mac_address_02 = kFakeMacAddress02;
- EXPECT_CALL(*callback, onConnectedClientsChanged(_)).Times(3);
+ EXPECT_CALL(*callback, onConnectedClientsChanged(_,_)).Times(3);
handler(NEW_STATION, fake_mac_address_01);
handler(NEW_STATION, fake_mac_address_02);
handler(DEL_STATION, fake_mac_address_01);
@@ -181,7 +127,7 @@ TEST_F(ApInterfaceImplTest, CallbackIsCalledOnConnectedClientsChangedOnlyOnDiff)
EXPECT_TRUE(out_success);
array<uint8_t, ETH_ALEN> fake_mac_address_01 = kFakeMacAddress01;
- EXPECT_CALL(*callback, onConnectedClientsChanged(_)).Times(2);
+ EXPECT_CALL(*callback, onConnectedClientsChanged(_,_)).Times(4);
handler(NEW_STATION, fake_mac_address_01);
handler(NEW_STATION, fake_mac_address_01);
handler(DEL_STATION, fake_mac_address_01);
diff --git a/tests/client_interface_impl_unittest.cpp b/tests/client_interface_impl_unittest.cpp
index 5929139..1dc2699 100644
--- a/tests/client_interface_impl_unittest.cpp
+++ b/tests/client_interface_impl_unittest.cpp
@@ -77,6 +77,8 @@ class ClientInterfaceImplTest : public ::testing::Test {
OnFrameTxStatusEventHandler handler) {
frame_tx_status_event_handler_ = handler;
});
+ EXPECT_CALL(*netlink_utils_,
+ SubscribeChannelSwitchEvent(kTestInterfaceIndex, _));
client_interface_.reset(new ClientInterfaceImpl{
kTestWiphyIndex,
kTestInterfaceName,
@@ -92,6 +94,8 @@ class ClientInterfaceImplTest : public ::testing::Test {
UnsubscribeMlmeEvent(kTestInterfaceIndex));
EXPECT_CALL(*netlink_utils_,
UnsubscribeFrameTxStatusEvent(kTestInterfaceIndex));
+ EXPECT_CALL(*netlink_utils_,
+ UnsubscribeChannelSwitchEvent(kTestInterfaceIndex));
}
unique_ptr<NiceMock<MockInterfaceTool>> if_tool_{
@@ -110,45 +114,6 @@ class ClientInterfaceImplTest : public ::testing::Test {
} // namespace
-TEST_F(ClientInterfaceImplTest, SetMacAddressFailsOnInterfaceDownFailure) {
- EXPECT_CALL(*if_tool_, SetWifiUpState(false)).WillOnce(Return(false));
- EXPECT_FALSE(
- client_interface_->SetMacAddress(std::array<uint8_t, ETH_ALEN>()));
-}
-
-TEST_F(ClientInterfaceImplTest, SetMacAddressFailsOnAddressChangeFailure) {
- EXPECT_CALL(*if_tool_, SetWifiUpState(false)).WillOnce(Return(true));
- EXPECT_CALL(*if_tool_, SetMacAddress(_, _)).WillOnce(Return(false));
- EXPECT_FALSE(
- client_interface_->SetMacAddress(std::array<uint8_t, ETH_ALEN>()));
-}
-
-TEST_F(ClientInterfaceImplTest, SetMacAddressFailsOnInterfaceUpFailure) {
- EXPECT_CALL(*if_tool_, SetWifiUpState(false)).WillOnce(Return(true));
- EXPECT_CALL(*if_tool_, SetMacAddress(_, _)).WillOnce(Return(true));
- EXPECT_CALL(*if_tool_, SetWifiUpState(true)).WillOnce(Return(false));
- EXPECT_FALSE(
- client_interface_->SetMacAddress(std::array<uint8_t, ETH_ALEN>()));
-}
-
-TEST_F(ClientInterfaceImplTest, SetMacAddressReturnsTrueOnSuccess) {
- EXPECT_CALL(*if_tool_, SetWifiUpState(false)).WillOnce(Return(true));
- EXPECT_CALL(*if_tool_, SetMacAddress(_, _)).WillOnce(Return(true));
- EXPECT_CALL(*if_tool_, SetWifiUpState(true)).WillOnce(Return(true));
- EXPECT_TRUE(
- client_interface_->SetMacAddress(std::array<uint8_t, ETH_ALEN>()));
-}
-
-TEST_F(ClientInterfaceImplTest, SetMacAddressPassesCorrectAddressToIfTool) {
- EXPECT_CALL(*if_tool_, SetWifiUpState(false)).WillOnce(Return(true));
- EXPECT_CALL(*if_tool_, SetMacAddress(_,
- std::array<uint8_t, ETH_ALEN>{{1, 2, 3, 4, 5, 6}}))
- .WillOnce(Return(true));
- EXPECT_CALL(*if_tool_, SetWifiUpState(true)).WillOnce(Return(true));
- EXPECT_TRUE(client_interface_->SetMacAddress(
- std::array<uint8_t, ETH_ALEN>{{1, 2, 3, 4, 5, 6}}));
-}
-
/**
* If the device does not support sending mgmt frame at specified MCS rate,
* and the caller specifies a MCS < 0, the call should still succeed (and the
diff --git a/tests/integration/ap_interface_test.cpp b/tests/integration/ap_interface_test.cpp
index 3af92f7..f5812c6 100644
--- a/tests/integration/ap_interface_test.cpp
+++ b/tests/integration/ap_interface_test.cpp
@@ -20,13 +20,13 @@
#include <utils/StrongPointer.h>
#include <wifi_system/interface_tool.h>
-#include "android/net/wifi/IApInterface.h"
-#include "android/net/wifi/IWificond.h"
+#include "android/net/wifi/nl80211/IApInterface.h"
+#include "android/net/wifi/nl80211/IWificond.h"
#include "wificond/tests/integration/process_utils.h"
#include "wificond/tests/mock_ap_interface_event_callback.h"
-using android::net::wifi::IApInterface;
-using android::net::wifi::IWificond;
+using android::net::wifi::nl80211::IApInterface;
+using android::net::wifi::nl80211::IWificond;
using android::wifi_system::InterfaceTool;
using android::wificond::MockApInterfaceEventCallback;
using android::wificond::tests::integration::ScopedDevModeWificond;
diff --git a/tests/integration/client_interface_test.cpp b/tests/integration/client_interface_test.cpp
index 37b9dba..43ec0f2 100644
--- a/tests/integration/client_interface_test.cpp
+++ b/tests/integration/client_interface_test.cpp
@@ -21,12 +21,12 @@
#include <utils/StrongPointer.h>
#include <wifi_system/interface_tool.h>
-#include "android/net/wifi/IClientInterface.h"
-#include "android/net/wifi/IWificond.h"
+#include "android/net/wifi/nl80211/IClientInterface.h"
+#include "android/net/wifi/nl80211/IWificond.h"
#include "wificond/tests/integration/process_utils.h"
-using android::net::wifi::IClientInterface;
-using android::net::wifi::IWificond;
+using android::net::wifi::nl80211::IClientInterface;
+using android::net::wifi::nl80211::IWificond;
using android::wifi_system::InterfaceTool;
using android::wificond::tests::integration::ScopedDevModeWificond;
using std::string;
diff --git a/tests/integration/process_utils.cpp b/tests/integration/process_utils.cpp
index e1c7b8f..80d74f3 100644
--- a/tests/integration/process_utils.cpp
+++ b/tests/integration/process_utils.cpp
@@ -32,7 +32,7 @@
using android::String16;
using android::base::StringPrintf;
using android::base::Trim;
-using android::net::wifi::IWificond;
+using android::net::wifi::nl80211::IWificond;
using android::sp;
using android::wificond::ipc_constants::kServiceName;
diff --git a/tests/integration/process_utils.h b/tests/integration/process_utils.h
index 1bec3ea..6101857 100644
--- a/tests/integration/process_utils.h
+++ b/tests/integration/process_utils.h
@@ -24,7 +24,7 @@
#include <android-base/macros.h>
#include <utils/StrongPointer.h>
-#include "android/net/wifi/IWificond.h"
+#include "android/net/wifi/nl80211/IWificond.h"
namespace android {
namespace wificond {
@@ -57,9 +57,9 @@ class ScopedDevModeWificond final {
// This makes avoids the nastiness of restarting a system process
// because you instantiated an object.
// ASSERTs that wificond starts in dev mode.
- android::sp<android::net::wifi::IWificond> EnterDevModeOrDie();
+ android::sp<android::net::wifi::nl80211::IWificond> EnterDevModeOrDie();
// Returns true iff wificond entered dev mode.
- android::sp<android::net::wifi::IWificond> MaybeEnterDevMode();
+ android::sp<android::net::wifi::nl80211::IWificond> MaybeEnterDevMode();
// This will be called for you in the destructor, but you can do it yourself
// if you prefer.
diff --git a/tests/integration/scanner_test.cpp b/tests/integration/scanner_test.cpp
index 1844045..ff817e4 100644
--- a/tests/integration/scanner_test.cpp
+++ b/tests/integration/scanner_test.cpp
@@ -20,13 +20,13 @@
#include <gtest/gtest.h>
#include <utils/StrongPointer.h>
-#include "android/net/wifi/IClientInterface.h"
-#include "android/net/wifi/IWificond.h"
+#include "android/net/wifi/nl80211/IClientInterface.h"
+#include "android/net/wifi/nl80211/IWificond.h"
#include "wificond/tests/integration/process_utils.h"
-using android::net::wifi::IClientInterface;
-using android::net::wifi::IWificond;
-using android::net::wifi::IWifiScannerImpl;
+using android::net::wifi::nl80211::IClientInterface;
+using android::net::wifi::nl80211::IWificond;
+using android::net::wifi::nl80211::IWifiScannerImpl;
using android::wificond::tests::integration::ScopedDevModeWificond;
using std::unique_ptr;
using std::vector;
diff --git a/tests/mock_ap_interface_event_callback.h b/tests/mock_ap_interface_event_callback.h
index 8e77fee..4177987 100644
--- a/tests/mock_ap_interface_event_callback.h
+++ b/tests/mock_ap_interface_event_callback.h
@@ -20,20 +20,20 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#include "android/net/wifi/IApInterfaceEventCallback.h"
+#include "android/net/wifi/nl80211/IApInterfaceEventCallback.h"
namespace android {
namespace wificond {
class MockApInterfaceEventCallback
- : public net::wifi::IApInterfaceEventCallback {
+ : public net::wifi::nl80211::IApInterfaceEventCallback {
public:
MockApInterfaceEventCallback() = default;
~MockApInterfaceEventCallback() = default;
MOCK_METHOD0(onAsBinder, IBinder*());
- MOCK_METHOD1(onConnectedClientsChanged, ::android::binder::Status(
- const ::std::vector<::com::android::server::wifi::wificond::NativeWifiClient> &));
+ MOCK_METHOD2(onConnectedClientsChanged, ::android::binder::Status(
+ const android::net::wifi::nl80211::NativeWifiClient &, bool isConnected));
MOCK_METHOD2(onSoftApChannelSwitched, ::android::binder::Status(int, int));
};
diff --git a/tests/mock_i_send_mgmt_frame_event.h b/tests/mock_i_send_mgmt_frame_event.h
index 30b7da7..c105590 100644
--- a/tests/mock_i_send_mgmt_frame_event.h
+++ b/tests/mock_i_send_mgmt_frame_event.h
@@ -20,13 +20,13 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#include "android/net/wifi/ISendMgmtFrameEvent.h"
+#include "android/net/wifi/nl80211/ISendMgmtFrameEvent.h"
namespace android {
namespace wificond {
class MockISendMgmtFrameEvent
- : public ::android::net::wifi::ISendMgmtFrameEvent {
+ : public ::android::net::wifi::nl80211::ISendMgmtFrameEvent {
public:
virtual ~MockISendMgmtFrameEvent() override = default;
diff --git a/tests/mock_scan_utils.h b/tests/mock_scan_utils.h
index eb7e9c7..acb7f45 100644
--- a/tests/mock_scan_utils.h
+++ b/tests/mock_scan_utils.h
@@ -39,7 +39,7 @@ class MockScanUtils : public ScanUtils {
OnScanResultsReadyHandler handler));
MOCK_METHOD2(GetScanResult, bool(
uint32_t interface_index,
- std::vector<::com::android::server::wifi::wificond::NativeScanResult>* out_scan_results));
+ std::vector<android::net::wifi::nl80211::NativeScanResult>* out_scan_results));
MOCK_METHOD6(Scan, bool(
uint32_t interface_index,
@@ -49,11 +49,12 @@ class MockScanUtils : public ScanUtils {
const std::vector<uint32_t>& freqs,
int* error_code));
- MOCK_METHOD9(StartScheduledScan, bool(
+ MOCK_METHOD10(StartScheduledScan, bool(
uint32_t interface_index,
const SchedScanIntervalSetting& interval_setting,
int32_t rssi_threshold_2g,
int32_t rssi_threshold_5g,
+ int32_t rssi_threshold_6g,
const SchedScanReqFlags& req_flags,
const std::vector<std::vector<uint8_t>>& scan_ssids,
const std::vector<std::vector<uint8_t>>& match_ssids,
diff --git a/tests/native_wifi_client_unittest.cpp b/tests/native_wifi_client_unittest.cpp
new file mode 100644
index 0000000..e426107
--- /dev/null
+++ b/tests/native_wifi_client_unittest.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2019, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <vector>
+
+#include <gtest/gtest.h>
+
+#include "wificond/client/native_wifi_client.h"
+
+using ::android::net::wifi::nl80211::NativeWifiClient;
+using std::vector;
+
+namespace android {
+namespace wificond {
+
+namespace {
+
+const vector<uint8_t> kMacAddress = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 };
+const vector<uint8_t> kMacAddressOther = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x0F };
+
+} // namespace
+
+class NativeWifiClientTest : public ::testing::Test {
+};
+
+TEST_F(NativeWifiClientTest, NativeWifiClientParcelableTest) {
+ NativeWifiClient wifi_client;
+ wifi_client.mac_address_ = kMacAddress;
+
+ Parcel parcel;
+ EXPECT_EQ(::android::OK, wifi_client.writeToParcel(&parcel));
+
+ NativeWifiClient wifi_client_copy;
+ parcel.setDataPosition(0);
+ EXPECT_EQ(::android::OK, wifi_client_copy.readFromParcel(&parcel));
+
+ EXPECT_EQ(wifi_client, wifi_client_copy);
+
+ NativeWifiClient wifi_client_other;
+ wifi_client_other.mac_address_ = kMacAddressOther;
+ EXPECT_FALSE(wifi_client == wifi_client_other);
+}
+
+} // namespace wificond
+} // namespace android
diff --git a/tests/netlink_utils_unittest.cpp b/tests/netlink_utils_unittest.cpp
index 34f5c21..986f3b2 100644
--- a/tests/netlink_utils_unittest.cpp
+++ b/tests/netlink_utils_unittest.cpp
@@ -75,7 +75,19 @@ const uint8_t kFakeExtFeaturesForLowPowerScan[] = {0x0, 0x0, 0x80};
const uint8_t kFakeExtFeaturesForHighAccuracy[] = {0x0, 0x0, 0x0, 0x1};
const uint8_t kFakeExtFeaturesForAllScanType[] = {0x0, 0x0, 0xC0, 0x1};
const uint8_t kFakeFrame[] = {0x00, 0x01, 0x02, 0x03};
-
+constexpr bool k11nSupported = true;
+constexpr bool k11acSupported = true;
+constexpr bool k11axSupported = true;
+constexpr uint8_t kMaxTxStreams = 4;
+constexpr uint8_t kMaxRxStreams = 5;
+constexpr bool k160MHzSupported = true;
+constexpr bool k80p80MHzSupported = false;
+const uint8_t kHtMcsSet[] = {0xff, 0xff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0xf, 0x0, 0x0, 0x0};
+const uint8_t kVhtMcsSet[] = {0xaa, 0xfe, 0xff, 0xff, 0xaa, 0xff, 0xff, 0xff};
+const uint8_t kHeMcsSet[] = {0xaa, 0xfe, 0xaa, 0xff};
+const uint8_t kVhtCap[] = {0x4, 0x0, 0x0, 0x0};
+const uint8_t kHeCapPhy[] = {0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
// Currently, control messages are only created by the kernel and sent to us.
// Therefore NL80211Packet doesn't have corresponding constructor.
@@ -121,6 +133,56 @@ void AppendScanCapabilitiesAttributes(NL80211Packet* packet,
}
}
+
+NL80211Attr<std::vector<uint8_t>> GenerateBandsAttributeForHtCapa() {
+ std::vector<uint8_t> ht_cap(2, 0);
+ return NL80211Attr<std::vector<uint8_t>>(NL80211_BAND_ATTR_HT_CAPA,
+ ht_cap);
+}
+
+
+NL80211Attr<std::vector<uint8_t>> GenerateBandsAttributeForVhtCapa() {
+ std::vector<uint8_t> vht_cap(kVhtCap, kVhtCap + sizeof(kVhtCap));
+ return NL80211Attr<std::vector<uint8_t>>(NL80211_BAND_ATTR_VHT_CAPA,
+ vht_cap);
+}
+
+NL80211Attr<std::vector<uint8_t>> GenerateBandsAttributeForHtMcsSet() {
+ std::vector<uint8_t> ht_mcs_set(kHtMcsSet, kHtMcsSet + sizeof(kHtMcsSet));
+ return NL80211Attr<std::vector<uint8_t>>(NL80211_BAND_ATTR_HT_MCS_SET,
+ ht_mcs_set);
+}
+
+NL80211Attr<std::vector<uint8_t>> GenerateBandsAttributeForVhtMcsSet() {
+ std::vector<uint8_t> vht_mcs_set(kVhtMcsSet, kVhtMcsSet + sizeof(kVhtMcsSet));
+ return NL80211Attr<std::vector<uint8_t>>(NL80211_BAND_ATTR_VHT_MCS_SET,
+ vht_mcs_set);
+}
+
+NL80211NestedAttr GenerateBandsAttributeForIfTypeData() {
+ NL80211NestedAttr if_type_data(NL80211_BAND_ATTR_IFTYPE_DATA);
+
+ NL80211NestedAttr if_type_data1(1);
+ std::vector<uint8_t> he_cap_phy(kHeCapPhy, kHeCapPhy + sizeof(kHeCapPhy));
+ std::vector<uint8_t> he_mcs_set(kHeMcsSet, kHeMcsSet + sizeof(kHeMcsSet));
+
+ if_type_data1.AddAttribute(NL80211Attr<std::vector<uint8_t>>(
+ NL80211_BAND_IFTYPE_ATTR_HE_CAP_PHY, he_cap_phy));
+ if_type_data1.AddAttribute(NL80211Attr<std::vector<uint8_t>>(
+ NL80211_BAND_IFTYPE_ATTR_HE_CAP_MCS_SET, he_mcs_set));
+ if_type_data.AddAttribute(if_type_data1);
+ return if_type_data;
+}
+
+void AppendBandPhyAttributes(NL80211NestedAttr* band_attr) {
+ band_attr->AddAttribute(GenerateBandsAttributeForHtCapa());
+ band_attr->AddAttribute(GenerateBandsAttributeForHtMcsSet());
+ band_attr->AddAttribute(GenerateBandsAttributeForVhtCapa());
+ band_attr->AddAttribute(GenerateBandsAttributeForVhtMcsSet());
+
+ band_attr->AddAttribute(GenerateBandsAttributeForIfTypeData());
+}
+
NL80211NestedAttr GenerateBandsAttributeFor2g() {
NL80211NestedAttr freq_2g_1(1);
NL80211NestedAttr freq_2g_2(2);
@@ -139,6 +201,7 @@ NL80211NestedAttr GenerateBandsAttributeFor2g() {
NL80211NestedAttr band_2g_attr(1);
band_2g_attr.AddAttribute(band_2g_freqs);
+ AppendBandPhyAttributes(&band_2g_attr);
NL80211NestedAttr band_attr(NL80211_ATTR_WIPHY_BANDS);
band_attr.AddAttribute(band_2g_attr);
@@ -177,6 +240,7 @@ NL80211NestedAttr GenerateBandsAttributeFor5gAndDfs() {
NL80211NestedAttr band_5g_attr(1);
band_5g_attr.AddAttribute(band_5g_freqs);
+ AppendBandPhyAttributes(&band_5g_attr);
NL80211NestedAttr band_attr(NL80211_ATTR_WIPHY_BANDS);
band_attr.AddAttribute(band_5g_attr);
@@ -187,6 +251,7 @@ void AppendBandInfoAttributes(NL80211Packet* packet) {
NL80211NestedAttr attr_2g = GenerateBandsAttributeFor2g();
NL80211NestedAttr attr_5g_and_dfs = GenerateBandsAttributeFor5gAndDfs();
attr_2g.Merge(attr_5g_and_dfs);
+
packet->AddAttribute(attr_2g);
}
@@ -267,6 +332,13 @@ void VerifyBandInfo(const BandInfo& band_info) {
EXPECT_EQ(band_info.band_2g, band_2g_expected);
EXPECT_EQ(band_info.band_5g, band_5g_expected);
EXPECT_EQ(band_info.band_dfs, band_dfs_expected);
+ EXPECT_EQ(band_info.is_80211n_supported, k11nSupported);
+ EXPECT_EQ(band_info.is_80211ac_supported, k11acSupported);
+ EXPECT_EQ(band_info.is_80211ax_supported, k11axSupported);
+ EXPECT_EQ(band_info.is_160_mhz_supported, k160MHzSupported);
+ EXPECT_EQ(band_info.is_80p80_mhz_supported, k80p80MHzSupported);
+ EXPECT_EQ(band_info.max_tx_streams, kMaxTxStreams);
+ EXPECT_EQ(band_info.max_rx_streams, kMaxRxStreams);
}
void VerifyWiphyFeatures(const WiphyFeatures& wiphy_features) {
diff --git a/tests/scan_result_unittest.cpp b/tests/scan_result_unittest.cpp
index facda6f..7cac000 100644
--- a/tests/scan_result_unittest.cpp
+++ b/tests/scan_result_unittest.cpp
@@ -23,8 +23,8 @@
#include "wificond/scanning/scan_result.h"
-using ::com::android::server::wifi::wificond::NativeScanResult;
-using ::com::android::server::wifi::wificond::RadioChainInfo;
+using ::android::net::wifi::nl80211::NativeScanResult;
+using ::android::net::wifi::nl80211::RadioChainInfo;
using std::array;
using std::vector;
diff --git a/tests/scan_settings_unittest.cpp b/tests/scan_settings_unittest.cpp
index 707392d..d3d1574 100644
--- a/tests/scan_settings_unittest.cpp
+++ b/tests/scan_settings_unittest.cpp
@@ -18,19 +18,19 @@
#include <gtest/gtest.h>
-#include "android/net/wifi/IWifiScannerImpl.h"
+#include "android/net/wifi/nl80211/IWifiScannerImpl.h"
#include "wificond/scanning/channel_settings.h"
#include "wificond/scanning/hidden_network.h"
#include "wificond/scanning/pno_network.h"
#include "wificond/scanning/pno_settings.h"
#include "wificond/scanning/single_scan_settings.h"
-using ::android::net::wifi::IWifiScannerImpl;
-using ::com::android::server::wifi::wificond::ChannelSettings;
-using ::com::android::server::wifi::wificond::HiddenNetwork;
-using ::com::android::server::wifi::wificond::PnoNetwork;
-using ::com::android::server::wifi::wificond::PnoSettings;
-using ::com::android::server::wifi::wificond::SingleScanSettings;
+using ::android::net::wifi::nl80211::IWifiScannerImpl;
+using ::android::net::wifi::nl80211::ChannelSettings;
+using ::android::net::wifi::nl80211::HiddenNetwork;
+using ::android::net::wifi::nl80211::PnoNetwork;
+using ::android::net::wifi::nl80211::PnoSettings;
+using ::android::net::wifi::nl80211::SingleScanSettings;
using std::vector;
namespace android {
@@ -46,6 +46,7 @@ const uint8_t kFakeSsid1[] =
constexpr int32_t kFakePnoIntervalMs = 20000;
constexpr int32_t kFakePnoMin2gRssi = -80;
constexpr int32_t kFakePnoMin5gRssi = -85;
+constexpr int32_t kFakePnoMin6gRssi = -89;
constexpr uint32_t kFakeFrequency = 5260;
constexpr uint32_t kFakeFrequency1 = 2460;
@@ -162,6 +163,7 @@ TEST_F(ScanSettingsTest, PnoSettingsParcelableTest) {
pno_settings.interval_ms_ = kFakePnoIntervalMs;
pno_settings.min_2g_rssi_ = kFakePnoMin2gRssi;
pno_settings.min_5g_rssi_ = kFakePnoMin5gRssi;
+ pno_settings.min_6g_rssi_ = kFakePnoMin6gRssi;
pno_settings.pno_networks_ = {network, network1};
diff --git a/tests/scan_utils_unittest.cpp b/tests/scan_utils_unittest.cpp
index f8ec523..051d7c0 100644
--- a/tests/scan_utils_unittest.cpp
+++ b/tests/scan_utils_unittest.cpp
@@ -22,7 +22,7 @@
#include <gtest/gtest.h>
-#include "android/net/wifi/IWifiScannerImpl.h"
+#include "android/net/wifi/nl80211/IWifiScannerImpl.h"
#include "wificond/net/kernel-header-latest/nl80211.h"
#include "wificond/scanning/scan_result.h"
#include "wificond/scanning/scan_utils.h"
@@ -40,8 +40,8 @@ using testing::Not;
using testing::Return;
using testing::_;
-using android::net::wifi::IWifiScannerImpl;
-using com::android::server::wifi::wificond::NativeScanResult;
+using android::net::wifi::nl80211::IWifiScannerImpl;
+using android::net::wifi::nl80211::NativeScanResult;
namespace android {
namespace wificond {
@@ -54,6 +54,7 @@ constexpr uint32_t kFakeSequenceNumber = 1984;
constexpr int kFakeErrorCode = EIO;
constexpr int32_t kFake2gRssiThreshold = -80;
constexpr int32_t kFake5gRssiThreshold = -77;
+constexpr int32_t kFake6gRssiThreshold = -77;
constexpr bool kFakeUseRandomMAC = true;
constexpr bool kFakeRequestLowPower = true;
constexpr bool kFakeRequestSchedScanRelativeRssi = true;
@@ -281,7 +282,7 @@ TEST_F(ScanUtilsTest, CanSendSchedScanRequest) {
EXPECT_TRUE(scan_utils_.StartScheduledScan(
kFakeInterfaceIndex,
SchedScanIntervalSetting(),
- kFake2gRssiThreshold, kFake5gRssiThreshold, req_flags, {}, {}, {},
+ kFake2gRssiThreshold, kFake5gRssiThreshold, kFake6gRssiThreshold, req_flags, {}, {}, {},
&errno_ignored));
// TODO(b/34231420): Add validation of requested scan ssids, threshold,
// and frequencies.
@@ -302,7 +303,7 @@ TEST_F(ScanUtilsTest, CanHandleSchedScanRequestFailure) {
EXPECT_FALSE(scan_utils_.StartScheduledScan(
kFakeInterfaceIndex,
SchedScanIntervalSetting(),
- kFake2gRssiThreshold, kFake5gRssiThreshold,
+ kFake2gRssiThreshold, kFake5gRssiThreshold, kFake6gRssiThreshold,
req_flags, {}, {}, {}, &error_code));
EXPECT_EQ(kFakeErrorCode, error_code);
}
@@ -324,7 +325,7 @@ TEST_F(ScanUtilsTest, CanSendSchedScanRequestForLowPowerScan) {
scan_utils_.StartScheduledScan(
kFakeInterfaceIndex,
SchedScanIntervalSetting(),
- kFake2gRssiThreshold, kFake5gRssiThreshold,
+ kFake2gRssiThreshold, kFake5gRssiThreshold, kFake6gRssiThreshold,
req_flags, {}, {}, {}, &errno_ignored);
}
@@ -348,7 +349,7 @@ TEST_F(ScanUtilsTest, CanSpecifyScanPlansForSchedScanRequest) {
scan_utils_.StartScheduledScan(
kFakeInterfaceIndex,
interval_setting,
- kFake2gRssiThreshold, kFake5gRssiThreshold,
+ kFake2gRssiThreshold, kFake5gRssiThreshold, kFake6gRssiThreshold,
req_flags, {}, {}, {}, &errno_ignored);
}
@@ -370,7 +371,7 @@ TEST_F(ScanUtilsTest, CanSpecifySingleIntervalForSchedScanRequest) {
scan_utils_.StartScheduledScan(
kFakeInterfaceIndex,
interval_setting,
- kFake2gRssiThreshold, kFake5gRssiThreshold,
+ kFake2gRssiThreshold, kFake5gRssiThreshold, kFake6gRssiThreshold,
req_flags, {}, {}, {}, &errno_ignored);
}
diff --git a/tests/scanner_unittest.cpp b/tests/scanner_unittest.cpp
index 4d2ebdf..990dcb2 100644
--- a/tests/scanner_unittest.cpp
+++ b/tests/scanner_unittest.cpp
@@ -19,7 +19,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <wifi_system_test/mock_interface_tool.h>
-#include "android/net/wifi/IWifiScannerImpl.h"
+#include "android/net/wifi/nl80211/IWifiScannerImpl.h"
#include "wificond/scanning/scanner_impl.h"
#include "wificond/tests/mock_client_interface_impl.h"
#include "wificond/tests/mock_netlink_manager.h"
@@ -27,12 +27,12 @@
#include "wificond/tests/mock_scan_utils.h"
using ::android::binder::Status;
-using ::android::net::wifi::IWifiScannerImpl;
+using ::android::net::wifi::nl80211::IWifiScannerImpl;
+using ::android::net::wifi::nl80211::SingleScanSettings;
+using ::android::net::wifi::nl80211::PnoNetwork;
+using ::android::net::wifi::nl80211::PnoSettings;
+using ::android::net::wifi::nl80211::NativeScanResult;
using ::android::wifi_system::MockInterfaceTool;
-using ::com::android::server::wifi::wificond::SingleScanSettings;
-using ::com::android::server::wifi::wificond::PnoNetwork;
-using ::com::android::server::wifi::wificond::PnoSettings;
-using ::com::android::server::wifi::wificond::NativeScanResult;
using ::testing::Eq;
using ::testing::Invoke;
using ::testing::NiceMock;
@@ -75,6 +75,7 @@ bool CaptureSchedScanIntervalSetting(
const SchedScanIntervalSetting& interval_setting,
int32_t /* rssi_threshold_2g */,
int32_t /* rssi_threshold_5g */,
+ int32_t /* rssi_threshold_6g */,
const SchedScanReqFlags& /* req_flags */,
const std::vector<std::vector<uint8_t>>& /* scan_ssids */,
const std::vector<std::vector<uint8_t>>& /* match_ssids */,
@@ -90,6 +91,7 @@ bool CaptureSchedScanReqFlags(
const SchedScanIntervalSetting& /* interval_setting */,
int32_t /* rssi_threshold_2g */,
int32_t /* rssi_threshold_5g */,
+ int32_t /* rssi_threshold_6g */,
const SchedScanReqFlags& req_flags,
const std::vector<std::vector<uint8_t>>& /* scan_ssids */,
const std::vector<std::vector<uint8_t>>& /* match_ssids */,
@@ -231,7 +233,7 @@ TEST_F(ScannerTest, TestSingleScanFailure) {
EXPECT_FALSE(success);
}
-TEST_F(ScannerTest, TestProcessAbortsOnScanReturningNoDeviceError) {
+TEST_F(ScannerTest, TestProcessAbortsOnScanReturningNoDeviceErrorSeveralTimes) {
scanner_impl_.reset(new ScannerImpl(kFakeInterfaceIndex,
scan_capabilities_, wiphy_features_,
&client_interface_impl_,
@@ -243,8 +245,14 @@ TEST_F(ScannerTest, TestProcessAbortsOnScanReturningNoDeviceError) {
ReturnErrorCodeForScanRequest, ENODEV,
_1, _2, _3, _4, _5, _6)));
- bool success_ignored;
- EXPECT_DEATH(scanner_impl_->scan(SingleScanSettings(), &success_ignored),
+ bool single_scan_failure;
+ EXPECT_TRUE(scanner_impl_->scan(SingleScanSettings(), &single_scan_failure).isOk());
+ EXPECT_FALSE(single_scan_failure);
+ EXPECT_TRUE(scanner_impl_->scan(SingleScanSettings(), &single_scan_failure).isOk());
+ EXPECT_FALSE(single_scan_failure);
+ EXPECT_TRUE(scanner_impl_->scan(SingleScanSettings(), &single_scan_failure).isOk());
+ EXPECT_FALSE(single_scan_failure);
+ EXPECT_DEATH(scanner_impl_->scan(SingleScanSettings(), &single_scan_failure),
"Driver is in a bad state*");
}
@@ -290,7 +298,7 @@ TEST_F(ScannerTest, TestStartPnoScanViaNetlink) {
&scan_utils_);
EXPECT_CALL(
scan_utils_,
- StartScheduledScan(_, _, _, _, _, _, _, _, _)).
+ StartScheduledScan(_, _, _, _, _, _, _, _, _, _)).
WillOnce(Return(true));
EXPECT_TRUE(scanner_impl.startPnoScan(PnoSettings(), &success).isOk());
EXPECT_TRUE(success);
@@ -305,10 +313,10 @@ TEST_F(ScannerTest, TestStartPnoScanViaNetlinkWithLowPowerScanWiphySupport) {
SchedScanReqFlags req_flags = {};
EXPECT_CALL(
scan_utils_,
- StartScheduledScan(_, _, _, _, _, _, _, _, _)).
+ StartScheduledScan(_, _, _, _, _, _, _, _, _, _)).
WillOnce(Invoke(bind(
CaptureSchedScanReqFlags,
- _1, _2, _3, _4, _5, _6, _7, _8, _9, &req_flags)));
+ _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, &req_flags)));
EXPECT_TRUE(scanner_impl.startPnoScan(PnoSettings(), &success).isOk());
EXPECT_TRUE(success);
EXPECT_TRUE(req_flags.request_low_power);
@@ -348,10 +356,10 @@ TEST_F(ScannerTest, TestGenerateScanPlansIfDeviceSupports) {
SchedScanIntervalSetting interval_setting;
EXPECT_CALL(
scan_utils_,
- StartScheduledScan(_, _, _, _, _, _, _, _, _)).
+ StartScheduledScan(_, _, _, _, _, _, _, _, _, _)).
WillOnce(Invoke(bind(
CaptureSchedScanIntervalSetting,
- _1, _2, _3, _4, _5, _6, _7, _8, _9, &interval_setting)));
+ _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, &interval_setting)));
bool success_ignored = 0;
EXPECT_TRUE(scanner.startPnoScan(pno_settings, &success_ignored).isOk());
@@ -381,10 +389,11 @@ TEST_F(ScannerTest, TestGenerateSingleIntervalIfDeviceDoesNotSupportScanPlan) {
SchedScanIntervalSetting interval_setting;
EXPECT_CALL(
scan_utils_,
- StartScheduledScan(_, _, _, _, _, _, _, _, _)).
+ StartScheduledScan(_, _, _, _, _, _, _, _, _, _)).
WillOnce(Invoke(bind(
CaptureSchedScanIntervalSetting,
- _1, _2, _3, _4, _5, _6, _7, _8, _9, &interval_setting)));
+ _1, _2, _3, _4, _5, _6, _7, _8, _9, _10,
+ &interval_setting)));
bool success_ignored = 0;
EXPECT_TRUE(scanner.startPnoScan(pno_settings, &success_ignored).isOk());
@@ -430,7 +439,7 @@ TEST_F(ScannerTest, TestStartPnoScanWithNonEmptyFrequencyList) {
expected_freqs.push_back(2412);
EXPECT_CALL(
scan_utils_,
- StartScheduledScan(_, _, _, _, _, _, _, Eq(expected_freqs), _)).
+ StartScheduledScan(_, _, _, _, _, _, _, _, Eq(expected_freqs), _)).
WillOnce(Return(true));
EXPECT_TRUE(scanner_impl.startPnoScan(pno_settings, &success).isOk());
EXPECT_TRUE(success);
@@ -469,7 +478,7 @@ TEST_F(ScannerTest, TestStartPnoScanWithFrequencyListNoDuplicates) {
expected_freqs.push_back(2462);
EXPECT_CALL(
scan_utils_,
- StartScheduledScan(_, _, _, _, _, _, _, Eq(expected_freqs), _)).
+ StartScheduledScan(_, _, _, _, _, _, _, _, Eq(expected_freqs), _)).
WillOnce(Return(true));
EXPECT_TRUE(scanner_impl.startPnoScan(pno_settings, &success).isOk());
EXPECT_TRUE(success);
@@ -505,7 +514,7 @@ TEST_F(ScannerTest, TestStartPnoScanWithFrequencyListFallbackMechanism) {
vector<uint32_t> expected_frequencies(default_frequencies.begin(), default_frequencies.end());
EXPECT_CALL(
scan_utils_,
- StartScheduledScan(_, _, _, _, _, _, _, Eq(expected_frequencies), _)).
+ StartScheduledScan(_, _, _, _, _, _, _, _, Eq(expected_frequencies), _)).
WillOnce(Return(true));
EXPECT_TRUE(scanner_impl.startPnoScan(pno_settings, &success).isOk());
EXPECT_TRUE(success);
@@ -535,7 +544,7 @@ TEST_F(ScannerTest, TestStartPnoScanEmptyList) {
pno_settings.pno_networks_.push_back(network2);
EXPECT_CALL(
scan_utils_,
- StartScheduledScan(_, _, _, _, _, _, _, Eq(vector<uint32_t>{}), _)).
+ StartScheduledScan(_, _, _, _, _, _, _, _, Eq(vector<uint32_t>{}), _)).
WillOnce(Return(true));
EXPECT_TRUE(scanner_impl.startPnoScan(pno_settings, &success).isOk());
EXPECT_TRUE(success);
diff --git a/tests/server_unittest.cpp b/tests/server_unittest.cpp
index 2175cf9..68f1429 100644
--- a/tests/server_unittest.cpp
+++ b/tests/server_unittest.cpp
@@ -21,14 +21,14 @@
#include <gtest/gtest.h>
#include <wifi_system_test/mock_interface_tool.h>
-#include "android/net/wifi/IApInterface.h"
+#include "android/net/wifi/nl80211/IApInterface.h"
#include "wificond/tests/mock_netlink_manager.h"
#include "wificond/tests/mock_netlink_utils.h"
#include "wificond/tests/mock_scan_utils.h"
#include "wificond/server.h"
-using android::net::wifi::IApInterface;
-using android::net::wifi::IClientInterface;
+using android::net::wifi::nl80211::IApInterface;
+using android::net::wifi::nl80211::IClientInterface;
using android::wifi_system::InterfaceTool;
using android::wifi_system::MockInterfaceTool;
using std::unique_ptr;