MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ng_ppp_get_packet

Function ng_ppp_get_packet

freebsd/netgraph/ng_ppp.c:1705–1736  ·  view source on GitHub ↗

* Pull a completed packet off the head of the incoming fragment queue. * This assumes there is a completed packet there to pull off. */

Source from the content-addressed store, hash-verified

1703 * This assumes there is a completed packet there to pull off.
1704 */
1705static void
1706ng_ppp_get_packet(node_p node, struct mbuf **mp)
1707{
1708 const priv_p priv = NG_NODE_PRIVATE(node);
1709 struct ng_ppp_frag *qent, *qnext;
1710 struct mbuf *m = NULL, *tail;
1711
1712 qent = TAILQ_FIRST(&priv->frags);
1713 KASSERT(!TAILQ_EMPTY(&priv->frags) && qent->first,
1714 ("%s: no packet", __func__));
1715 for (tail = NULL; qent != NULL; qent = qnext) {
1716 qnext = TAILQ_NEXT(qent, f_qent);
1717 KASSERT(!TAILQ_EMPTY(&priv->frags),
1718 ("%s: empty q", __func__));
1719 TAILQ_REMOVE(&priv->frags, qent, f_qent);
1720 if (tail == NULL)
1721 tail = m = qent->data;
1722 else {
1723 m->m_pkthdr.len += qent->data->m_pkthdr.len;
1724 tail->m_next = qent->data;
1725 }
1726 while (tail->m_next != NULL)
1727 tail = tail->m_next;
1728 if (qent->last) {
1729 qnext = NULL;
1730 /* Bump MSEQ if necessary */
1731 ng_ppp_bump_mseq(node, qent->seq);
1732 }
1733 TAILQ_INSERT_HEAD(&priv->fragsfree, qent, f_qent);
1734 }
1735 *mp = m;
1736}
1737
1738/*
1739 * Trim fragments from the queue whose packets can never be completed.

Callers 2

ng_ppp_frag_processFunction · 0.85
ng_ppp_frag_checkstaleFunction · 0.85

Calls 1

ng_ppp_bump_mseqFunction · 0.85

Tested by

no test coverage detected