Skip to content

ofp tcp_reassembly not flushing the odp_packets causing packet leak #267

@vishoo

Description

@vishoo

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions