Merge branch 'bugfix/relay_friend_cred_message_v4.4' into 'release/v4.4'

ble_mesh: stack: Fix friend relay lpn message when relay disable(v4.4)

See merge request espressif/esp-idf!20204
This commit is contained in:
Island 2022-09-22 14:17:25 +08:00
commit 3ea96f0e22

View File

@ -1188,8 +1188,7 @@ static bool relay_to_adv(enum bt_mesh_net_if net_if)
case BLE_MESH_NET_IF_LOCAL:
return true;
case BLE_MESH_NET_IF_ADV:
return ((bt_mesh_relay_get() == BLE_MESH_RELAY_ENABLED) ||
(bt_mesh_friend_get() == BLE_MESH_FRIEND_ENABLED));
return (bt_mesh_relay_get() == BLE_MESH_RELAY_ENABLED);
case BLE_MESH_NET_IF_PROXY:
return (bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED);
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 &&
!rx->friend_cred &&
bt_mesh_relay_get() != BLE_MESH_RELAY_ENABLED &&
bt_mesh_gatt_proxy_get() != BLE_MESH_GATT_PROXY_ENABLED &&
bt_mesh_friend_get() != BLE_MESH_FRIEND_ENABLED) {
bt_mesh_gatt_proxy_get() != BLE_MESH_GATT_PROXY_ENABLED) {
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)
* 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();
} else {
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) &&
(bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED ||
rx->friend_cred ||
rx->net_if == BLE_MESH_NET_IF_LOCAL)) {
if (bt_mesh_proxy_server_relay(&buf->b, 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)
bt_mesh_adv_send(buf, NULL, NULL);
#else