OpenFastPath / ofp

OpenFastPath project
BSD 3-Clause "New" or "Revised" License
349 stars 126 forks source link

ofp tcp_reassembly not flushing the odp_packets causing packet leak #267

Open vishoo opened 3 years ago

vishoo commented 3 years ago

The tcp resassembly code does not flush the odp_packets which are attached to the tcp_segment while closing the connection and flushing the tcp reassembly list. In file ofp_tcp_reass.c void ofp_tcp_reass_flush(struct tcpcb tp) { struct tseg_qent qe;

    INP_WLOCK_ASSERT(tp->t_inpcb);

    while ((qe = OFP_LIST_FIRST(&tp->t_segq)) != NULL) {
            OFP_LIST_REMOVE(qe, tqe_q);

            odp_packet_free(qe->tqe_m);  // This code is necessary to free the odp packets which are held by the tcp segments  as part of re-assembly list.** 

            uma_zfree(V_tcp_reass_zone, qe);
            tp->t_segqlen--;
    }

    KASSERT((tp->t_segqlen == 0),
        ("TCP reass queue %p segment count is %d instead of 0 after flush.",
        tp, tp->t_segqlen));

}

After having this fix in code, we dont see any packet buffer leaks. Please let me know if its ok , then I can push the changes. Have submitted changes for review!

bogdanPricope commented 3 years ago

Looks OK to me. Unfortunately there is no 'maintainer' still active on OFP.