Deleted Added
full compact
1
2/*
3 * ng_ether.c
4 */
5
6/*-
7 * Copyright (c) 1996-2000 Whistle Communications, Inc.
8 * All rights reserved.

--- 25 unchanged lines hidden (view full) ---

34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
37 * OF SUCH DAMAGE.
38 *
39 * Authors: Archie Cobbs <archie@freebsd.org>
40 * Julian Elischer <julian@freebsd.org>
41 *
42 * $FreeBSD: head/sys/netgraph/ng_ether.c 238844 2012-07-27 13:57:28Z emaste $
42 * $FreeBSD: head/sys/netgraph/ng_ether.c 241686 2012-10-18 13:57:24Z andre $
43 */
44
45/*
46 * ng_ether(4) netgraph node type
47 */
48
49#include <sys/param.h>
50#include <sys/systm.h>

--- 164 unchanged lines hidden (view full) ---

215
216/******************************************************************
217 ETHERNET FUNCTION HOOKS
218******************************************************************/
219
220/*
221 * Handle a packet that has come in on an interface. We get to
222 * look at it here before any upper layer protocols do.
223 *
224 * NOTE: this function will get called at splimp()
223 */
224static void
225ng_ether_input(struct ifnet *ifp, struct mbuf **mp)
226{
227 const node_p node = IFP2NG(ifp);
228 const priv_p priv = NG_NODE_PRIVATE(node);
229 int error;
230
231 /* If "lower" hook not connected, let packet continue */
232 if (priv->lower == NULL)
233 return;
234 NG_SEND_DATA_ONLY(error, priv->lower, *mp); /* sets *mp = NULL */
235}
236
237/*
238 * Handle a packet that has come in on an interface, and which
239 * does not match any of our known protocols (an ``orphan'').
242 *
243 * NOTE: this function will get called at splimp()
240 */
241static void
242ng_ether_input_orphan(struct ifnet *ifp, struct mbuf *m)
243{
244 const node_p node = IFP2NG(ifp);
245 const priv_p priv = NG_NODE_PRIVATE(node);
246 int error;
247

--- 502 unchanged lines hidden (view full) ---

750
751/*
752 * Handle loading and unloading for this node type.
753 */
754static int
755ng_ether_mod_event(module_t mod, int event, void *data)
756{
757 int error = 0;
762 int s;
758
764 s = splnet();
759 switch (event) {
760 case MOD_LOAD:
761
762 /* Register function hooks */
763 if (ng_ether_attach_p != NULL) {
764 error = EEXIST;
765 break;
766 }

--- 24 unchanged lines hidden (view full) ---

791 ng_ether_input_orphan_p = NULL;
792 ng_ether_link_state_p = NULL;
793 break;
794
795 default:
796 error = EOPNOTSUPP;
797 break;
798 }
805 splx(s);
799 return (error);
800}
801
802static void
803vnet_ng_ether_init(const void *unused)
804{
805 struct ifnet *ifp;
806

--- 15 unchanged lines hidden ---