If we fail to read the Ethernet address from the card, just print an

warning message and attach without setting the Ethernet address to a
random address.  It is not believed that this code can actually be
executed, and if it does, we're better off printing an error message than
faking up an Ethernet address.

PR:		kern/133239
Reviewed by:	yongari (earlier version of patch)
Approved by:	ed (mentor)
This commit is contained in:
Gavin Atkinson 2010-01-08 10:32:27 +00:00
parent cb7667d0f6
commit 51d930e747
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=201781

View File

@ -462,15 +462,7 @@ jme_reg_macaddr(struct jme_softc *sc)
if ((par0 == 0 && par1 == 0) ||
(par0 == 0xFFFFFFFF && par1 == 0xFFFF)) {
device_printf(sc->jme_dev,
"generating fake ethernet address.\n");
par0 = arc4random();
/* Set OUI to JMicron. */
sc->jme_eaddr[0] = 0x02; /* U/L bit set. */
sc->jme_eaddr[1] = 0x1B;
sc->jme_eaddr[2] = 0x8C;
sc->jme_eaddr[3] = (par0 >> 16) & 0xff;
sc->jme_eaddr[4] = (par0 >> 8) & 0xff;
sc->jme_eaddr[5] = par0 & 0xff;
"Failed to retrieve Ethernet address.\n");
} else {
sc->jme_eaddr[0] = (par0 >> 0) & 0xFF;
sc->jme_eaddr[1] = (par0 >> 8) & 0xFF;