Module Name:    src
Committed By:   jmcneill
Date:           Sun Dec  7 02:23:14 UTC 2014

Modified Files:
        src/sys/dev/ic: dwc_gmac.c

Log Message:
if we dont have a mac address, make one up


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ic/dwc_gmac.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/dwc_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.28 src/sys/dev/ic/dwc_gmac.c:1.29
--- src/sys/dev/ic/dwc_gmac.c:1.28	Fri Nov 28 09:22:02 2014
+++ src/sys/dev/ic/dwc_gmac.c	Sun Dec  7 02:23:14 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.28 2014/11/28 09:22:02 martin Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.29 2014/12/07 02:23:14 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.28 2014/11/28 09:22:02 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.29 2014/12/07 02:23:14 jmcneill Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -53,6 +53,7 @@ __KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v
 #include <sys/intr.h>
 #include <sys/systm.h>
 #include <sys/sockio.h>
+#include <sys/cprng.h>
 
 #include <net/if.h>
 #include <net/if_ether.h>
@@ -162,9 +163,9 @@ dwc_gmac_attach(struct dwc_gmac_softc *s
 		    AWIN_GMAC_MAC_ADDR0HI);
 
 		if (maclo == 0xffffffff && (machi & 0xffff) == 0xffff) {
-			aprint_error_dev(sc->sc_dev,
-			    "couldn't read MAC address\n");
-			return;
+			/* fake MAC address */
+			maclo = 0x00f2 | (cprng_strong32() << 16);
+			machi = cprng_strong32();
 		}
 
 		enaddr[0] = maclo & 0x0ff;

Reply via email to