Android upstream - Gerrit - wpa_supplicant hostapd - acs
收錄在 Ameba 的一百篇
--
參考: Android 提交補丁
繼年初在 Android AOSP 上了一個 patch 後,
https://android-review.googlesource.com/c/platform/system/connectivity/wificond/+/874555
有段時間有些忘記該如何 upstream
剛好趁 Android 10 出來, 今天又提交了一個 patch, 複習一下
之前在 hostapd 社群上了一個 patch
ACS: Stop before scan if no channels in chanlist are available
其實這是為了 Android vts 有一項測試:
VtsHalWifiHostapdV1_1Target# AddPskAccessPointWithAcsAndInvalidChannelRange
程式在 hardware/interfaces/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp
/**
* Adds an access point with invalid channel range.
* Access point creation should fail.
*/
TEST_F(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidChannelRange) {
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_1,
getIfaceParamsWithAcsAndInvalidChannelRange(),
getPskNwParams());
EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
}
而用 EXPECT_NE 期望他會回一個錯誤值
但如 hostapd 這 patch 描述的, 之前的 code 在 acs_init() 時還不會知道這個 channel 是非法的,
所以並不會失敗, 一直要等到 init 結束, ACS 做 scan 計算後,
ACS: Failed to compute ideal channel
才知道失敗.
所以我們在 wpa_supplicant_8 的 hostapd 也加上這段 patch 看看:
1. 修改後先 build 看看是否能 compile
. build/envsetup.sh
lunch aosp_arm-eng
m
2. git
cd external/wpa_supplicant_8
git add -A
git commit -s
3. repo upload
又遇到 no branch ready for upload, 因為前面一開始忘了針對這 project
做 repo sync 和 repo start, 所以我們
repo sync platform/external/wpa_supplicant_8
repo start up_hostapd platform/external/wpa_supplicant_8
4. 3. 做完後, 原本 git 不見了, 先找回來
git reflog 看是哪個 commit
git reset --hard 5657bef
git log
5. repo upload
發現 前面 git commit 忘了寫 Test:
看了一下 gerrit , 發現有人是寫 Test: Local
用 git commit --amend 修改一下
6. 這次 ok 了, 到 Gerrit 看看,
https://android-review.googlesource.com/c/platform/external/wpa_supplicant_8/+/1145230
7. find owner
可以點選 FIND OWNER 看誰是這個項目的負責人
可以打勾選 reviewer 直接設定. Assignee 可以不用設定
按左邊 Add Reviewer, 寫封信, 並自己先勾選一下 code review / verifed
Android AOSP 的確把 Gerrit 發揮淋漓盡致, 值得學習.
繼續觀察後續發展.
--
後記: Gerrit 上了
--
參考: Android 提交補丁
繼年初在 Android AOSP 上了一個 patch 後,
https://android-review.googlesource.com/c/platform/system/connectivity/wificond/+/874555
有段時間有些忘記該如何 upstream
剛好趁 Android 10 出來, 今天又提交了一個 patch, 複習一下
之前在 hostapd 社群上了一個 patch
ACS: Stop before scan if no channels in chanlist are available
其實這是為了 Android vts 有一項測試:
VtsHalWifiHostapdV1_1Target# AddPskAccessPointWithAcsAndInvalidChannelRange
程式在 hardware/interfaces/wifi/hostapd/1.1/vts/functional/hostapd_hidl_test.cpp
/**
* Adds an access point with invalid channel range.
* Access point creation should fail.
*/
TEST_F(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidChannelRange) {
auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_1,
getIfaceParamsWithAcsAndInvalidChannelRange(),
getPskNwParams());
EXPECT_NE(HostapdStatusCode::SUCCESS, status.code);
}
ACS 指的是 automatic channel selection 功能, 也就是 wifi 當 AP熱點 時,
會自動找尋一個比較沒有干擾的信道, 做為 AP 的信道.
而這項測試會故意把選擇的 channel, 設在 222-999 間的錯誤 channel.
IHostapd::IfaceParams getIfaceParamsWithAcsAndInvalidChannelRange() {
IHostapd::IfaceParams iface_params_1_1 =
getIfaceParamsWithAcsAndChannelRange();
iface_params_1_1.channelParams.acsChannelRanges[0].start = 222;
iface_params_1_1.channelParams.acsChannelRanges[0].end = 999;
return iface_params_1_1;
}但如 hostapd 這 patch 描述的, 之前的 code 在 acs_init() 時還不會知道這個 channel 是非法的,
所以並不會失敗, 一直要等到 init 結束, ACS 做 scan 計算後,
ACS: Failed to compute ideal channel
才知道失敗.
所以我們在 wpa_supplicant_8 的 hostapd 也加上這段 patch 看看:
diff --git a/src/ap/acs.c b/src/ap/acs.c
index 11178a1..f12539f 100644
--- a/src/ap/acs.c
+++ b/src/ap/acs.c
index 11178a1..f12539f 100644
--- a/src/ap/acs.c
+++ b/src/ap/acs.c
@@ -942,6 +942,12 @@ static int acs_request_scan(struct hostapd_iface *iface)
}
*freq = 0;
+ if (params.freqs == freq) {
+ wpa_printf(MSG_ERROR, "ACS: No available channels found");
+ os_free(params.freqs);
+ return -1;
+ }
+
iface->scan_cb = acs_scan_complete;
wpa_printf(MSG_DEBUG, "ACS: Scanning %d / %d",
1. 修改後先 build 看看是否能 compile
. build/envsetup.sh
lunch aosp_arm-eng
m
2. git
cd external/wpa_supplicant_8
git add -A
git commit -s
3. repo upload
又遇到 no branch ready for upload, 因為前面一開始忘了針對這 project
做 repo sync 和 repo start, 所以我們
repo sync platform/external/wpa_supplicant_8
repo start up_hostapd platform/external/wpa_supplicant_8
4. 3. 做完後, 原本 git 不見了, 先找回來
git reflog 看是哪個 commit
git reset --hard 5657bef
git log
5. repo upload
發現 前面 git commit 忘了寫 Test:
看了一下 gerrit , 發現有人是寫 Test: Local
用 git commit --amend 修改一下
6. 這次 ok 了, 到 Gerrit 看看,
https://android-review.googlesource.com/c/platform/external/wpa_supplicant_8/+/1145230
7. find owner
可以點選 FIND OWNER 看誰是這個項目的負責人
可以打勾選 reviewer 直接設定. Assignee 可以不用設定
按左邊 Add Reviewer, 寫封信, 並自己先勾選一下 code review / verifed
Android AOSP 的確把 Gerrit 發揮淋漓盡致, 值得學習.
繼續觀察後續發展.
--
後記: Gerrit 上了
commit | e288170431fac9a41db09b8afa85b2915fd812f5 | [log] [tgz] |
---|---|---|
author | Neo Jou <neojou@gmail.com> | Thu Oct 17 11:32:28 2019 +0800 |
committer | Neo Jou <neojou@gmail.com> | Thu Oct 17 12:26:09 2019 +0800 |
tree | a4917acd95426958b447473cabe6e9c5283643ea | |
parent | b756d2873566bb6dbd11715c6f2352ef1f1046c7 [diff] |
hostapd: make acs_init() fail when with invalid channels for VTS At VTS test : VtsHalWifiHostapdV1_1Target, there is a sub-item: AddPskAccessPointWithAcsAndInvalidChannelRage which sets invalid channel list, 222-999, and the test expects it returns not success. Before patch, hostapd didn't check if the channel is valid or not in the interface initialization, until ACS scans and computes, then show ACS: Failed to compute ideal channel It makes the initiailzation still success, not as the VTS expected. Thus, check if there are any available channels in acs_request_scan(), and return -1 if no available channel, then it will fail at acs_init() when in interface initialization, before doing ACS computation. It shows Could not select hw_mode and channel. (-3) wlan0: interface state UNINITIALIZED->DISABLED Then this VTS test can get the result, not success, as expected. This patch has been commited to the Linux Hostapd stream https://w1.fi/cgit/hostapd/commit/?id=d9286d099797186eb30870323da529c0284197bd Test: Local Change-Id: I03b210f1c12a2fe6291115c11e9241b23d47e93c Signed-off-by: Neo Jou <neojou@gmail.com>
留言
張貼留言