Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Process pfil hooks for Ethernet input and output.
details: https://anonhg.NetBSD.org/src/rev/bd2984042104
branches: trunk
changeset: 508389:bd2984042104
user: thorpej <thorpej%NetBSD.org@localhost>
date: Tue Apr 10 21:47:36 2001 +0000
description:
Process pfil hooks for Ethernet input and output.
diffstat:
sys/net/if_ethersubr.c | 38 +++++++++++++++++++++++++++++++-------
1 files changed, 31 insertions(+), 7 deletions(-)
diffs (73 lines):
diff -r f9e18fbfc1d8 -r bd2984042104 sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c Tue Apr 10 21:45:39 2001 +0000
+++ b/sys/net/if_ethersubr.c Tue Apr 10 21:47:36 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ethersubr.c,v 1.76 2001/04/07 18:01:48 thorpej Exp $ */
+/* $NetBSD: if_ethersubr.c,v 1.77 2001/04/10 21:47:36 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -71,6 +71,7 @@
#include "opt_iso.h"
#include "opt_ns.h"
#include "opt_gateway.h"
+#include "opt_pfil_hooks.h"
#include "vlan.h"
#include "bpfilter.h"
@@ -225,12 +226,6 @@
senderr(rt == rt0 ? EHOSTDOWN : EHOSTUNREACH);
}
- /*
- * If the queueing discipline needs packet classification,
- * do it before prepending link headers.
- */
- IFQ_CLASSIFY(&ifp->if_snd, m, dst->sa_family, &pktattr);
-
switch (dst->sa_family) {
#ifdef INET
@@ -477,6 +472,25 @@
else
bcopy(LLADDR(ifp->if_sadl), (caddr_t)eh->ether_shost,
sizeof(eh->ether_shost));
+
+#ifdef PFIL_HOOKS
+ if ((error = pfil_run_hooks(&ifp->if_pfil, &m, ifp, PFIL_OUT)) != 0)
+ return (error);
+ if (m == NULL)
+ return (0);
+#endif
+
+#ifdef ALTQ
+ /*
+ * If ALTQ is enabled on the parent interface, do
+ * classification; the queueing discipline might not
+ * require classification, but might require the
+ * address family/header pointer in the pktattr.
+ */
+ if (ALTQ_IS_ENABLED(&ifp->if_snd))
+ altq_etherclassify(&ifp->if_snd, m, &pktattr);
+#endif
+
mflags = m->m_flags;
len = m->m_pkthdr.len;
s = splimp();
@@ -626,6 +640,16 @@
return;
}
+#ifdef PFIL_HOOKS
+ if (pfil_run_hooks(&ifp->if_pfil, &m, ifp, PFIL_IN) != 0)
+ return;
+ if (m == NULL)
+ return;
+
+ eh = mtod(m, struct ether_header *);
+ etype = ntohs(eh->ether_type);
+#endif
+
ifp->if_lastchange = time;
ifp->if_ibytes += m->m_pkthdr.len;
if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
Home |
Main Index |
Thread Index |
Old Index