Merge "Wifi-hostapd: Add 6GHz impacts to softAP"
This commit is contained in:
commit
b039035685
3 changed files with 281 additions and 11 deletions
|
@ -651,7 +651,7 @@ a3eddd9bbdc87e8c22764070037dd1154f1cf006e6fba93364c4f85d4c134a19 android.hardwar
|
|||
94e803236398bed1febb11cc21051bc42ec003700139b099d6c479e02a7ca3c3 android.hardware.neuralnetworks@1.3::IPreparedModelCallback
|
||||
cf1d55e8c68300090747ab90b94c22e4c859b29c84ced68a317c595bb115eab2 android.hardware.neuralnetworks@1.3::types
|
||||
3e01d4446cd69fd1c48f8572efd97487bc179564b32bd795800b97bbe10be37b android.hardware.wifi@1.4::IWifi
|
||||
03d37dfebbc27b13adce1ed6389ac483bf7cf32488ca14037c5569bc3e903e4f android.hardware.wifi.hostapd@1.2::IHostapd
|
||||
36b3acf78ac4ecf8156be8741c1d8332cdce7a1ebf4dfa1562952f14a94e6c87 android.hardware.wifi.hostapd@1.2::IHostapd
|
||||
2defa258951e25a132aaeb36e3febe6f41bf9c6dbb1b1ebdf0b41708ab4e107e android.hardware.wifi.hostapd@1.2::types
|
||||
a64467bae843569f0d465c5be7f0c7a5b987985b55a3ef4794dd5afc68538650 android.hardware.wifi.supplicant@1.3::ISupplicant
|
||||
44445b8a03d7b9e68b2fbd954672c18a8fce9e32851b0692f4f4ab3407f86ecb android.hardware.wifi.supplicant@1.3::ISupplicantStaIface
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package android.hardware.wifi.hostapd@1.2;
|
||||
|
||||
import @1.0::IHostapd.NetworkParams;
|
||||
import @1.1::IHostapd;
|
||||
import HostapdStatus;
|
||||
import MacAddress;
|
||||
|
@ -25,6 +26,86 @@ import Ieee80211ReasonCode;
|
|||
* Top-level object for managing SoftAPs.
|
||||
*/
|
||||
interface IHostapd extends @1.1::IHostapd {
|
||||
/**
|
||||
* Band bitmMask to use for the SoftAp operations.
|
||||
* A combinatoin of these bits are used to identify the allowed bands
|
||||
* to start the softAp
|
||||
*/
|
||||
enum BandMask : uint32_t {
|
||||
/**
|
||||
* 2.4 GHz band.
|
||||
*/
|
||||
BAND_2_GHZ = 1 << 0,
|
||||
/**
|
||||
* 5 GHz band.
|
||||
*/
|
||||
BAND_5_GHZ = 1 << 1,
|
||||
/**
|
||||
* 6 GHz band.
|
||||
*/
|
||||
BAND_6_GHZ = 1 << 2,
|
||||
};
|
||||
|
||||
/**
|
||||
* Parameters to control the HW mode for the interface.
|
||||
*/
|
||||
struct HwModeParams {
|
||||
/**
|
||||
* Whether IEEE 802.11ax (HE) is enabled or not.
|
||||
* Note: hw_mode=a is used to specify that 5 GHz band or 6 GHz band is
|
||||
* used with HE.
|
||||
*/
|
||||
bool enable80211AX;
|
||||
/**
|
||||
* Whether 6GHz band enabled or not on softAp.
|
||||
* Note: hw_mode=a is used to specify that 5 GHz band or 6 GHz band is
|
||||
* used.
|
||||
*/
|
||||
bool enable6GhzBand;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parameters to control the channel selection for the interface.
|
||||
*/
|
||||
struct ChannelParams {
|
||||
/**
|
||||
* Band to use for the SoftAp operations.
|
||||
*/
|
||||
bitfield<BandMask> bandMask;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parameters to use for setting up the access point interface.
|
||||
*/
|
||||
struct IfaceParams {
|
||||
/**
|
||||
* Baseline information as defined in HAL 1.1.
|
||||
*/
|
||||
@1.1::IHostapd.IfaceParams V1_1;
|
||||
/** Additional Hw mode params for the interface */
|
||||
HwModeParams hwModeParams;
|
||||
/** Additional Channel params for the interface */
|
||||
ChannelParams channelParams;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a new access point for hostapd to control.
|
||||
*
|
||||
* This should trigger the setup of an access point with the specified
|
||||
* interface and network params.
|
||||
*
|
||||
* @param ifaceParams AccessPoint Params for the access point.
|
||||
* @param nwParams Network Params for the access point.
|
||||
* @return status Status of the operation.
|
||||
* Possible status codes:
|
||||
* |HostapdStatusCode.SUCCESS|,
|
||||
* |HostapdStatusCode.FAILURE_ARGS_INVALID|,
|
||||
* |HostapdStatusCode.FAILURE_UNKNOWN|,
|
||||
* |HostapdStatusCode.FAILURE_IFACE_EXISTS|
|
||||
*/
|
||||
addAccessPoint_1_2(IfaceParams ifaceParams, NetworkParams nwParams)
|
||||
generates(HostapdStatus status);
|
||||
|
||||
/**
|
||||
* force one of the hotspot clients disconnect..
|
||||
*
|
||||
|
|
|
@ -39,7 +39,9 @@ using ::android::hardware::wifi::V1_0::IWifi;
|
|||
namespace {
|
||||
constexpr unsigned char kNwSsid[] = {'t', 'e', 's', 't', '1',
|
||||
'2', '3', '4', '5'};
|
||||
constexpr char kNwPassphrase[] = "test12345";
|
||||
constexpr int kIfaceChannel = 6;
|
||||
constexpr int kIfaceInvalidChannel = 567;
|
||||
constexpr uint8_t kTestZeroMacAddr[] = {[0 ... 5] = 0x0};
|
||||
constexpr Ieee80211ReasonCode kTestDisconnectReasonCode =
|
||||
Ieee80211ReasonCode::WLAN_REASON_UNSPECIFIED;
|
||||
|
@ -73,7 +75,9 @@ class HostapdHidlTest
|
|||
IHostapd::IfaceParams getIfaceParamsWithoutAcs() {
|
||||
::android::hardware::wifi::hostapd::V1_0::IHostapd::IfaceParams
|
||||
iface_params;
|
||||
IHostapd::IfaceParams iface_params_1_1;
|
||||
::android::hardware::wifi::hostapd::V1_1::IHostapd::IfaceParams
|
||||
iface_params_1_1;
|
||||
IHostapd::IfaceParams iface_params_1_2;
|
||||
|
||||
iface_params.ifaceName = getPrimaryWlanIfaceName();
|
||||
iface_params.hwModeParams.enable80211N = true;
|
||||
|
@ -81,9 +85,52 @@ class HostapdHidlTest
|
|||
iface_params.channelParams.enableAcs = false;
|
||||
iface_params.channelParams.acsShouldExcludeDfs = false;
|
||||
iface_params.channelParams.channel = kIfaceChannel;
|
||||
iface_params.channelParams.band = IHostapd::Band::BAND_2_4_GHZ;
|
||||
iface_params_1_1.V1_0 = iface_params;
|
||||
return iface_params_1_1;
|
||||
iface_params_1_2.V1_1 = iface_params_1_1;
|
||||
// Newly added attributes in V1_2
|
||||
iface_params_1_2.hwModeParams.enable80211AX = false;
|
||||
iface_params_1_2.hwModeParams.enable6GhzBand = false;
|
||||
iface_params_1_2.channelParams.bandMask = 0;
|
||||
iface_params_1_2.channelParams.bandMask |=
|
||||
IHostapd::BandMask::BAND_2_GHZ;
|
||||
return iface_params_1_2;
|
||||
}
|
||||
|
||||
IHostapd::IfaceParams getIfaceParamsWithAcs() {
|
||||
// First get the settings for WithoutAcs and then make changes
|
||||
IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithoutAcs();
|
||||
iface_params_1_2.V1_1.V1_0.channelParams.enableAcs = true;
|
||||
iface_params_1_2.V1_1.V1_0.channelParams.acsShouldExcludeDfs = true;
|
||||
iface_params_1_2.V1_1.V1_0.channelParams.channel = 0;
|
||||
iface_params_1_2.channelParams.bandMask |=
|
||||
IHostapd::BandMask::BAND_5_GHZ;
|
||||
|
||||
return iface_params_1_2;
|
||||
}
|
||||
|
||||
IHostapd::IfaceParams getIfaceParamsWithAcsAndChannelRange() {
|
||||
IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithAcs();
|
||||
::android::hardware::wifi::hostapd::V1_1::IHostapd::ChannelParams
|
||||
channelParams;
|
||||
::android::hardware::wifi::hostapd::V1_1::IHostapd::AcsChannelRange
|
||||
acsChannelRange;
|
||||
acsChannelRange.start = 1;
|
||||
acsChannelRange.end = 11;
|
||||
std::vector<
|
||||
::android::hardware::wifi::hostapd::V1_1::IHostapd::AcsChannelRange>
|
||||
vec_acsChannelRange;
|
||||
vec_acsChannelRange.push_back(acsChannelRange);
|
||||
channelParams.acsChannelRanges = vec_acsChannelRange;
|
||||
iface_params_1_2.V1_1.channelParams = channelParams;
|
||||
return iface_params_1_2;
|
||||
}
|
||||
|
||||
IHostapd::IfaceParams getIfaceParamsWithAcsAndInvalidChannelRange() {
|
||||
IHostapd::IfaceParams iface_params_1_2 =
|
||||
getIfaceParamsWithAcsAndChannelRange();
|
||||
iface_params_1_2.V1_1.channelParams.acsChannelRanges[0].start = 222;
|
||||
iface_params_1_2.V1_1.channelParams.acsChannelRanges[0].end = 999;
|
||||
return iface_params_1_2;
|
||||
}
|
||||
|
||||
IHostapd::NetworkParams getOpenNwParams() {
|
||||
|
@ -95,12 +142,156 @@ class HostapdHidlTest
|
|||
return nw_params;
|
||||
}
|
||||
|
||||
IHostapd::NetworkParams getPskNwParams() {
|
||||
IHostapd::NetworkParams nw_params;
|
||||
nw_params.ssid =
|
||||
std::vector<uint8_t>(kNwSsid, kNwSsid + sizeof(kNwSsid));
|
||||
nw_params.isHidden = false;
|
||||
nw_params.encryptionType = IHostapd::EncryptionType::WPA2;
|
||||
nw_params.pskPassphrase = kNwPassphrase;
|
||||
return nw_params;
|
||||
}
|
||||
|
||||
IHostapd::NetworkParams getInvalidPskNwParams() {
|
||||
IHostapd::NetworkParams nw_params;
|
||||
nw_params.ssid =
|
||||
std::vector<uint8_t>(kNwSsid, kNwSsid + sizeof(kNwSsid));
|
||||
nw_params.isHidden = false;
|
||||
nw_params.encryptionType = IHostapd::EncryptionType::WPA2;
|
||||
return nw_params;
|
||||
}
|
||||
|
||||
IHostapd::IfaceParams getIfaceParamsWithInvalidChannel() {
|
||||
IHostapd::IfaceParams iface_params_1_2 = getIfaceParamsWithoutAcs();
|
||||
iface_params_1_2.V1_1.V1_0.channelParams.channel = kIfaceInvalidChannel;
|
||||
return iface_params_1_2;
|
||||
}
|
||||
|
||||
// IHostapd object used for all tests in this fixture.
|
||||
sp<IHostapd> hostapd_;
|
||||
std::string wifi_instance_name_;
|
||||
std::string hostapd_instance_name_;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds an access point with PSK network config & ACS enabled.
|
||||
* Access point creation should pass.
|
||||
*/
|
||||
TEST_P(HostapdHidlTest, AddPskAccessPointWithAcs) {
|
||||
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
|
||||
getIfaceParamsWithAcs(), getPskNwParams());
|
||||
// TODO: b/140172237, fix this in R.
|
||||
// EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an access point with PSK network config, ACS enabled & channel Range.
|
||||
* Access point creation should pass.
|
||||
*/
|
||||
TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndChannelRange) {
|
||||
auto status =
|
||||
HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
|
||||
getIfaceParamsWithAcsAndChannelRange(), getPskNwParams());
|
||||
// TODO: b/140172237, fix this in R
|
||||
// EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an access point with invalid channel range.
|
||||
* Access point creation should fail.
|
||||
*/
|
||||
TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidChannelRange) {
|
||||
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
|
||||
getIfaceParamsWithAcsAndInvalidChannelRange(),
|
||||
getPskNwParams());
|
||||
// TODO: b/140172237, fix this in R
|
||||
// EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an access point with Open network config & ACS enabled.
|
||||
* Access point creation should pass.
|
||||
*/
|
||||
TEST_P(HostapdHidlTest, AddOpenAccessPointWithAcs) {
|
||||
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
|
||||
getIfaceParamsWithAcs(), getOpenNwParams());
|
||||
// TODO: b/140172237, fix this in R
|
||||
// EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an access point with PSK network config & ACS disabled.
|
||||
* Access point creation should pass.
|
||||
*/
|
||||
TEST_P(HostapdHidlTest, AddPskAccessPointWithoutAcs) {
|
||||
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
|
||||
getIfaceParamsWithoutAcs(), getPskNwParams());
|
||||
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an access point with Open network config & ACS disabled.
|
||||
* Access point creation should pass.
|
||||
*/
|
||||
TEST_P(HostapdHidlTest, AddOpenAccessPointWithoutAcs) {
|
||||
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
|
||||
getIfaceParamsWithoutAcs(), getOpenNwParams());
|
||||
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds & then removes an access point with PSK network config & ACS enabled.
|
||||
* Access point creation & removal should pass.
|
||||
*/
|
||||
TEST_P(HostapdHidlTest, RemoveAccessPointWithAcs) {
|
||||
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
|
||||
getIfaceParamsWithAcs(), getPskNwParams());
|
||||
// TODO: b/140172237, fix this in R
|
||||
/*
|
||||
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
|
||||
status =
|
||||
HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
|
||||
EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code);
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds & then removes an access point with PSK network config & ACS disabled.
|
||||
* Access point creation & removal should pass.
|
||||
*/
|
||||
TEST_P(HostapdHidlTest, RemoveAccessPointWithoutAcs) {
|
||||
auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
|
||||
getIfaceParamsWithoutAcs(), getPskNwParams());
|
||||
EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code);
|
||||
auto status =
|
||||
HIDL_INVOKE(hostapd_, removeAccessPoint, getPrimaryWlanIfaceName());
|
||||
EXPECT_EQ(
|
||||
android::hardware::wifi::hostapd::V1_0::HostapdStatusCode::SUCCESS,
|
||||
status.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an access point with invalid channel.
|
||||
* Access point creation should fail.
|
||||
*/
|
||||
TEST_P(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) {
|
||||
auto status =
|
||||
HIDL_INVOKE(hostapd_, addAccessPoint_1_2,
|
||||
getIfaceParamsWithInvalidChannel(), getPskNwParams());
|
||||
EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an access point with invalid PSK network config.
|
||||
* Access point creation should fail.
|
||||
*/
|
||||
TEST_P(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) {
|
||||
auto status =
|
||||
HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(),
|
||||
getInvalidPskNwParams());
|
||||
EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
|
||||
}
|
||||
|
||||
/**
|
||||
* forceClientDisconnect should return FAILURE_IFACE_UNKNOWN
|
||||
* when hotspot interface doesn't init..
|
||||
|
@ -117,14 +308,12 @@ TEST_P(HostapdHidlTest, DisconnectClientWhenIfaceNotAvailable) {
|
|||
* when hotspot interface available.
|
||||
*/
|
||||
TEST_P(HostapdHidlTest, DisconnectClientWhenIfacAvailable) {
|
||||
auto status_1_0 =
|
||||
HIDL_INVOKE(hostapd_, addAccessPoint_1_1, getIfaceParamsWithoutAcs(),
|
||||
getOpenNwParams());
|
||||
EXPECT_EQ(
|
||||
android::hardware::wifi::hostapd::V1_0::HostapdStatusCode::SUCCESS,
|
||||
status_1_0.code);
|
||||
|
||||
auto status_1_2 =
|
||||
HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(),
|
||||
getOpenNwParams());
|
||||
EXPECT_EQ(HostapdStatusCode::SUCCESS, status_1_2.code);
|
||||
|
||||
status_1_2 =
|
||||
HIDL_INVOKE(hostapd_, forceClientDisconnect, getPrimaryWlanIfaceName(),
|
||||
kTestZeroMacAddr, kTestDisconnectReasonCode);
|
||||
EXPECT_EQ(HostapdStatusCode::FAILURE_CLIENT_UNKNOWN, status_1_2.code);
|
||||
|
|
Loading…
Reference in a new issue