dummynet: dn_dequeue() may return NULL

If there are no more entries, or if we fail to restore the rcvif of a
queued mbuf dn_dequeue() can return NULL.
Cope with this.

Reviewed by:	glebius
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34078
This commit is contained in:
Kristof Provost 2022-01-28 11:10:04 +01:00
parent 703e533da5
commit 9dac026822

View File

@ -243,6 +243,8 @@ wf2qp_dequeue(struct dn_sch_inst *_si)
q = HEAP_TOP(sch)->object;
alg_fq = (struct wf2qp_queue *)q;
m = dn_dequeue(q);
if (m == NULL)
return NULL;
heap_extract(sch, NULL); /* Remove queue from heap. */
si->V += (uint64_t)(m->m_pkthdr.len) * si->inv_wsum;
alg_fq->S = alg_fq->F; /* Update start time. */