Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mac68k/dev Fix a couple of problems from the ether_...



details:   https://anonhg.NetBSD.org/src/rev/2017c18b4e98
branches:  trunk
changeset: 473146:2017c18b4e98
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri May 21 21:48:28 1999 +0000

description:
Fix a couple of problems from the ether_input() change:
- Make it compile again, with BPF.
- Don't subtract the Ethernet header length from the total packet length.
- Copy the alignment fix from sys/dev/ic/i82586.c (though the m68k shouldn't
  really be affected).

diffstat:

 sys/arch/mac68k/dev/if_sn.c |  20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diffs (48 lines):

diff -r 65d3bd01ce97 -r 2017c18b4e98 sys/arch/mac68k/dev/if_sn.c
--- a/sys/arch/mac68k/dev/if_sn.c       Fri May 21 21:33:59 1999 +0000
+++ b/sys/arch/mac68k/dev/if_sn.c       Fri May 21 21:48:28 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sn.c,v 1.21 1999/05/18 23:52:53 thorpej Exp $       */
+/*     $NetBSD: if_sn.c,v 1.22 1999/05/21 21:48:28 thorpej Exp $       */
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -1019,8 +1019,7 @@
 
                orra = RBASEQ(SRO(bitmode, rda, RXPKT_SEQNO)) & RRAMASK;
                rxpkt_ptr = SRO(bitmode, rda, RXPKT_PTRLO);
-               len = SRO(bitmode, rda, RXPKT_BYTEC) -
-                       sizeof(struct ether_header) - FCSSIZE;
+               len = SRO(bitmode, rda, RXPKT_BYTEC) - FCSSIZE;
                if (status & RCR_PRX) {
                        caddr_t pkt =
                            sc->rbuf[orra & RBAMASK] + (rxpkt_ptr & PGOFSET);
@@ -1130,9 +1129,9 @@
        if (ifp->if_bpf) {
                bpf_tap(ifp->if_bpf, pkt, len);
                if ((ifp->if_flags & IFF_PROMISC) != 0 &&
-                   (et->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
-                   bcmp(et->ether_dhost, LLADDR(ifp->if_sadl),
-                   sizeof(et->ether_dhost)) != 0)
+                   (eh->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
+                   bcmp(eh->ether_dhost, LLADDR(ifp->if_sadl),
+                   sizeof(eh->ether_dhost)) != 0)
                        return (0);
        }
 #endif
@@ -1181,6 +1180,15 @@
                        }
                        len = MCLBYTES;
                }
+
+               if (mp == &top) {
+                       caddr_t newdata = (caddr_t)
+                           ALIGN(m->m_data + sizeof(struct ether_header)) -
+                           sizeof(struct ether_header);
+                       len -= newdata - m->m_data; 
+                       m->m_data = newdata;
+               }
+
                m->m_len = len = min(datalen, len);
 
                bcopy(pkt, mtod(m, caddr_t), (unsigned) len);



Home | Main Index | Thread Index | Old Index