summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_mx.c
diff options
context:
space:
mode:
authorghelmer <ghelmer@FreeBSD.org>1999-04-16 01:56:06 +0000
committerghelmer <ghelmer@FreeBSD.org>1999-04-16 01:56:06 +0000
commit1a09e8bbc5d9ff2c2437a1df7a2d8962648e3143 (patch)
tree1cf502f82f83e1969979a78f532da163ae33d7a4 /sys/pci/if_mx.c
parentab4a6b37f8bae3dee3c6dae024ed0fdc888e4a43 (diff)
downloadFreeBSD-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_mx.c')
-rw-r--r--sys/pci/if_mx.c52
1 files changed, 40 insertions, 12 deletions
diff --git a/sys/pci/if_mx.c b/sys/pci/if_mx.c
index ef04460..9795c70 100644
--- a/sys/pci/if_mx.c
+++ b/sys/pci/if_mx.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_mx.c,v 1.39 1999/04/08 17:33:23 wpaul Exp $
+ * $Id: if_mx.c,v 1.13 1999/04/08 17:38:05 wpaul Exp $
*/
/*
@@ -76,6 +76,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 */
@@ -94,7 +99,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: if_mx.c,v 1.39 1999/04/08 17:33:23 wpaul Exp $";
+ "$Id: if_mx.c,v 1.13 1999/04/08 17:38:05 wpaul Exp $";
#endif
/*
@@ -1749,21 +1754,44 @@ static void mx_rxeof(sc)
#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) {
- 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_adj(m, sizeof(struct ether_header));
OpenPOWER on IntegriCloud