diff options
author | archie <archie@FreeBSD.org> | 2000-05-14 02:18:43 +0000 |
---|---|---|
committer | archie <archie@FreeBSD.org> | 2000-05-14 02:18:43 +0000 |
commit | fa21035b4e2f11d2c8f90174690853600b670e2d (patch) | |
tree | 9afb8dacfff6d7607064d8aa2bbf2da5069e8be6 /sys/dev/fe | |
parent | d066b073153b986a54fd18a31d6bcc5d697933a2 (diff) | |
download | FreeBSD-src-fa21035b4e2f11d2c8f90174690853600b670e2d.zip FreeBSD-src-fa21035b4e2f11d2c8f90174690853600b670e2d.tar.gz |
Move code to handle BPF and bridging for incoming Ethernet packets out
of the individual drivers and into the common routine ether_input().
Also, remove the (incomplete) hack for matching ethernet headers
in the ip_fw code.
The good news: net result of 1016 lines removed, and this should make
bridging now work with *all* Ethernet drivers.
The bad news: it's nearly impossible to test every driver, especially
for bridging, and I was unable to get much testing help on the mailing
lists.
Reviewed by: freebsd-net
Diffstat (limited to 'sys/dev/fe')
-rw-r--r-- | sys/dev/fe/if_fe.c | 62 |
1 files changed, 1 insertions, 61 deletions
diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c index ac0d57f..821c80b 100644 --- a/sys/dev/fe/if_fe.c +++ b/sys/dev/fe/if_fe.c @@ -66,7 +66,6 @@ * cons of multiple frame transmission. * o To test IPX codes. * o To test FreeBSD3.0-current. - * o To test BRIDGE codes. */ #include "fe.h" @@ -92,10 +91,6 @@ #include <net/bpf.h> -#ifdef BRIDGE -#include <net/bridge.h> -#endif - #include <machine/clock.h> #include <i386/isa/isa_device.h> @@ -3819,7 +3814,7 @@ fe_ioctl ( struct ifnet * ifp, u_long command, caddr_t data ) /* * Retrieve packet from receive buffer and send to the next level up via - * ether_input(). If there is a BPF listener, give a copy to BPF, too. + * ether_input(). * Returns 0 if success, -1 if error (i.e., mbuf allocation failure). */ static int @@ -3897,61 +3892,6 @@ fe_get_packet ( struct fe_softc * sc, u_short len ) insw( sc->ioaddr[ FE_BMPR8 ], eh, ( len + 1 ) >> 1 ); } -#define ETHER_ADDR_IS_MULTICAST(A) (*(char *)(A) & 1) - - /* - * Check if there's a BPF listener on this interface. - * If it is, hand off the raw packet to bpf. - */ - if ( sc->sc_if.if_bpf ) { - bpf_mtap( &sc->sc_if, m ); - } - -#ifdef BRIDGE - if (do_bridge) { - struct ifnet *ifp; - - ifp = bridge_in(m); - if (ifp == BDG_DROP) { - m_freem(m); - return 0; - } - if (ifp != BDG_LOCAL) - bdg_forward(&m, ifp); /* not local, need forwarding */ - if (ifp == BDG_LOCAL || ifp == BDG_BCAST || ifp == BDG_MCAST) - goto getit; - /* not local and not multicast, just drop it */ - if (m) - m_freem(m); - return 0; - } -#endif - - /* - * Make sure this packet is (or may be) directed to us. - * That is, the packet is either unicasted to our address, - * or broad/multi-casted. If any other packets are - * received, it is an indication of an error -- probably - * 86960 is in a wrong operation mode. - * Promiscuous mode is an exception. Under the mode, all - * packets on the media must be received. (We must have - * programmed the 86960 so.) - */ - - if ( ( sc->sc_if.if_flags & IFF_PROMISC ) - && !ETHER_ADDR_IS_MULTICAST( eh->ether_dhost ) - && bcmp( eh->ether_dhost, sc->sc_enaddr, ETHER_ADDR_LEN ) != 0 ) { - /* - * The packet was not for us. This is normal since - * we are now in promiscuous mode. Just drop the packet. - */ - m_freem( m ); - return 0; - } - -#ifdef BRIDGE -getit: -#endif /* Strip off the Ethernet header. */ m->m_pkthdr.len -= sizeof ( struct ether_header ); m->m_len -= sizeof ( struct ether_header ); |