Page MenuHomeFreeBSD

D19856.diff
No OneTemporary

D19856.diff

Index: head/sys/dev/usb/net/if_ure.c
===================================================================
--- head/sys/dev/usb/net/if_ure.c
+++ head/sys/dev/usb/net/if_ure.c
@@ -62,6 +62,9 @@
"Debug level");
#endif
+#define ETHER_IS_ZERO(addr) \
+ (!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]))
+
/*
* Various supported device vendors/products.
*/
@@ -673,12 +676,20 @@
else
ure_rtl8153_init(sc);
- if (sc->sc_chip & URE_CHIP_VER_4C00)
+ if ((sc->sc_chip & URE_CHIP_VER_4C00) ||
+ (sc->sc_chip & URE_CHIP_VER_4C10))
ure_read_mem(sc, URE_PLA_IDR, URE_MCU_TYPE_PLA,
ue->ue_eaddr, 8);
else
ure_read_mem(sc, URE_PLA_BACKUP, URE_MCU_TYPE_PLA,
ue->ue_eaddr, 8);
+
+ if (ETHER_IS_ZERO(sc->sc_ue.ue_eaddr)) {
+ device_printf(sc->sc_ue.ue_dev, "MAC assigned randomly\n");
+ arc4rand(sc->sc_ue.ue_eaddr, ETHER_ADDR_LEN, 0);
+ sc->sc_ue.ue_eaddr[0] &= ~0x01; /* unicast */
+ sc->sc_ue.ue_eaddr[0] |= 0x02; /* locally administered */
+ }
}
static int
@@ -724,8 +735,10 @@
ure_reset(sc);
/* Set MAC address. */
+ ure_write_1(sc, URE_PLA_CRWECR, URE_MCU_TYPE_PLA, URE_CRWECR_CONFIG);
ure_write_mem(sc, URE_PLA_IDR, URE_MCU_TYPE_PLA | URE_BYTE_EN_SIX_BYTES,
IF_LLADDR(ifp), 8);
+ ure_write_1(sc, URE_PLA_CRWECR, URE_MCU_TYPE_PLA, URE_CRWECR_NORAML);
/* Reset the packet filter. */
ure_write_2(sc, URE_PLA_FMC, URE_MCU_TYPE_PLA,

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 10, 10:25 PM (15 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15747339
Default Alt Text
D19856.diff (1 KB)

Event Timeline