* Recive data from a hook. Pass the packet to the correct input routine. */
| 348 | * Recive data from a hook. Pass the packet to the correct input routine. |
| 349 | */ |
| 350 | static int |
| 351 | ng_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. |
nothing calls this directly
no test coverage detected