summaryrefslogtreecommitdiffstats
path: root/sys/i386/boot/netboot
diff options
context:
space:
mode:
authormartin <martin@FreeBSD.org>1996-12-11 19:33:38 +0000
committermartin <martin@FreeBSD.org>1996-12-11 19:33:38 +0000
commit04f954db47add4c442bfc5ab23e5bfb3ec166ced (patch)
treeec9235a9e68c0ab3995961a5b07be00c029ecf45 /sys/i386/boot/netboot
parent7ae38829d76c8970647b1c9c82d59ea2f05a4057 (diff)
downloadFreeBSD-src-04f954db47add4c442bfc5ab23e5bfb3ec166ced.zip
FreeBSD-src-04f954db47add4c442bfc5ab23e5bfb3ec166ced.tar.gz
Two fixes:
makerom checksum check calculation was a no-op nb8390.c had a bug which caused packet_len to be incorrect for packets which wrapped in the buffer. Submitted by: Linux developers (I lost the email with their names)
Diffstat (limited to 'sys/i386/boot/netboot')
-rw-r--r--sys/i386/boot/netboot/makerom.c4
-rw-r--r--sys/i386/boot/netboot/ns8390.c10
2 files changed, 7 insertions, 7 deletions
diff --git a/sys/i386/boot/netboot/makerom.c b/sys/i386/boot/netboot/makerom.c
index 715e9b7..b5b1008 100644
--- a/sys/i386/boot/netboot/makerom.c
+++ b/sys/i386/boot/netboot/makerom.c
@@ -36,9 +36,9 @@ main(argc,argv)
for (i=0,sum=0; i<ROMSIZE; i++)
sum += rom[i];
rom[5] = -sum;
- for (i=0,sum=0; i<ROMSIZE; i++);
+ for (i=0,sum=0; i<ROMSIZE; i++)
sum += rom[i];
- if (sum)
+ if (sum & 0x00FF)
printf("checksum fails.\n");
if (lseek(fd, (off_t)0, SEEK_SET) < 0) {
perror("unable to seek");
diff --git a/sys/i386/boot/netboot/ns8390.c b/sys/i386/boot/netboot/ns8390.c
index 4019bd2..8336174 100644
--- a/sys/i386/boot/netboot/ns8390.c
+++ b/sys/i386/boot/netboot/ns8390.c
@@ -489,7 +489,7 @@ eth_poll()
int ret = 0;
unsigned short type = 0;
unsigned char bound,curr,rstat;
- unsigned short len;
+ unsigned short len, copylen;
unsigned short pktoff;
unsigned char *p;
struct ringbuffer pkthdr;
@@ -528,7 +528,7 @@ eth_poll()
bound = pkthdr.bound; /* New bound ptr */
if ( (pkthdr.status & D8390_RSTAT_PRX) && (len > 14) && (len < 1518)) {
p = packet;
- packetlen = len;
+ packetlen = copylen = len;
len = (eth_memsize << 8) - pktoff;
if (packetlen > len) { /* We have a wrap-around */
if (eth_flags & FLAG_PIO)
@@ -537,12 +537,12 @@ eth_poll()
bcopy(eth_rmem + pktoff, p, len);
pktoff = (eth_tx_start + D8390_TXBUF_SIZE) << 8;
p += len;
- packetlen -= len;
+ copylen -= len;
}
if (eth_flags & FLAG_PIO)
- eth_pio_read(pktoff, p, packetlen);
+ eth_pio_read(pktoff, p, copylen);
else
- bcopy(eth_rmem + pktoff, p, packetlen);
+ bcopy(eth_rmem + pktoff, p, copylen);
type = (packet[12]<<8) | packet[13];
ret = 1;
OpenPOWER on IntegriCloud