X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_ip_frag%2Frte_ipv4_reassembly.c;h=e084ca59a64bf48a7ba809758bad15cb416da4e0;hb=99c12dcca65d;hp=26d07f9a25b2ac579cf65ca5b9f5abe75a74a8a2;hpb=139debc42dc0a320dad40f5295b74d2e3ab8a7f9;p=dpdk.git diff --git a/lib/librte_ip_frag/rte_ipv4_reassembly.c b/lib/librte_ip_frag/rte_ipv4_reassembly.c index 26d07f9a25..e084ca59a6 100644 --- a/lib/librte_ip_frag/rte_ipv4_reassembly.c +++ b/lib/librte_ip_frag/rte_ipv4_reassembly.c @@ -41,11 +41,12 @@ * Reassemble fragments into one packet. */ struct rte_mbuf * -ipv4_frag_reassemble(const struct ip_frag_pkt *fp) +ipv4_frag_reassemble(struct ip_frag_pkt *fp) { struct ipv4_hdr *ip_hdr; struct rte_mbuf *m, *prev; uint32_t i, n, ofs, first_len; + uint32_t curr_idx = 0; first_len = fp->frags[IP_FIRST_FRAG_IDX].len; n = fp->last_idx - 1; @@ -53,6 +54,7 @@ ipv4_frag_reassemble(const struct ip_frag_pkt *fp) /*start from the last fragment. */ m = fp->frags[IP_LAST_FRAG_IDX].mb; ofs = fp->frags[IP_LAST_FRAG_IDX].ofs; + curr_idx = IP_LAST_FRAG_IDX; while (ofs != first_len) { @@ -67,6 +69,10 @@ ipv4_frag_reassemble(const struct ip_frag_pkt *fp) rte_pktmbuf_adj(m, (uint16_t)(m->l2_len + m->l3_len)); rte_pktmbuf_chain(fp->frags[i].mb, m); + /* this mbuf should not be accessed directly */ + fp->frags[curr_idx].mb = NULL; + curr_idx = i; + /* update our last fragment and offset. */ m = fp->frags[i].mb; ofs = fp->frags[i].ofs;