ip_frag: recalculate data length of fragment
Checks
Commit Message
In some situations, we would get several ip fragments, which total
data length is less than minimum frame(64) and padding with zeros.
Examples: Second Fragment is "a0a1 a2a3 a4a5 a6a7 0000 0000 ..."
and Third Fragment is "a8a9 aaab acad aeaf b0b1 b2b3 ...".
And then, we would reassemble Second and Third Fragment like this
"a0a1 a2a3 a4a5 a6a7 0000 0000 ... a8a9 aaab acad aeaf b0b1 ...",
which is not correct! So, we need recalculate the data length
of fragment to remove invalid padings(zero)!
Signed-off-by: Yicai Lu <luyicai@huawei.com>
---
lib/librte_ip_frag/ip_frag_internal.c | 1 +
1 file changed, 1 insertion(+)
Comments
18/11/2020 14:29, Yicai Lu:
> In some situations, we would get several ip fragments, which total
> data length is less than minimum frame(64) and padding with zeros.
> Examples: Second Fragment is "a0a1 a2a3 a4a5 a6a7 0000 0000 ..."
> and Third Fragment is "a8a9 aaab acad aeaf b0b1 b2b3 ...".
> And then, we would reassemble Second and Third Fragment like this
> "a0a1 a2a3 a4a5 a6a7 0000 0000 ... a8a9 aaab acad aeaf b0b1 ...",
> which is not correct! So, we need recalculate the data length
> of fragment to remove invalid padings(zero)!
>
> Signed-off-by: Yicai Lu <luyicai@huawei.com>
Please add a line "Fixes" to identify the root cause,
it will help to know where to backport.
@@ -155,6 +155,7 @@ ip_frag_process(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr,
fp->frags[idx].ofs = ofs;
fp->frags[idx].len = len;
+ mb->data_len = mb->l2_len + mb->l3_len + len;
fp->frags[idx].mb = mb;
mb = NULL;