ble_mesh: stack: Fix rpl not check by proxy cfg [Zephyr]
This commit is contained in:
parent
ad0b1ac8d7
commit
3e61d519c1
5 changed files with 27 additions and 3 deletions
|
@ -582,6 +582,10 @@ void bt_mesh_rpl_reset(void)
|
|||
} else {
|
||||
rpl->old_iv = true;
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BLE_MESH_SETTINGS)) {
|
||||
bt_mesh_store_rpl(rpl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "mesh.h"
|
||||
#include "access.h"
|
||||
#include "beacon.h"
|
||||
#include "transport.h"
|
||||
#include "mesh_common.h"
|
||||
#include "foundation.h"
|
||||
#include "proxy_client.h"
|
||||
|
@ -171,6 +172,14 @@ static void proxy_cfg(struct bt_mesh_proxy_server *server)
|
|||
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 */
|
||||
net_buf_simple_pull(&buf, BLE_MESH_NET_HDR_LEN);
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "prov.h"
|
||||
#include "beacon.h"
|
||||
#include "access.h"
|
||||
#include "transport.h"
|
||||
#include "foundation.h"
|
||||
#include "proxy_server.h"
|
||||
|
||||
|
@ -308,6 +309,14 @@ static void proxy_cfg(struct bt_mesh_proxy_client *client)
|
|||
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 */
|
||||
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
|
||||
* 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;
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ static int trans_unseg(struct net_buf_simple *buf, struct bt_mesh_net_rx *rx,
|
|||
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",
|
||||
rx->ctx.addr, rx->ctx.recv_dst, rx->seq);
|
||||
return -EINVAL;
|
||||
|
@ -1486,7 +1486,7 @@ static int trans_seg(struct net_buf_simple *buf, struct bt_mesh_net_rx *net_rx,
|
|||
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",
|
||||
net_rx->ctx.addr, net_rx->ctx.recv_dst, net_rx->seq);
|
||||
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_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);
|
||||
|
||||
int bt_mesh_app_key_get(const struct bt_mesh_subnet *subnet, u16_t app_idx,
|
||||
|
|
Loading…
Reference in a new issue