rlc_am_lte: extend check for valid status PDU

check for all NACKed SNs are smaller than ACK_SN
This commit is contained in:
Andre Puschmann 2021-03-05 18:09:00 +01:00
parent fa23be4d6d
commit 6a4bf65fd8
1 changed files with 6 additions and 0 deletions

View File

@ -1850,6 +1850,7 @@ int rlc_am_lte::rlc_am_lte_rx::get_status_pdu(rlc_status_pdu_t* status, const ui
rlc_am_packed_length(status),
max_pdu_size,
status->N_nack);
return 0;
}
break;
}
@ -2319,6 +2320,11 @@ int rlc_am_write_status_pdu(rlc_status_pdu_t* status, uint8_t* payload)
bool rlc_am_is_valid_status_pdu(const rlc_status_pdu_t& status)
{
for (uint32_t i = 0; i < status.N_nack; ++i) {
// NACK can't be larger than ACK
if ((MOD + status.ack_sn - status.nacks[i].nack_sn) % MOD > RLC_AM_WINDOW_SIZE) {
return false;
}
// Don't NACK the ACK SN
if (status.nacks[i].nack_sn == status.ack_sn) {
return false;
}