summaryrefslogtreecommitdiffstats
path: root/sys/pc98
diff options
context:
space:
mode:
authorkato <kato@FreeBSD.org>1999-03-19 16:01:34 +0000
committerkato <kato@FreeBSD.org>1999-03-19 16:01:34 +0000
commit0e2ac47664bf3d4ec2ff3d8157194116f2105746 (patch)
tree73560e89340783c8ba143742b238fd6b13919d7f /sys/pc98
parent6d2e2542e45aef71a10578fee59c55579e7af8f1 (diff)
downloadFreeBSD-src-0e2ac47664bf3d4ec2ff3d8157194116f2105746.zip
FreeBSD-src-0e2ac47664bf3d4ec2ff3d8157194116f2105746.tar.gz
Sync with sys/i386/isa/if_ed.c revision 1.150.
Diffstat (limited to 'sys/pc98')
-rw-r--r--sys/pc98/pc98/if_ed.c73
1 files changed, 59 insertions, 14 deletions
diff --git a/sys/pc98/pc98/if_ed.c b/sys/pc98/pc98/if_ed.c
index 5ce5e48..b71f68e 100644
--- a/sys/pc98/pc98/if_ed.c
+++ b/sys/pc98/pc98/if_ed.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: if_ed.c,v 1.59 1999/01/27 11:05:12 kato Exp $
+ * $Id: if_ed.c,v 1.60 1999/01/28 09:19:16 kato Exp $
*/
/*
@@ -90,6 +90,10 @@
#if NBPFILTER > 0
#include <net/bpf.h>
#endif
+#include "opt_bdg.h"
+#ifdef BRIDGE
+#include <net/bridge.h>
+#endif
#include <machine/clock.h>
#include <machine/md_var.h>
@@ -3003,6 +3007,13 @@ ed_rint(sc)
len += ((packet_hdr.next_packet - sc->rec_page_start) +
(sc->rec_page_stop - sc->next_packet)) * ED_PAGE_SIZE;
}
+ /*
+ * because buffers are aligned on 256-byte boundary,
+ * the length computed above is off by 256 in almost
+ * all cases. Fix it...
+ */
+ if (len & 0xff)
+ len -= 256 ;
if (len > (ETHER_MAX_LEN - ETHER_CRC_LEN
+ sizeof(struct ed_ring)))
sc->mibdata.dot3StatsFrameTooLongs++;
@@ -3481,6 +3492,42 @@ ed_get_packet(sc, buf, len, multicast)
m->m_data += 2;
eh = mtod(m, struct ether_header *);
+#ifdef BRIDGE
+ /*
+ * Get link layer header, invoke brige_in, then
+ * depending on the outcome of the test fetch the rest of the
+ * packet and either pass up or call bdg_forward.
+ */
+ if (do_bridge) {
+ struct ifnet *ifp ;
+ int need_more = 1 ; /* in case not bpf */
+
+#if NBPFILTER > 0
+ if (sc->arpcom.ac_if.if_bpf) {
+ need_more = 0 ;
+ ed_ring_copy(sc, buf, (char *)eh, len);
+ bpf_mtap(&sc->arpcom.ac_if, m);
+ } else
+#endif
+ ed_ring_copy(sc, buf, (char *)eh, 14);
+ ifp = bridge_in(m);
+ if (ifp == BDG_DROP) {
+ m_freem(m);
+ return ;
+ }
+ /* else fetch rest of pkt and continue */
+ if (need_more && len > 14)
+ ed_ring_copy(sc, buf+14, (char *)(eh+1), len - 14);
+ 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 ;
+ }
+#endif
/*
* Get packet, including link layer address, from interface.
*/
@@ -3492,23 +3539,21 @@ ed_get_packet(sc, buf, len, multicast)
* Check if there's a BPF listener on this interface. If so, hand off
* the raw packet to bpf.
*/
- if (sc->arpcom.ac_if.if_bpf) {
+ if (sc->arpcom.ac_if.if_bpf)
bpf_mtap(&sc->arpcom.ac_if, 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->arpcom.ac_if.if_flags & IFF_PROMISC) &&
- bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr,
+#endif
+ /*
+ * If we are in promiscuous mode, we have to check whether
+ * this packet is really for us.
+ */
+ if ((sc->arpcom.ac_if.if_flags & IFF_PROMISC) &&
+ bcmp(eh->ether_dhost, sc->arpcom.ac_enaddr,
sizeof(eh->ether_dhost)) != 0 && multicast == 0) {
- m_freem(m);
- return;
- }
+ m_freem(m);
+ return;
}
-#endif
+getit:
/*
* Remove link layer address.
*/
OpenPOWER on IntegriCloud