mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ble_mesh: stack: Fix friend relay lpn message when relay disable.
This commit is contained in:
parent
140b7d792b
commit
0dde7cf3f0
@ -1188,8 +1188,7 @@ static bool relay_to_adv(enum bt_mesh_net_if net_if)
|
|||||||
case BLE_MESH_NET_IF_LOCAL:
|
case BLE_MESH_NET_IF_LOCAL:
|
||||||
return true;
|
return true;
|
||||||
case BLE_MESH_NET_IF_ADV:
|
case BLE_MESH_NET_IF_ADV:
|
||||||
return ((bt_mesh_relay_get() == BLE_MESH_RELAY_ENABLED) ||
|
return (bt_mesh_relay_get() == BLE_MESH_RELAY_ENABLED);
|
||||||
(bt_mesh_friend_get() == BLE_MESH_FRIEND_ENABLED));
|
|
||||||
case BLE_MESH_NET_IF_PROXY:
|
case BLE_MESH_NET_IF_PROXY:
|
||||||
return (bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED);
|
return (bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED);
|
||||||
default:
|
default:
|
||||||
@ -1221,9 +1220,9 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rx->net_if == BLE_MESH_NET_IF_ADV &&
|
if (rx->net_if == BLE_MESH_NET_IF_ADV &&
|
||||||
|
!rx->friend_cred &&
|
||||||
bt_mesh_relay_get() != BLE_MESH_RELAY_ENABLED &&
|
bt_mesh_relay_get() != BLE_MESH_RELAY_ENABLED &&
|
||||||
bt_mesh_gatt_proxy_get() != BLE_MESH_GATT_PROXY_ENABLED &&
|
bt_mesh_gatt_proxy_get() != BLE_MESH_GATT_PROXY_ENABLED) {
|
||||||
bt_mesh_friend_get() != BLE_MESH_FRIEND_ENABLED) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1234,7 +1233,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
|
|||||||
* Anything else (like GATT to adv, or locally originated packets)
|
* Anything else (like GATT to adv, or locally originated packets)
|
||||||
* use the Network Transmit state.
|
* use the Network Transmit state.
|
||||||
*/
|
*/
|
||||||
if (rx->net_if == BLE_MESH_NET_IF_ADV) {
|
if (rx->net_if == BLE_MESH_NET_IF_ADV && !rx->friend_cred) {
|
||||||
transmit = bt_mesh_relay_retransmit_get();
|
transmit = bt_mesh_relay_retransmit_get();
|
||||||
} else {
|
} else {
|
||||||
transmit = bt_mesh_net_transmit_get();
|
transmit = bt_mesh_net_transmit_get();
|
||||||
@ -1304,6 +1303,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
|
|||||||
*/
|
*/
|
||||||
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) &&
|
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) &&
|
||||||
(bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED ||
|
(bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED ||
|
||||||
|
rx->friend_cred ||
|
||||||
rx->net_if == BLE_MESH_NET_IF_LOCAL)) {
|
rx->net_if == BLE_MESH_NET_IF_LOCAL)) {
|
||||||
if (bt_mesh_proxy_server_relay(&buf->b, rx->ctx.recv_dst) &&
|
if (bt_mesh_proxy_server_relay(&buf->b, rx->ctx.recv_dst) &&
|
||||||
BLE_MESH_ADDR_IS_UNICAST(rx->ctx.recv_dst)) {
|
BLE_MESH_ADDR_IS_UNICAST(rx->ctx.recv_dst)) {
|
||||||
@ -1311,7 +1311,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (relay_to_adv(rx->net_if)) {
|
if (relay_to_adv(rx->net_if) || rx->friend_cred) {
|
||||||
#if !defined(CONFIG_BLE_MESH_RELAY_ADV_BUF)
|
#if !defined(CONFIG_BLE_MESH_RELAY_ADV_BUF)
|
||||||
bt_mesh_adv_send(buf, NULL, NULL);
|
bt_mesh_adv_send(buf, NULL, NULL);
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user