From 802cab03301817c260e733eadc53fceee9fa8170 Mon Sep 17 00:00:00 2001 From: Marius Strobl Date: Mon, 5 Dec 2005 12:32:20 +0000 Subject: [PATCH] - Rev. 1.175 fixed compilation on sparc64 but also backed out zeroing of the eaddr array (introduced in rev. 1.174) prior to writing to it. As dc_read_eeprom() is told to write only 3 16-bit words to eaddr but eaddr in fact is somewhat larger removal of the zeroing defeated the check whether the MAC address is all zero as there can be some random garbage in eaddr past the 3 words written to it and the check verifys all bits in eaddr. Solve this by changing the check to verify only the 3 words (happenning to be ETHER_ADDR_LEN bytes) written to eaddr. - While here change the notation of "FCode" in a nearby comment to the official way. Ok'ed by: marcel, ru --- sys/dev/dc/if_dc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c index 91d08d38af8b..bf1d86d8a621 100644 --- a/sys/dev/dc/if_dc.c +++ b/sys/dev/dc/if_dc.c @@ -2064,12 +2064,9 @@ dc_attach(device_t dev) #ifdef __sparc64__ /* * If this is an onboard dc(4) the station address read from - * the EEPROM is all zero and we have to get it from the fcode. + * the EEPROM is all zero and we have to get it from the FCode. */ - for (i = 0; i < (ETHER_ADDR_LEN+3)/4; i++) - if (eaddr[i] != 0) - break; - if (i >= (ETHER_ADDR_LEN+3)/4) + if (eaddr[0] == 0 && (eaddr[1] & ~0xffff) == 0) OF_getetheraddr(dev, (caddr_t)&eaddr); #endif break;