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 some broken packet length checks. R...



details:   https://anonhg.NetBSD.org/src/rev/07530a3eb4bd
branches:  trunk
changeset: 473203:07530a3eb4bd
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon May 24 21:53:42 1999 +0000

description:
Fix some broken packet length checks.  Really (no, I mean really) works now
after the ether_input() changes -- tested on my Quadra 650.

diffstat:

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

diffs (33 lines):

diff -r f42fc9c20aa9 -r 07530a3eb4bd sys/arch/mac68k/dev/if_sn.c
--- a/sys/arch/mac68k/dev/if_sn.c       Mon May 24 21:18:03 1999 +0000
+++ b/sys/arch/mac68k/dev/if_sn.c       Mon May 24 21:53:42 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sn.c,v 1.22 1999/05/21 21:48:28 thorpej Exp $       */
+/*     $NetBSD: if_sn.c,v 1.23 1999/05/24 21:53:42 thorpej Exp $       */
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -600,10 +600,10 @@
        SWO(sc->bitmode, txp, TXP_FRAGOFF + (0 * TXP_FRAGSIZE) + TXP_FPTRHI,
            UPPER(mtdp->mtd_vbuf));
 
-       if (totlen < ETHERMIN + sizeof(struct ether_header)) {
-               int pad = ETHERMIN + sizeof(struct ether_header) - totlen;
+       if (totlen < ETHERMIN + ETHER_HDR_LEN) {
+               int pad = ETHERMIN + ETHER_HDR_LEN - totlen;
                bzero(mtdp->mtd_buf + totlen, pad);
-               totlen = ETHERMIN + sizeof(struct ether_header);
+               totlen = ETHERMIN + ETHER_HDR_LEN;
        }
 
        SWO(sc->bitmode, txp, TXP_FRAGOFF + (0 * TXP_FRAGSIZE) + TXP_FSIZE,
@@ -1114,7 +1114,8 @@
        }
 #endif /* SNDEBUG */
 
-       if (len < ETHERMIN || len > ETHERMTU) {
+       if (len < (ETHER_MIN_LEN - ETHER_CRC_LEN) ||
+           len > (ETHER_MAX_LEN - ETHER_CRC_LEN)) {
                printf("%s: invalid packet length %d bytes\n",
                    sc->sc_dev.dv_xname, len);
                return (0);



Home | Main Index | Thread Index | Old Index