summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2006-08-06 06:18:29 +0000
committerBrad Smith <brad@cvs.openbsd.org>2006-08-06 06:18:29 +0000
commit19696b1f73c2f40828f407f3c2df91b6d14956fa (patch)
tree85f0854310d4a5c670a843f06f215c86d4968ee1 /sys
parent6212b26b5364893376ffdd7b2b566dbc89c6c625 (diff)
fix swapping of the station address for big-endian archs.
From yongari@FreeBSD
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/re.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c
index 55ae6de6ec2..df6b68ae203 100644
--- a/sys/dev/ic/re.c
+++ b/sys/dev/ic/re.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: re.c,v 1.41 2006/08/06 06:00:10 brad Exp $ */
+/* $OpenBSD: re.c,v 1.42 2006/08/06 06:18:28 brad Exp $ */
/* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */
/*
* Copyright (c) 1997, 1998-2003
@@ -280,7 +280,7 @@ re_read_eeprom(struct rl_softc *sc, caddr_t dest, int off, int cnt)
re_eeprom_getword(sc, off + i, &word);
CSR_CLRBIT_1(sc, RL_EECMD, RL_EE_SEL);
ptr = (u_int16_t *)(dest + (i * 2));
- *ptr = letoh16(word);
+ *ptr = word;
}
CSR_CLRBIT_1(sc, RL_EECMD, RL_EEMODE_PROGRAM);
@@ -750,7 +750,7 @@ int
re_attach(struct rl_softc *sc)
{
u_char eaddr[ETHER_ADDR_LEN];
- u_int16_t as[3];
+ u_int16_t as[ETHER_ADDR_LEN / 2];
struct ifnet *ifp;
u_int16_t re_did = 0;
int error = 0, i;
@@ -767,10 +767,9 @@ re_attach(struct rl_softc *sc)
* Get station address from the EEPROM.
*/
re_read_eeprom(sc, (caddr_t)as, RL_EE_EADDR, 3);
- for (i = 0; i < 3; i++) {
- eaddr[(i * 2) + 0] = as[i] & 0xff;
- eaddr[(i * 2) + 1] = as[i] >> 8;
- }
+ for (i = 0; i < ETHER_ADDR_LEN / 2; i++)
+ as[i] = letoh16(as[i]);
+ bcopy(as, eaddr, sizeof(eaddr));
/*
* Set RX length mask, TX poll request register