Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions subsys/bluetooth/host/Kconfig.l2cap
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,9 @@ config BT_L2CAP_RECONFIGURE_EXPLICIT
Enable API for explicit reconfiguration of an L2CAP channel's MTU and
MPS.

config BT_L2CAP_CONN_RTX_TIMEOUT
int
prompt "L2CAP RTX timer for conn requests (seconds)" if BT_TESTING
default 40
range 1 60
endmenu
2 changes: 1 addition & 1 deletion subsys/bluetooth/host/l2cap.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
#define L2CAP_LE_PSM_IS_DYN(_psm) \
(_psm >= L2CAP_LE_PSM_DYN_START && _psm <= L2CAP_LE_PSM_DYN_END)

#define L2CAP_CONN_TIMEOUT K_SECONDS(40)
#define L2CAP_CONN_TIMEOUT K_SECONDS(CONFIG_BT_L2CAP_CONN_RTX_TIMEOUT)
#define L2CAP_DISC_TIMEOUT K_SECONDS(2)

Check notice on line 72 in subsys/bluetooth/host/l2cap.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/bluetooth/host/l2cap.c:72 -#define L2CAP_CONN_TIMEOUT K_SECONDS(CONFIG_BT_L2CAP_CONN_RTX_TIMEOUT) +#define L2CAP_CONN_TIMEOUT K_SECONDS(CONFIG_BT_L2CAP_CONN_RTX_TIMEOUT)

Check notice on line 72 in subsys/bluetooth/host/l2cap.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/bluetooth/host/l2cap.c:72 -#define L2CAP_CONN_TIMEOUT K_SECONDS(CONFIG_BT_L2CAP_CONN_RTX_TIMEOUT) +#define L2CAP_CONN_TIMEOUT K_SECONDS(CONFIG_BT_L2CAP_CONN_RTX_TIMEOUT)
/** @brief Local L2CAP RTX (Response Timeout eXpired)
*
* Specification-allowed range for the value of RTX is 1 to 60 seconds.
Expand Down
48 changes: 31 additions & 17 deletions tests/bluetooth/tester/src/btp_gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -992,8 +992,8 @@ static uint8_t start_advertising(const void *cmd, uint16_t cmd_len,

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

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

if (IS_ENABLED(CONFIG_BT_PRIVACY) && (options & BTP_GAP_START_DIRECTED_ADV_PEER_RPA)) {
/**
* In accordance with the test spec for test case GAP/CONN/DCON/BV-05-C, if the peer
* does not support Central Address Resolution, the advertisement will be started
* as undirected.
*/
/*
* 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.
*/
if ((options & BTP_GAP_START_DIRECTED_ADV_PEER_RPA) != 0U) {
if (!IS_ENABLED(CONFIG_BT_PRIVACY)) {
return BTP_STATUS_FAILED;
}

for (int i = 0; i < CONFIG_BT_MAX_PAIRED; i++) {
if (bt_addr_le_eq(&cp->address, &peers_with_car[i].addr) &&
peers_with_car[i].supported) {
adv_param.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA;
adv_param.peer = &cp->address;
if ((options & BTP_GAP_START_DIRECTED_ADV_HD) == 0U) {
adv_param.options |= BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY;
}
peer_car_supported = true;
break;
}
}
} else {
adv_param.peer = &cp->address;
if ((options & BTP_GAP_START_DIRECTED_ADV_HD) == 0U) {
adv_param.options |= BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY;

if (peer_car_supported == false) {
LOG_WRN("Peer doesn't support CAR");
return BTP_STATUS_FAILED;
}

adv_param.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA;
}

if ((options & BTP_GAP_START_DIRECTED_ADV_HD) == 0U) {
adv_param.options |= BT_LE_ADV_OPT_DIR_MODE_LOW_DUTY;
}

adv_param.peer = &cp->address;

if (bt_le_adv_start(&adv_param, NULL, 0, NULL, 0) < 0) {
LOG_ERR("Failed to start advertising");
return BTP_STATUS_FAILED;
Expand Down
Loading