mesh: Fixes Relay to frnd_cred message
If low power node publish with unicast address other
than friend address, the friend node should relayed
this message to all network interface.
When Proxy feature enabled, message from gatt bearer should
relay to adv bearer even relay feature disabled.
this is port of
@@ -611,6 +611,7 @@ static void bt_mesh_net_relay(struct os_mbuf *sbuf,
}
if (rx->net_if == BT_MESH_NET_IF_ADV &&
+ !rx->friend_cred &&
bt_mesh_relay_get() != BT_MESH_RELAY_ENABLED &&
bt_mesh_gatt_proxy_get() != BT_MESH_GATT_PROXY_ENABLED) {
return;
@@ -623,7 +624,7 @@ static void bt_mesh_net_relay(struct os_mbuf *sbuf,
* Anything else (like GATT to adv, or locally originated packets)
* use the Network Transmit state.
*/
- if (rx->net_if == BT_MESH_NET_IF_ADV) {
+ if (rx->net_if == BT_MESH_NET_IF_ADV && !rx->friend_cred) {
transmit = bt_mesh_relay_retransmit_get();
} else {
transmit = bt_mesh_net_transmit_get();
@@ -663,18 +664,17 @@ static void bt_mesh_net_relay(struct os_mbuf *sbuf,
BT_DBG("encoded %u bytes: %s", buf->om_len,
bt_hex(buf->om_data, buf->om_len));
- /* Sending to the GATT bearer should only happen if GATT Proxy
- * is enabled.
+ /* When the Friend node relays message for lpn, the message will be
+ * retransmitted using the managed master security credentials and
+ * the Network PDU shall be retransmitted to all network interfaces.
*/
if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY) &&
- bt_mesh_gatt_proxy_get() == BT_MESH_GATT_PROXY_ENABLED) {
- if (bt_mesh_proxy_relay(buf, rx->ctx.recv_dst) &&
- BT_MESH_ADDR_IS_UNICAST(rx->ctx.recv_dst)) {
- goto done;
- }
+ (rx->friend_cred ||
+ bt_mesh_gatt_proxy_get() == BT_MESH_GATT_PROXY_ENABLED)) {
+ bt_mesh_proxy_relay(buf, rx->ctx.recv_dst);
}
- if (relay_to_adv(rx->net_if)) {
+ if (relay_to_adv(rx->net_if) || rx->friend_cred) {
bt_mesh_adv_send(buf, NULL, NULL);
}
