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

Function ng_ppp_frag_drop

freebsd/netgraph/ng_ppp.c:1792–1818  ·  view source on GitHub ↗

* Drop fragments on queue overflow. * Returns 1 if fragments were removed, zero otherwise. */

Source from the content-addressed store, hash-verified

1790 * Returns 1 if fragments were removed, zero otherwise.
1791 */
1792static int
1793ng_ppp_frag_drop(node_p node)
1794{
1795 const priv_p priv = NG_NODE_PRIVATE(node);
1796
1797 /* Check queue length */
1798 if (TAILQ_EMPTY(&priv->fragsfree)) {
1799 struct ng_ppp_frag *qent;
1800
1801 /* Get oldest fragment */
1802 KASSERT(!TAILQ_EMPTY(&priv->frags),
1803 ("%s: empty q", __func__));
1804 qent = TAILQ_FIRST(&priv->frags);
1805
1806 /* Bump MSEQ if necessary */
1807 ng_ppp_bump_mseq(node, qent->seq);
1808
1809 /* Drop it */
1810 priv->bundleStats.dropFragments++;
1811 TAILQ_REMOVE(&priv->frags, qent, f_qent);
1812 NG_FREE_M(qent->data);
1813 TAILQ_INSERT_HEAD(&priv->fragsfree, qent, f_qent);
1814
1815 return (1);
1816 }
1817 return (0);
1818}
1819
1820/*
1821 * Run the queue, restoring the queue invariants

Callers 1

ng_ppp_frag_processFunction · 0.85

Calls 1

ng_ppp_bump_mseqFunction · 0.85

Tested by

no test coverage detected