Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic if we dont have a mac address, make one up



details:   https://anonhg.NetBSD.org/src/rev/203d2f35150c
branches:  trunk
changeset: 804934:203d2f35150c
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Dec 07 02:23:14 2014 +0000

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

diffstat:

 sys/dev/ic/dwc_gmac.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r c341181b663b -r 203d2f35150c sys/dev/ic/dwc_gmac.c
--- a/sys/dev/ic/dwc_gmac.c     Sun Dec 07 02:01:51 2014 +0000
+++ b/sys/dev/ic/dwc_gmac.c     Sun Dec 07 02:23:14 2014 +0000
@@ -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 @@
 #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 @@
                    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;



Home | Main Index | Thread Index | Old Index