diff options
author | nsayer <nsayer@FreeBSD.org> | 1999-03-31 13:50:52 +0000 |
---|---|---|
committer | nsayer <nsayer@FreeBSD.org> | 1999-03-31 13:50:52 +0000 |
commit | 3a70671064d720ad2af4292f514b43494569d745 (patch) | |
tree | 009e154ed20d23b12f184da221b4181b3a9bae7e /sys/pci/if_tx.c | |
parent | 84a1abbf131ff8204f3aabd770abec06b1befa94 (diff) | |
download | FreeBSD-src-3a70671064d720ad2af4292f514b43494569d745.zip FreeBSD-src-3a70671064d720ad2af4292f514b43494569d745.tar.gz |
Add support for bridging to if_tx.c
PR: 10534
Submitted by: nsayer
Diffstat (limited to 'sys/pci/if_tx.c')
-rw-r--r-- | sys/pci/if_tx.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/sys/pci/if_tx.c b/sys/pci/if_tx.c index b6b7fc9..cd17237 100644 --- a/sys/pci/if_tx.c +++ b/sys/pci/if_tx.c @@ -1,5 +1,5 @@ /* $OpenBSD: if_tx.c,v 1.3 1998/10/10 04:30:09 jason Exp $ */ -/* $Id: if_tx.c,v 1.20 1998/12/14 06:32:56 dillon Exp $ */ +/* $Id: if_tx.c,v 1.22 1999/03/14 08:30:23 semenu Exp $ */ /*- * Copyright (c) 1997 Semen Ustimenko (semen@iclub.nsu.ru) @@ -69,6 +69,7 @@ #include "bpfilter.h" #include "pci.h" +#include "opt_bdg.h" #if NPCI > 0 #include <sys/param.h> @@ -135,6 +136,11 @@ #include <pci/pcivar.h> #include <pci/if_txvar.h> + +#ifdef BRIDGE +#include <net/bridge.h> +#endif + #endif #if defined(__FreeBSD__) @@ -921,7 +927,43 @@ epic_rx_done __P(( #else /* __OpenBSD__ */ bpf_mtap( sc->sc_if.if_bpf, m ); #endif /* __FreeBSD__ */ +#endif /* NBPFILTER */ + +#ifdef BRIDGE + if (do_bridge) { + struct ifnet *bdg_ifp ; + bdg_ifp = bridge_in(m); + if (bdg_ifp == BDG_DROP) { + if (m) + m_free(m); + continue; /* and drop */ + } + if (bdg_ifp != BDG_LOCAL) + bdg_forward(&m, bdg_ifp); + if (bdg_ifp != BDG_LOCAL && bdg_ifp != BDG_BCAST && + bdg_ifp != BDG_MCAST) { + if (m) + m_free(m); + continue; /* and drop */ + } + /* all others accepted locally */ + } +#endif +#if NBPFILTER > 0 +#ifdef BRIDGE + /* + * This deserves explanation + * If the bridge is _on_, then the following check + * must not be done because occasionally the bridge + * gets packets that are local but have the ethernet + * address of one of the other interfaces. + * + * But if the bridge is off, then we have to drop + * stuff that came in just via bpfilter. + */ + if (!do_bridge) +#endif /* Accept only our packets, broadcasts and multicasts */ if( (eh->ether_dhost[0] & 1) == 0 && bcmp(eh->ether_dhost,sc->sc_macaddr,ETHER_ADDR_LEN)){ |