ble_mesh: stack: Fix friend relay lpn message when relay disable.

pull/12165/head
wangjialiang 2022-08-24 15:50:16 +08:00 zatwierdzone przez BOT
rodzic 4b8915d7af
commit bf9b44f7fc
1 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -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