diff options
author | ghelmer <ghelmer@FreeBSD.org> | 1999-04-16 01:56:06 +0000 |
---|---|---|
committer | ghelmer <ghelmer@FreeBSD.org> | 1999-04-16 01:56:06 +0000 |
commit | 1a09e8bbc5d9ff2c2437a1df7a2d8962648e3143 (patch) | |
tree | 1cf502f82f83e1969979a78f532da163ae33d7a4 /sys/pci/if_xl.c | |
parent | ab4a6b37f8bae3dee3c6dae024ed0fdc888e4a43 (diff) | |
download | FreeBSD-src-1a09e8bbc5d9ff2c2437a1df7a2d8962648e3143.zip FreeBSD-src-1a09e8bbc5d9ff2c2437a1df7a2d8962648e3143.tar.gz |
Add bridging support (tested in 3.1-RELEASE by Steven Vetzal
<svetzal@icom.ca>).
Diffstat (limited to 'sys/pci/if_xl.c')
-rw-r--r-- | sys/pci/if_xl.c | 54 |
1 files changed, 41 insertions, 13 deletions
diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c index adf577e..d9b9e61 100644 --- a/sys/pci/if_xl.c +++ b/sys/pci/if_xl.c @@ -29,7 +29,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: if_xl.c,v 1.83 1999/04/15 02:34:54 wpaul Exp $ + * $Id: if_xl.c,v 1.30 1999/04/15 03:18:33 wpaul Exp $ */ /* @@ -107,6 +107,11 @@ #include <net/bpf.h> #endif +#include "opt_bdg.h" +#ifdef BRIDGE +#include <net/bridge.h> +#endif + #include <vm/vm.h> /* for vtophys */ #include <vm/pmap.h> /* for vtophys */ #include <machine/clock.h> /* for DELAY */ @@ -153,7 +158,7 @@ #if !defined(lint) static const char rcsid[] = - "$Id: if_xl.c,v 1.83 1999/04/15 02:34:54 wpaul Exp $"; + "$Id: if_xl.c,v 1.30 1999/04/15 03:18:33 wpaul Exp $"; #endif /* @@ -1920,24 +1925,47 @@ again: ifp->if_ipackets++; eh = mtod(m, struct ether_header *); m->m_pkthdr.rcvif = ifp; + m->m_pkthdr.len = m->m_len = total_len; #if NBPFILTER > 0 /* - * Handle BPF listeners. Let the BPF user see the packet, but - * don't pass it up to the ether_input() layer unless it's + * Handle BPF listeners. Let the BPF user see the packet. + */ + if (ifp->if_bpf) + bpf_mtap(ifp, m); +#endif +#ifdef BRIDGE + if (do_bridge) { + struct ifnet *bdg_ifp ; + bdg_ifp = bridge_in(m); + if (bdg_ifp == BDG_DROP) + goto dropit ; + if (bdg_ifp != BDG_LOCAL) + bdg_forward(&m, bdg_ifp); + if (bdg_ifp != BDG_LOCAL && + bdg_ifp != BDG_BCAST && + bdg_ifp != BDG_MCAST) + goto dropit ; + goto getit ; + } +#endif + /* + * Don't pass packet up to the ether_input() layer unless it's * a broadcast packet, multicast packet, matches our ethernet * address or the interface is in promiscuous mode. */ - if (ifp->if_bpf) { - m->m_pkthdr.len = m->m_len = total_len; - bpf_mtap(ifp, m); - if (ifp->if_flags & IFF_PROMISC && - (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, - ETHER_ADDR_LEN) && - (eh->ether_dhost[0] & 1) == 0)) { + if (ifp->if_flags & IFF_PROMISC && + (bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr, + ETHER_ADDR_LEN) && + (eh->ether_dhost[0] & 1) == 0)) { +#ifdef BRIDGE +dropit: +#endif + if (m) m_freem(m); - continue; - } + continue; } +#ifdef BRIDGE +getit: #endif /* Remove header from mbuf and pass it on. */ m->m_pkthdr.len = m->m_len = |