diff options
author | Jason Wright <jason@cvs.openbsd.org> | 1999-05-13 15:44:51 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 1999-05-13 15:44:51 +0000 |
commit | 0bee46841bdbef18c0aa0d7a4f4db10968a7160d (patch) | |
tree | 97d7627af802ef98567270ba59444140ae00ea14 | |
parent | 0a81f6102525e5e33f378afc28e62381cafaded1 (diff) |
Compensate for the check for onwership of unicast packets in promiscuous
mode being moved to if_ether.c. This is the last of the drivers hopefully.
-rw-r--r-- | sys/arch/amiga/dev/if_ae.c | 18 | ||||
-rw-r--r-- | sys/arch/amiga/dev/if_ed.c | 18 | ||||
-rw-r--r-- | sys/arch/amiga/dev/if_es.c | 18 | ||||
-rw-r--r-- | sys/arch/amiga/dev/if_qn.c | 19 | ||||
-rw-r--r-- | sys/arch/arc/dev/if_sn.c | 10 | ||||
-rw-r--r-- | sys/arch/arm32/podulebus/if_ea.c | 12 | ||||
-rw-r--r-- | sys/arch/arm32/podulebus/if_eb.c | 12 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/if_ae.c | 18 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/if_mc.c | 12 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/if_sn.c | 11 | ||||
-rw-r--r-- | sys/arch/sun3/dev/if_ie.c | 16 | ||||
-rw-r--r-- | sys/arch/vax/if/if_qe.c | 15 | ||||
-rw-r--r-- | sys/arch/wgrisc/dev/if_sn.c | 13 |
13 files changed, 32 insertions, 160 deletions
diff --git a/sys/arch/amiga/dev/if_ae.c b/sys/arch/amiga/dev/if_ae.c index 0760c32f721..56c63033133 100644 --- a/sys/arch/amiga/dev/if_ae.c +++ b/sys/arch/amiga/dev/if_ae.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ae.c,v 1.11 1998/01/07 00:33:45 niklas Exp $ */ +/* $OpenBSD: if_ae.c,v 1.12 1999/05/13 15:44:47 jason Exp $ */ /* $NetBSD: if_ae.c,v 1.14 1997/03/18 18:44:53 veego Exp $ */ /* @@ -732,22 +732,8 @@ aeread(sc, buf, len) * If so, hand off the raw packet to bpf, which must deal with * trailers in its own way. */ - if (ifp->if_bpf) { + if (ifp->if_bpf) bpf_mtap(ifp->if_bpf, m); - - /* - * Note that the interface cannot be in promiscuous mode if - * there are no bpf listeners. And if we are in promiscuous - * mode, we have to check if this packet is really ours. - */ - if ((ifp->if_flags & IFF_PROMISC) && - (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, - sizeof(eh->ether_dhost)) != 0) { - m_freem(m); - return; - } - } #endif /* We assume that the header fit entirely in one mbuf. */ diff --git a/sys/arch/amiga/dev/if_ed.c b/sys/arch/amiga/dev/if_ed.c index 8244c5d7590..b3f0dfffdda 100644 --- a/sys/arch/amiga/dev/if_ed.c +++ b/sys/arch/amiga/dev/if_ed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ed.c,v 1.11 1997/09/18 13:39:56 niklas Exp $ */ +/* $OpenBSD: if_ed.c,v 1.12 1999/05/13 15:44:48 jason Exp $ */ /* $NetBSD: if_ed.c,v 1.26 1997/03/17 17:51:42 is Exp $ */ /* @@ -1014,22 +1014,8 @@ ed_get_packet(sc, buf, len) * Check if there's a BPF listener on this interface. If so, hand off * the raw packet to bpf. */ - if (sc->sc_arpcom.ac_if.if_bpf) { + if (sc->sc_arpcom.ac_if.if_bpf) bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m); - - /* - * Note that the interface cannot be in promiscuous mode if - * there are no BPF listeners. And if we are in promiscuous - * mode, we have to check if this packet is really ours. - */ - if ((sc->sc_arpcom.ac_if.if_flags & IFF_PROMISC) && - (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, - sizeof(eh->ether_dhost)) != 0) { - m_freem(m); - return; - } - } #endif /* Fix up data start offset in mbuf to point past ether header. */ diff --git a/sys/arch/amiga/dev/if_es.c b/sys/arch/amiga/dev/if_es.c index 11a6a0bb3cb..ca82e91e13d 100644 --- a/sys/arch/amiga/dev/if_es.c +++ b/sys/arch/amiga/dev/if_es.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_es.c,v 1.10 1997/01/16 09:24:43 niklas Exp $ */ +/* $OpenBSD: if_es.c,v 1.11 1999/05/13 15:44:48 jason Exp $ */ /* $NetBSD: if_es.c,v 1.16 1996/12/23 09:10:17 veego Exp $ */ /* @@ -714,22 +714,8 @@ esrint(sc) * Check if there's a BPF listener on this interface. If so, hand off * the raw packet to bpf. */ - if (sc->sc_arpcom.ac_if.if_bpf) { + if (sc->sc_arpcom.ac_if.if_bpf) bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, top); - - /* - * Note that the interface cannot be in promiscuous mode if - * there are no BPF listeners. And if we are in promiscuous - * mode, we have to check if this packet is really ours. - */ - if ((sc->sc_arpcom.ac_if.if_flags & IFF_PROMISC) && - (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, - sizeof(eh->ether_dhost)) != 0) { - m_freem(top); - return; - } - } #endif top->m_pkthdr.len -= sizeof (*eh); top->m_len -= sizeof (*eh); diff --git a/sys/arch/amiga/dev/if_qn.c b/sys/arch/amiga/dev/if_qn.c index 313f5098d6c..6db5632a5e0 100644 --- a/sys/arch/amiga/dev/if_qn.c +++ b/sys/arch/amiga/dev/if_qn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_qn.c,v 1.11 1998/03/01 14:18:02 niklas Exp $ */ +/* $OpenBSD: if_qn.c,v 1.12 1999/05/13 15:44:48 jason Exp $ */ /* $NetBSD: if_qn.c,v 1.10 1996/12/23 09:10:19 veego Exp $ */ /* @@ -623,23 +623,8 @@ qn_get_packet(sc, len) } #if NBPFILTER > 0 - if (sc->sc_bpf) { + if (sc->sc_bpf) bpf_mtap(sc->sc_bpf, head); - - /* - * The interface cannot be in promiscuous mode if there are - * no BPF listeners. And in prom. mode we have to check - * if the packet is really ours... - */ - if ((sc->sc_arpcom.ac_if.if_flags & IFF_PROMISC) && - (eh->ether_dhost[0] & 1) == 0 && /* not bcast or mcast */ - bcmp(eh->ether_dhost, - sc->sc_arpcom.ac_enaddr, - ETHER_ADDR_LEN) != 0) { - m_freem(head); - return; - } - } #endif m_adj(head, sizeof(struct ether_header)); diff --git a/sys/arch/arc/dev/if_sn.c b/sys/arch/arc/dev/if_sn.c index 0028e297a33..a204db7a4ff 100644 --- a/sys/arch/arc/dev/if_sn.c +++ b/sys/arch/arc/dev/if_sn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sn.c,v 1.11 1999/01/11 05:11:09 millert Exp $ */ +/* $OpenBSD: if_sn.c,v 1.12 1999/05/13 15:44:48 jason Exp $ */ /* * National Semiconductor SONIC Driver * Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk) @@ -1174,15 +1174,9 @@ sonic_read(sc, rxp) * If so, hand off the raw packet to enet, then discard things * not destined for us (but be sure to keep broadcast/multicast). */ - if (sc->sc_if.if_bpf) { + if (sc->sc_if.if_bpf) bpf_tap(sc->sc_if.if_bpf, pkt, len + sizeof(struct ether_header)); - if ((ifp->if_flags & IFF_PROMISC) != 0 && - (et->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(et->ether_dhost, sc->sc_enaddr, - sizeof(et->ether_dhost)) != 0) - return(0); - } #endif m = sonic_get(sc, et, len); if (m == NULL) diff --git a/sys/arch/arm32/podulebus/if_ea.c b/sys/arch/arm32/podulebus/if_ea.c index e503d723ee5..3cd4ea66e3f 100644 --- a/sys/arch/arm32/podulebus/if_ea.c +++ b/sys/arch/arm32/podulebus/if_ea.c @@ -1337,18 +1337,6 @@ earead(sc, buf, len) bpf_tap(sc->sc_arpcom.ac_if.if_bpf, buf, len + sizeof(struct ether_header)); /* bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m);*/ - /* - * Note that the interface cannot be in promiscuous mode if - * there are no BPF listeners. And if we are in promiscuous - * mode, we have to check if this packet is really ours. - */ - if ((sc->sc_arpcom.ac_if.if_flags & IFF_PROMISC) && - (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, - sizeof(eh->ether_dhost)) != 0) { - m_freem(m); - return; - } } #endif diff --git a/sys/arch/arm32/podulebus/if_eb.c b/sys/arch/arm32/podulebus/if_eb.c index 356af878376..beba71bb46f 100644 --- a/sys/arch/arm32/podulebus/if_eb.c +++ b/sys/arch/arm32/podulebus/if_eb.c @@ -1356,18 +1356,6 @@ ebread(sc, buf, len) bpf_tap(sc->sc_arpcom.ac_if.if_bpf, buf, len + sizeof(struct ether_header)); /* bpf_mtap(sc->sc_arpcom.ac_if.if_bpf, m);*/ - /* - * Note that the interface cannot be in promiscuous mode if - * there are no BPF listeners. And if we are in promiscuous - * mode, we have to check if this packet is really ours. - */ - if ((sc->sc_arpcom.ac_if.if_flags & IFF_PROMISC) && - (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, - sizeof(eh->ether_dhost)) != 0) { - m_freem(m); - return; - } } #endif diff --git a/sys/arch/mac68k/dev/if_ae.c b/sys/arch/mac68k/dev/if_ae.c index b86ffde3894..d72c57eb0de 100644 --- a/sys/arch/mac68k/dev/if_ae.c +++ b/sys/arch/mac68k/dev/if_ae.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ae.c,v 1.13 1997/04/25 22:15:26 gene Exp $ */ +/* $OpenBSD: if_ae.c,v 1.14 1999/05/13 15:44:49 jason Exp $ */ /* $NetBSD: if_ae.c,v 1.62 1997/04/24 16:52:05 scottr Exp $ */ /* @@ -864,22 +864,8 @@ aeread(sc, buf, len) * Check if there's a BPF listener on this interface. * If so, hand off the raw packet to bpf. */ - if (ifp->if_bpf) { + if (ifp->if_bpf) bpf_mtap(ifp->if_bpf, m); - - /* - * Note that the interface cannot be in promiscuous mode if - * there are no BPF listeners. And if we are in promiscuous - * mode, we have to check if this packet is really ours. - */ - if ((ifp->if_flags & IFF_PROMISC) && - (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->sc_arpcom.ac_enaddr, - sizeof(eh->ether_dhost)) != 0) { - m_freem(m); - return; - } - } #endif /* Fix up data start offset in mbuf to point past ether header. */ diff --git a/sys/arch/mac68k/dev/if_mc.c b/sys/arch/mac68k/dev/if_mc.c index aa03fb342f8..f504b184873 100644 --- a/sys/arch/mac68k/dev/if_mc.c +++ b/sys/arch/mac68k/dev/if_mc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mc.c,v 1.1 1998/05/08 22:15:31 gene Exp $ */ +/* $OpenBSD: if_mc.c,v 1.2 1999/05/13 15:44:49 jason Exp $ */ /* $NetBSD: if_mc.c,v 1.4 1998/01/12 19:22:09 thorpej Exp $ */ /*- @@ -638,16 +638,10 @@ mace_read(sc, pkt, len) #if NBPFILTER > 0 /* * Check if there's a bpf filter listening on this interface. - * If so, hand off the raw packet to enet, then discard things - * not destined for us (but be sure to keep broadcast/multicast). + * If so, hand off the raw packet to enet. */ - if (ifp->if_bpf) { + if (ifp->if_bpf) bpf_tap(ifp->if_bpf, pkt, len); - if ((ifp->if_flags & IFF_PROMISC) != 0 && - (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - ETHER_CMP(eh->ether_dhost, sc->sc_enaddr)) - return; - } #endif m = mace_get(sc, pkt, len); if (m == NULL) { diff --git a/sys/arch/mac68k/dev/if_sn.c b/sys/arch/mac68k/dev/if_sn.c index b192407a9c3..1bc820b882c 100644 --- a/sys/arch/mac68k/dev/if_sn.c +++ b/sys/arch/mac68k/dev/if_sn.c @@ -1126,18 +1126,11 @@ sonic_read(sc, pkt, len) #if NBPFILTER > 0 /* * Check if there's a bpf filter listening on this interface. - * If so, hand off the raw packet to enet, then discard things - * not destined for us (but be sure to keep broadcast/multicast). + * If so, hand off the raw packet to enet. */ - if (ifp->if_bpf) { + if (ifp->if_bpf) bpf_tap(ifp->if_bpf, pkt, len + sizeof(struct ether_header)); - if ((ifp->if_flags & IFF_PROMISC) != 0 && - (et->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(et->ether_dhost, &sc->sc_enaddr, - sizeof(et->ether_dhost)) != 0) - return (0); - } #endif m = sonic_get(sc, et, len); if (m == NULL) diff --git a/sys/arch/sun3/dev/if_ie.c b/sys/arch/sun3/dev/if_ie.c index 34651d5d4e8..f831f9bac12 100644 --- a/sys/arch/sun3/dev/if_ie.c +++ b/sys/arch/sun3/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.10 1999/01/11 05:12:01 millert Exp $ */ +/* $OpenBSD: if_ie.c,v 1.11 1999/05/13 15:44:49 jason Exp $ */ /* $NetBSD: if_ie.c,v 1.15 1996/10/30 00:24:33 gwr Exp $ */ /*- @@ -585,14 +585,17 @@ check_eh(sc, eh, to_bpf) * Receiving all packets. These need to be passed on to BPF. */ #if NBPFILTER > 0 - *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0); + *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0) || + (sc->sc_arpcom.ac_if.if_bridge != NULL); +#else + *to_bpf = (sc->sc_arpcom.ac_if.if_bridge != NULL); #endif /* If for us, accept and hand up to BPF */ if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) return 1; #if NBPFILTER > 0 - if (*to_bpf) + if (*to_bpf && sc->sc_arpcom.ac_if.if_bridge == NULL) *to_bpf = 2; /* we don't need to see it */ #endif @@ -624,7 +627,10 @@ check_eh(sc, eh, to_bpf) * time. Whew! (Hope this is a fast machine...) */ #if NBPFILTER > 0 - *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0); + *to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0) || + (sc->sc_arpcom.ac_if.if_bridge != NULL); +#else + *to_bpf = (sc->sc_arpcom.ac_if.if_bridge != NULL); #endif /* We want to see multicasts. */ if (eh->ether_dhost[0] & 1) @@ -636,7 +642,7 @@ check_eh(sc, eh, to_bpf) /* Anything else goes to BPF but nothing else. */ #if NBPFILTER > 0 - if (*to_bpf) + if (*to_bpf && sc->sc_arpcom.ac_if.if_bridge == NULL) *to_bpf = 2; #endif return 1; diff --git a/sys/arch/vax/if/if_qe.c b/sys/arch/vax/if/if_qe.c index 0ba98510161..b114420e4d1 100644 --- a/sys/arch/vax/if/if_qe.c +++ b/sys/arch/vax/if/if_qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_qe.c,v 1.9 1997/09/10 08:28:41 maja Exp $ */ +/* $OpenBSD: if_qe.c,v 1.10 1999/05/13 15:44:50 jason Exp $ */ /* $NetBSD: if_qe.c,v 1.22 1997/05/02 17:11:24 ragge Exp $ */ /* @@ -1037,19 +1037,6 @@ if (m) { /* Pass it up */ bpf_mtap(sc->qe_if.if_bpf, &m0); - - /* - * Note that the interface cannot be in promiscuous mode if - * there are no BPF listeners. And if we are in promiscuous - * mode, we have to check if this packet is really ours. - */ - if ((ifp->if_flags & IFF_PROMISC) && - (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(eh->ether_dhost, sc->qe_addr, - sizeof(eh->ether_dhost)) != 0) { - m_freem(m); - return; - } } #endif /* NBPFILTER > 0 */ diff --git a/sys/arch/wgrisc/dev/if_sn.c b/sys/arch/wgrisc/dev/if_sn.c index cfc42bc59ac..6aacfb8c859 100644 --- a/sys/arch/wgrisc/dev/if_sn.c +++ b/sys/arch/wgrisc/dev/if_sn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sn.c,v 1.2 1999/01/11 05:12:10 millert Exp $ */ +/* $OpenBSD: if_sn.c,v 1.3 1999/05/13 15:44:50 jason Exp $ */ /* * National Semiconductor SONIC Driver * Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk) @@ -1201,18 +1201,11 @@ sonic_read(sc, rxp) #if NBPFILTER > 0 /* * Check if there's a bpf filter listening on this interface. - * If so, hand off the raw packet to enet, then discard things - * not destined for us (but be sure to keep broadcast/multicast). + * If so, hand off the raw packet to enet. */ - if (sc->sc_if.if_bpf) { + if (sc->sc_if.if_bpf) bpf_tap(sc->sc_if.if_bpf, pkt, len + sizeof(struct ether_header)); - if ((ifp->if_flags & IFF_PROMISC) != 0 && - (et->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */ - bcmp(et->ether_dhost, sc->sc_enaddr, - sizeof(et->ether_dhost)) != 0) - return; - } #endif m = sonic_get(sc, et, len); if (m == NULL) |