From 8338396bf48aa0e8d0d24704b4ba2f5cb958f5c3 Mon Sep 17 00:00:00 2001 From: thorpej Date: Wed, 16 Apr 1997 23:41:19 +0000 Subject: [PATCH] - Update for no __BROKEN_INDIRECT_CONFIG. - Fix BPF hooks. --- sys/dev/ofw/ofnet.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/sys/dev/ofw/ofnet.c b/sys/dev/ofw/ofnet.c index 4334f457e53f..677e45b4a75d 100644 --- a/sys/dev/ofw/ofnet.c +++ b/sys/dev/ofw/ofnet.c @@ -1,4 +1,4 @@ -/* $NetBSD: ofnet.c,v 1.5 1997/03/15 18:11:51 is Exp $ */ +/* $NetBSD: ofnet.c,v 1.6 1997/04/16 23:41:19 thorpej Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -48,6 +48,11 @@ #include #endif +#if NBPFILTER > 0 +#include +#include +#endif + #include #if NIPKDB_OFN > 0 @@ -61,7 +66,7 @@ struct cfattach ipkdb_ofn_ca = { static struct ipkdb_if *kifp; static struct ofn_softc *ipkdb_of; -static int ipkdbprobe __P((void *, void *)); +static int ipkdbprobe __P((struct cfdata *, void *)); #endif struct ofn_softc { @@ -71,7 +76,7 @@ struct ofn_softc { struct ethercom sc_ethercom; }; -static int ofnprobe __P((struct device *, void *, void *)); +static int ofnprobe __P((struct device *, struct cfdata *, void *)); static void ofnattach __P((struct device *, struct device *, void *)); struct cfattach ofnet_ca = { @@ -94,7 +99,8 @@ static void ofnwatchdog __P((struct ifnet *)); static int ofnprobe(parent, match, aux) struct device *parent; - void *match, *aux; + struct cfdata *match; + void *aux; { struct ofprobe *ofp = aux; char type[32]; @@ -229,9 +235,9 @@ ofnread(of) continue; eh = mtod(head, struct ether_header *); -#if NBPFILTER > 0 - if (ifp->if_bpf) { - bpf->mtap(ifp->if_bpf, m); +#if NBPFILTER > 0 + if (ifp->if_bpf) + bpf_mtap(ifp->if_bpf, m); #endif m_adj(head, sizeof(struct ether_header)); ifp->if_ipackets++; @@ -295,7 +301,12 @@ ofnstart(ifp) if (!(m0->m_flags & M_PKTHDR)) panic("ofnstart: no header mbuf"); len = m0->m_pkthdr.len; - + +#if NBPFILTER > 0 + if (ifp->if_bpf) + bpf_mtap(ifp->if_bpf, m0); +#endif + if (len > ETHERMTU + sizeof(struct ether_header)) { /* packet too large, toss it */ ifp->if_oerrors++; @@ -303,10 +314,6 @@ ofnstart(ifp) continue; } -#if NPBFILTER > 0 - if (ifp->if_bpf) - bpf_mtab(ifp->if_bpf, m0); -#endif for (bufp = buf; m = m0;) { bcopy(mtod(m, char *), bufp, m->m_len); bufp += m->m_len; @@ -421,15 +428,15 @@ ipkdbofsend(kip, buf, l) static int ipkdbprobe(match, aux) - void *match, *aux; + struct cfdata *match; + void *aux; { - struct cfdata *cf = match; struct ipkdb_if *kip = aux; static char name[256]; int len; int phandle; - kip->unit = cf->cf_unit + 1; + kip->unit = match->cf_unit + 1; if (!(kip->port = OF_open("net"))) return -1;