* Delivers packets from the queue "q" to upper layers. Frees delivered * entries with the exception of one equal to "st" that is allocated * on caller's stack and not on the heap. */
| 720 | * on caller's stack and not on the heap. |
| 721 | */ |
| 722 | static int |
| 723 | ng_pptpgre_sendq(const hpriv_p hpriv, roqh *q, const struct ng_pptpgre_roq *st) |
| 724 | { |
| 725 | struct ng_pptpgre_roq *np; |
| 726 | struct mbuf *m; |
| 727 | int error = 0; |
| 728 | |
| 729 | mtx_assert(&hpriv->mtx, MA_NOTOWNED); |
| 730 | while (!SLIST_EMPTY(q)) { |
| 731 | np = SLIST_FIRST(q); |
| 732 | SLIST_REMOVE_HEAD(q, next); |
| 733 | NGI_GET_M(np->item, m); |
| 734 | NG_FWD_NEW_DATA(error, np->item, hpriv->hook, m); |
| 735 | if (np != st) |
| 736 | free(np, M_NETGRAPH); |
| 737 | } |
| 738 | return (error); |
| 739 | } |
| 740 | |
| 741 | /* |
| 742 | * Handle an incoming packet. The packet includes the IP header. |
no test coverage detected