Skip to content

Commit 85fa56e

Browse files
sjancm-alperen-sener
authored andcommitted
[nrf fromtree] test: bluetooth: tester: Fix GAP/CONN/DCON/BV-05-C test
For GAP/CONN/DCON/BV-05-C PTS expects IUT to fail operation if the peer does not support Central Address Resolution. In Test Set there is ALT to start undirected advertising instead but PTS interpretation is that IUT shall reject directed request regardless and may then later on follow up with underected advertising (which PTS doesn't validate). To keep this simple just reject here. Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl> (cherry picked from commit 2f5145b) Signed-off-by: Alperen Sener <alperen.sener@nordicsemi.no>
1 parent f10ffd7 commit 85fa56e

1 file changed

Lines changed: 31 additions & 17 deletions

File tree

tests/bluetooth/tester/src/btp_gap.c

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -992,8 +992,8 @@ static uint8_t start_advertising(const void *cmd, uint16_t cmd_len,
992992

993993
/**
994994
* Start directed advertising with a peer address with or without RPA.
995-
* If privacy is enabled and the peer does not support Central Address Resolution,
996-
* the advertisement will be started as undirected with RPA.
995+
* If privacy is enabled and the peer does not support Central Address
996+
* Resolution PTS expects IUT request to fail.
997997
*/
998998
static uint8_t start_directed_advertising(const void *cmd, uint16_t cmd_len,
999999
void *rsp, uint16_t *rsp_len)
@@ -1003,36 +1003,50 @@ static uint8_t start_directed_advertising(const void *cmd, uint16_t cmd_len,
10031003
struct bt_le_adv_param adv_param = BT_LE_ADV_PARAM_INIT(
10041004
BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL);
10051005
uint16_t options = sys_le16_to_cpu(cp->options);
1006+
bool peer_car_supported = false;
10061007

10071008
if (bt_addr_le_eq(&cp->address, &bt_addr_le_any)) {
10081009
LOG_ERR("Invalid peer address");
10091010
return BTP_STATUS_FAILED;
10101011
}
10111012

1012-
if (IS_ENABLED(CONFIG_BT_PRIVACY) && (options & BTP_GAP_START_DIRECTED_ADV_PEER_RPA)) {
1013-
/**
1014-
* In accordance with the test spec for test case GAP/CONN/DCON/BV-05-C, if the peer
1015-
* does not support Central Address Resolution, the advertisement will be started
1016-
* as undirected.
1017-
*/
1013+
/*
1014+
* For GAP/CONN/DCON/BV-05-C PTS expects IUT to fail operation
1015+
* if the peer does not support Central Address Resolution.
1016+
*
1017+
* In Test Set there is ALT to start undirected advertising instead
1018+
* but PTS interpretation is that IUT shall reject directed request
1019+
* regardless and may then later on follow up with underected
1020+
* advertising (which PTS doesn't validate). To keep this simple
1021+
* just reject here.
1022+
*/
1023+
if ((options & BTP_GAP_START_DIRECTED_ADV_PEER_RPA) != 0U) {
1024+
if (!IS_ENABLED(CONFIG_BT_PRIVACY)) {
1025+
return BTP_STATUS_FAILED;
1026+
}
1027+
10181028
for (int i = 0; i < CONFIG_BT_MAX_PAIRED; i++) {
10191029
if (bt_addr_le_eq(&cp->address, &peers_with_car[i].addr) &&
10201030
peers_with_car[i].supported) {
1021-
adv_param.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA;
1022-
adv_param.peer = &cp->address;
1023-
if ((options & BTP_GAP_START_DIRECTED_ADV_HD) == 0U) {
1024-
adv_param.options |= BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY;
1025-
}
1031+
peer_car_supported = true;
10261032
break;
10271033
}
10281034
}
1029-
} else {
1030-
adv_param.peer = &cp->address;
1031-
if ((options & BTP_GAP_START_DIRECTED_ADV_HD) == 0U) {
1032-
adv_param.options |= BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY;
1035+
1036+
if (peer_car_supported == false) {
1037+
LOG_WRN("Peer doesn't support CAR");
1038+
return BTP_STATUS_FAILED;
10331039
}
1040+
1041+
adv_param.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA;
10341042
}
10351043

1044+
if ((options & BTP_GAP_START_DIRECTED_ADV_HD) == 0U) {
1045+
adv_param.options |= BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY;
1046+
}
1047+
1048+
adv_param.peer = &cp->address;
1049+
10361050
if (bt_le_adv_start(&adv_param, NULL, 0, NULL, 0) < 0) {
10371051
LOG_ERR("Failed to start advertising");
10381052
return BTP_STATUS_FAILED;

0 commit comments

Comments
 (0)