mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 03:07:21 +02:00
ble_mesh: fix resending segments on correct bearer
This commit is contained in:
@ -731,6 +731,7 @@ int bt_mesh_net_resend(struct bt_mesh_subnet *sub, struct net_buf *buf,
|
|||||||
{
|
{
|
||||||
const u8_t *enc, *priv;
|
const u8_t *enc, *priv;
|
||||||
u32_t seq;
|
u32_t seq;
|
||||||
|
u16_t dst;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
BT_DBG("net_idx 0x%04x new_key %u len %u", sub->net_idx, new_key,
|
BT_DBG("net_idx 0x%04x new_key %u len %u", sub->net_idx, new_key,
|
||||||
@ -757,6 +758,9 @@ int bt_mesh_net_resend(struct bt_mesh_subnet *sub, struct net_buf *buf,
|
|||||||
buf->data[3] = seq >> 8;
|
buf->data[3] = seq >> 8;
|
||||||
buf->data[4] = seq;
|
buf->data[4] = seq;
|
||||||
|
|
||||||
|
/* Get destination, in case it's a proxy client */
|
||||||
|
dst = DST(buf->data);
|
||||||
|
|
||||||
err = bt_mesh_net_encrypt(enc, &buf->b, BLE_MESH_NET_IVI_TX, false);
|
err = bt_mesh_net_encrypt(enc, &buf->b, BLE_MESH_NET_IVI_TX, false);
|
||||||
if (err) {
|
if (err) {
|
||||||
BT_ERR("%s, Encrypt failed (err %d)", __func__, err);
|
BT_ERR("%s, Encrypt failed (err %d)", __func__, err);
|
||||||
@ -769,7 +773,12 @@ int bt_mesh_net_resend(struct bt_mesh_subnet *sub, struct net_buf *buf,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY) &&
|
||||||
|
bt_mesh_proxy_relay(&buf->b, dst)) {
|
||||||
|
net_buf_unref(buf);
|
||||||
|
} else {
|
||||||
bt_mesh_adv_send(buf, cb, cb_data);
|
bt_mesh_adv_send(buf, cb, cb_data);
|
||||||
|
}
|
||||||
|
|
||||||
if (!bt_mesh_atomic_test_bit(bt_mesh.flags, BLE_MESH_IVU_IN_PROGRESS) &&
|
if (!bt_mesh_atomic_test_bit(bt_mesh.flags, BLE_MESH_IVU_IN_PROGRESS) &&
|
||||||
bt_mesh.seq > IV_UPDATE_SEQ_LIMIT) {
|
bt_mesh.seq > IV_UPDATE_SEQ_LIMIT) {
|
||||||
|
Reference in New Issue
Block a user