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

Function ng_sppp_rcvdata

freebsd/netgraph/ng_sppp.c:350–378  ·  view source on GitHub ↗

* Recive data from a hook. Pass the packet to the correct input routine. */

Source from the content-addressed store, hash-verified

348 * Recive data from a hook. Pass the packet to the correct input routine.
349 */
350static int
351ng_sppp_rcvdata (hook_p hook, item_p item)
352{
353 struct mbuf *m;
354 const priv_p priv = NG_NODE_PRIVATE (NG_HOOK_NODE (hook));
355 struct sppp *const pp = IFP2SP(priv->ifp);
356
357 NGI_GET_M (item, m);
358 NG_FREE_ITEM (item);
359 /* Sanity checks */
360 KASSERT (m->m_flags & M_PKTHDR, ("%s: not pkthdr", __func__));
361 if ((SP2IFP(pp)->if_flags & IFF_UP) == 0) {
362 NG_FREE_M (m);
363 return (ENETDOWN);
364 }
365
366 /* Update interface stats */
367 if_inc_counter(SP2IFP(pp), IFCOUNTER_IPACKETS, 1);
368
369 /* Note receiving interface */
370 m->m_pkthdr.rcvif = SP2IFP(pp);
371
372 /* Berkeley packet filter */
373 BPF_MTAP (SP2IFP(pp), m);
374
375 /* Send packet */
376 sppp_input (SP2IFP(pp), m);
377 return 0;
378}
379
380/*
381 * Shutdown and remove the node and its associated interface.

Callers

nothing calls this directly

Calls 2

if_inc_counterFunction · 0.85
sppp_inputFunction · 0.85

Tested by

no test coverage detected