* Handle an mbuf received on the "upper" hook. */
| 708 | * Handle an mbuf received on the "upper" hook. |
| 709 | */ |
| 710 | static int |
| 711 | ng_ether_rcv_upper(hook_p hook, item_p item) |
| 712 | { |
| 713 | struct mbuf *m; |
| 714 | const node_p node = NG_HOOK_NODE(hook); |
| 715 | const priv_p priv = NG_NODE_PRIVATE(node); |
| 716 | struct ifnet *ifp = priv->ifp; |
| 717 | |
| 718 | NGI_GET_M(item, m); |
| 719 | NG_FREE_ITEM(item); |
| 720 | |
| 721 | /* Check length and pull off header */ |
| 722 | if (m->m_pkthdr.len < sizeof(struct ether_header)) { |
| 723 | NG_FREE_M(m); |
| 724 | return (EINVAL); |
| 725 | } |
| 726 | if (m->m_len < sizeof(struct ether_header) && |
| 727 | (m = m_pullup(m, sizeof(struct ether_header))) == NULL) |
| 728 | return (ENOBUFS); |
| 729 | |
| 730 | m->m_pkthdr.rcvif = ifp; |
| 731 | |
| 732 | /* Pass the packet to the bridge, it may come back to us */ |
| 733 | if (ifp->if_bridge) { |
| 734 | BRIDGE_INPUT(ifp, m); |
| 735 | if (m == NULL) |
| 736 | return (0); |
| 737 | } |
| 738 | |
| 739 | /* Route packet back in */ |
| 740 | ether_demux(ifp, m); |
| 741 | return (0); |
| 742 | } |
| 743 | |
| 744 | /* |
| 745 | * Shutdown node. This resets the node but does not remove it |
nothing calls this directly
no test coverage detected