Sync with sys/i386/isa/if_ed.c revision 1.150.
This commit is contained in:
parent
6d2e2542e4
commit
0e2ac47664
@ -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,
|
||||
sizeof(eh->ether_dhost)) != 0 && multicast == 0) {
|
||||
m_freem(m);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#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;
|
||||
}
|
||||
|
||||
getit:
|
||||
/*
|
||||
* Remove link layer address.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user