mesh: Fix friend node cache message
Friend node cache segment message for lpn, message with
sequence number can't change, since could cause lpn replay
attack.
This is port of
@@ -723,7 +723,7 @@ static int sdu_recv(struct bt_mesh_net_rx *rx, uint8_t hdr, uint8_t aszmic,
.aszmic = aszmic,
.src = rx->ctx.addr,
.dst = rx->ctx.recv_dst,
- .seq_num = rx->seq,
+ .seq_num = seg ? (seg->seq_auth & 0xffffff) : rx->seq,
.iv_index = BT_MESH_NET_IVI_RX(rx),
},
.buf = buf,
@@ -1447,9 +1447,6 @@ found_rx:
send_ack(net_rx->sub, net_rx->ctx.recv_dst, net_rx->ctx.addr,
net_rx->ctx.send_ttl, seq_auth, rx->block, rx->obo);
- /* Decrypt with seqAuth */
- net_rx->seq = (rx->seq_auth & 0xffffff);
-
if (net_rx->ctl) {
struct os_mbuf *sdu = NET_BUF_SIMPLE(BT_MESH_RX_CTL_MAX);
seg_rx_assemble(rx, sdu, 0U);
