Merge branch 'feature/ble_mesh_console_stack_update_v5.0' into 'release/v5.0'

ble_mesh: stack: Miscellaneous fixes and updates(v5.0)

See merge request espressif/esp-idf!22922
This commit is contained in:
Jiang Jiang Jian 2023-03-28 15:19:22 +08:00
commit c86f48ad80
5 changed files with 39 additions and 1 deletions

View File

@ -1464,6 +1464,9 @@ static void mod_sub_add(struct bt_mesh_model *model,
goto send_status;
}
BT_BQB(BLE_MESH_BQB_TEST_LOG_LEVEL_PRIMARY_ID_NODE | BLE_MESH_BQB_TEST_LOG_LEVEL_SUB_ID_TNPT,
"SubGroupAddr: 0x%x", sub_addr);
for (i = 0; i < ARRAY_SIZE(mod->groups); i++) {
if (mod->groups[i] == BLE_MESH_ADDR_UNASSIGNED) {
mod->groups[i] = sub_addr;
@ -1865,6 +1868,9 @@ static void mod_sub_va_add(struct bt_mesh_model *model,
goto send_status;
}
BT_BQB(BLE_MESH_BQB_TEST_LOG_LEVEL_PRIMARY_ID_NODE | BLE_MESH_BQB_TEST_LOG_LEVEL_SUB_ID_TNPT,
"SubVirtualAddr: 0x%x", sub_addr);
for (i = 0; i < ARRAY_SIZE(mod->groups); i++) {
if (mod->groups[i] == BLE_MESH_ADDR_UNASSIGNED) {
mod->groups[i] = sub_addr;

View File

@ -1387,10 +1387,12 @@ int bt_mesh_net_decode(struct net_buf_simple *data, enum bt_mesh_net_if net_if,
}
/* For case MESH/NODE/RLY/BV-01-C, even the DST is RFU, it needs to be forwarded. */
#if !CONFIG_BLE_MESH_BQB_TEST
if (BLE_MESH_ADDR_IS_RFU(rx->ctx.recv_dst)) {
BT_ERR("Destination address is RFU; dropping packet 0x%02x", rx->ctx.recv_dst);
return -EBADMSG;
}
#endif
if (net_if != BLE_MESH_NET_IF_LOCAL && bt_mesh_elem_find(rx->ctx.addr)) {
BT_DBG("Dropping locally originated packet");
@ -1470,6 +1472,11 @@ void bt_mesh_net_recv(struct net_buf_simple *data, int8_t rssi,
/* Save the state so the buffer can later be relayed */
net_buf_simple_save(&buf, &state);
BT_BQB(BLE_MESH_BQB_TEST_LOG_LEVEL_PRIMARY_ID_NODE | BLE_MESH_BQB_TEST_LOG_LEVEL_SUB_ID_NET,
"\nNetRecv: ctl: %d, src: %d, dst: %d, ttl: %d, data: 0x%s",
CTL(buf.data), SRC(buf.data), DST(buf.data), TTL(buf.data),
bt_hex(buf.data + BLE_MESH_NET_HDR_LEN, buf.len - BLE_MESH_NET_HDR_LEN));
rx.local_match = (bt_mesh_fixed_group_match(rx.ctx.recv_dst) ||
bt_mesh_elem_find(rx.ctx.recv_dst));

View File

@ -2725,7 +2725,8 @@ static void prov_retransmit(struct k_work *work)
#endif
if (k_uptime_get() - link[idx].tx.start > timeout) {
BT_WARN("Provisioner timeout, giving up transaction");
reset_link(idx, CLOSE_REASON_TIMEOUT);
/* Provisioner should send Link Close here */
close_link(idx, CLOSE_REASON_TIMEOUT);
return;
}
@ -2866,6 +2867,12 @@ static void prov_msg_recv(const uint8_t idx)
return;
fail:
/**
* For the case MESH/PVNR/PROV/BV-10-C and MESH/PVNR/PROV/BI-14-C,
* provisioner should send transaction ack before closing the link.
*/
gen_prov_ack_send(idx, link[idx].rx.trans_id);
close_link(idx, CLOSE_REASON_FAILED);
return;
}

View File

@ -22,9 +22,11 @@
#if (CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_SERVER
#if !CONFIG_BLE_MESH_BQB_TEST
/* Not support enabling Proxy Client and Proxy Server simultaneously */
_Static_assert(!(IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) &&IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_CLIENT)),
"Not support Proxy Server and Proxy Client simultaneously");
#endif
#define PDU_TYPE(data) (data[0] & BIT_MASK(6))
#define PDU_SAR(data) (data[0] >> 6)

View File

@ -782,6 +782,11 @@ static int sdu_recv(struct bt_mesh_net_rx *rx, uint32_t seq, uint8_t hdr,
continue;
}
BT_BQB(BLE_MESH_BQB_TEST_LOG_LEVEL_PRIMARY_ID_NODE | BLE_MESH_BQB_TEST_LOG_LEVEL_SUB_ID_TNPT,
"\nTNPTRecv: ctl: 0x%04x, ttl: 0x%04x, src: 0x%04x, dst: 0x%04x, payload: 0x%s",
rx->ctl, rx->ctx.recv_ttl, rx->ctx.addr, rx->ctx.recv_dst,
bt_hex(sdu->data, sdu->len));
rx->ctx.app_idx = BLE_MESH_KEY_DEV;
bt_mesh_model_recv(rx, sdu);
@ -827,6 +832,12 @@ static int sdu_recv(struct bt_mesh_net_rx *rx, uint32_t seq, uint8_t hdr,
sdu, ad, rx->ctx.addr,
rx->ctx.recv_dst, seq,
BLE_MESH_NET_IVI_RX(rx));
BT_BQB(BLE_MESH_BQB_TEST_LOG_LEVEL_PRIMARY_ID_NODE | BLE_MESH_BQB_TEST_LOG_LEVEL_SUB_ID_TNPT,
"\nTNPTRecv: ctl: 0x%04x, ttl: 0x%04x, src: 0x%04x, dst: 0x%04x, payload: 0x%s",
rx->ctl, rx->ctx.recv_ttl, rx->ctx.addr, rx->ctx.recv_dst,
bt_hex(sdu->data, sdu->len));
if (err) {
BT_DBG("Unable to decrypt with AppKey 0x%03x",
key->app_idx);
@ -997,6 +1008,11 @@ static int ctl_recv(struct bt_mesh_net_rx *rx, uint8_t hdr,
BT_DBG("OpCode 0x%02x len %u", ctl_op, buf->len);
BT_BQB(BLE_MESH_BQB_TEST_LOG_LEVEL_PRIMARY_ID_NODE | BLE_MESH_BQB_TEST_LOG_LEVEL_SUB_ID_TNPT,
"\nTNPTRecv: ctl: 0x%04x, ttl: 0x%04x, src: 0x%04x, dst: 0x%04x, payload: 0x%s",
rx->ctl, rx->ctx.recv_ttl, rx->ctx.addr, rx->ctx.recv_dst,
bt_hex(buf->data, buf->len));
switch (ctl_op) {
case TRANS_CTL_OP_ACK:
return trans_ack(rx, hdr, buf, seq_auth);