From 518199ba58bef20dcdecdd321928357f10060b57 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Wed, 4 Apr 2018 17:18:13 +0200 Subject: [PATCH] fix size calculation when receiving not-start-aligned RLC AM segments --- lib/src/upper/rlc_am.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/src/upper/rlc_am.cc b/lib/src/upper/rlc_am.cc index 3295f37d2..346b2b18d 100644 --- a/lib/src/upper/rlc_am.cc +++ b/lib/src/upper/rlc_am.cc @@ -1350,7 +1350,13 @@ bool rlc_am::add_segment_and_check(rlc_amd_rx_pdu_segments_t *pdu, rlc_amd_rx_pd count += it->header.li[i]; } } - carryover = it->buf->N_bytes - count; + + // accumulate segment sizes until end aligned PDU is received + if (rlc_am_not_start_aligned(it->header.fi)) { + carryover += it->buf->N_bytes - count; + } else { + carryover = it->buf->N_bytes - count; + } tmpit = it; if(rlc_am_end_aligned(it->header.fi) && ++tmpit != pdu->segments.end()) { header.li[header.N_li++] = carryover;