mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ble_mesh: stack: Fix rpl not check by proxy cfg [Zephyr]
This commit is contained in:
parent
a587cd1774
commit
e286cd845f
@ -582,6 +582,10 @@ void bt_mesh_rpl_reset(void)
|
|||||||
} else {
|
} else {
|
||||||
rpl->old_iv = true;
|
rpl->old_iv = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IS_ENABLED(CONFIG_BLE_MESH_SETTINGS)) {
|
||||||
|
bt_mesh_store_rpl(rpl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "mesh.h"
|
#include "mesh.h"
|
||||||
#include "access.h"
|
#include "access.h"
|
||||||
#include "beacon.h"
|
#include "beacon.h"
|
||||||
|
#include "transport.h"
|
||||||
#include "mesh_common.h"
|
#include "mesh_common.h"
|
||||||
#include "foundation.h"
|
#include "foundation.h"
|
||||||
#include "proxy_client.h"
|
#include "proxy_client.h"
|
||||||
@ -171,6 +172,14 @@ static void proxy_cfg(struct bt_mesh_proxy_server *server)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rx.local_match = 1U;
|
||||||
|
|
||||||
|
if (bt_mesh_rpl_check(&rx, NULL)) {
|
||||||
|
BT_WARN("Replay: src 0x%04x dst 0x%04x seq 0x%06x",
|
||||||
|
rx.ctx.addr, rx.ctx.recv_dst, rx.seq);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove network headers */
|
/* Remove network headers */
|
||||||
net_buf_simple_pull(&buf, BLE_MESH_NET_HDR_LEN);
|
net_buf_simple_pull(&buf, BLE_MESH_NET_HDR_LEN);
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "prov.h"
|
#include "prov.h"
|
||||||
#include "beacon.h"
|
#include "beacon.h"
|
||||||
#include "access.h"
|
#include "access.h"
|
||||||
|
#include "transport.h"
|
||||||
#include "foundation.h"
|
#include "foundation.h"
|
||||||
#include "proxy_server.h"
|
#include "proxy_server.h"
|
||||||
|
|
||||||
@ -308,6 +309,14 @@ static void proxy_cfg(struct bt_mesh_proxy_client *client)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rx.local_match = 1U;
|
||||||
|
|
||||||
|
if (bt_mesh_rpl_check(&rx, NULL)) {
|
||||||
|
BT_WARN("Replay: src 0x%04x dst 0x%04x seq 0x%06x",
|
||||||
|
rx.ctx.addr, rx.ctx.recv_dst, rx.seq);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove network headers */
|
/* Remove network headers */
|
||||||
net_buf_simple_pull(&buf, BLE_MESH_NET_HDR_LEN);
|
net_buf_simple_pull(&buf, BLE_MESH_NET_HDR_LEN);
|
||||||
|
|
||||||
|
@ -665,7 +665,7 @@ static void update_rpl(struct bt_mesh_rpl *rpl, struct bt_mesh_net_rx *rx)
|
|||||||
* updated (needed for segmented messages), whereas if a NULL match is given
|
* updated (needed for segmented messages), whereas if a NULL match is given
|
||||||
* the RPL is immediately updated (used for unsegmented messages).
|
* the RPL is immediately updated (used for unsegmented messages).
|
||||||
*/
|
*/
|
||||||
static bool is_replay(struct bt_mesh_net_rx *rx, struct bt_mesh_rpl **match)
|
bool bt_mesh_rpl_check(struct bt_mesh_net_rx *rx, struct bt_mesh_rpl **match)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1058,7 +1058,7 @@ static int trans_unseg(struct net_buf_simple *buf, struct bt_mesh_net_rx *rx,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_replay(rx, NULL)) {
|
if (bt_mesh_rpl_check(rx, NULL)) {
|
||||||
BT_WARN("Replay: src 0x%04x dst 0x%04x seq 0x%06x",
|
BT_WARN("Replay: src 0x%04x dst 0x%04x seq 0x%06x",
|
||||||
rx->ctx.addr, rx->ctx.recv_dst, rx->seq);
|
rx->ctx.addr, rx->ctx.recv_dst, rx->seq);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1486,7 +1486,7 @@ static int trans_seg(struct net_buf_simple *buf, struct bt_mesh_net_rx *net_rx,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_replay(net_rx, &rpl)) {
|
if (bt_mesh_rpl_check(net_rx, &rpl)) {
|
||||||
BT_WARN("Replay: src 0x%04x dst 0x%04x seq 0x%06x",
|
BT_WARN("Replay: src 0x%04x dst 0x%04x seq 0x%06x",
|
||||||
net_rx->ctx.addr, net_rx->ctx.recv_dst, net_rx->seq);
|
net_rx->ctx.addr, net_rx->ctx.recv_dst, net_rx->seq);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -114,6 +114,8 @@ int bt_mesh_trans_recv(struct net_buf_simple *buf, struct bt_mesh_net_rx *rx);
|
|||||||
void bt_mesh_trans_init(void);
|
void bt_mesh_trans_init(void);
|
||||||
void bt_mesh_trans_deinit(bool erase);
|
void bt_mesh_trans_deinit(bool erase);
|
||||||
|
|
||||||
|
bool bt_mesh_rpl_check(struct bt_mesh_net_rx *rx, struct bt_mesh_rpl **match);
|
||||||
|
|
||||||
void bt_mesh_heartbeat_send(void);
|
void bt_mesh_heartbeat_send(void);
|
||||||
|
|
||||||
int bt_mesh_app_key_get(const struct bt_mesh_subnet *subnet, u16_t app_idx,
|
int bt_mesh_app_key_get(const struct bt_mesh_subnet *subnet, u16_t app_idx,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user