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/950de6fda813
branches:  trunk
changeset: 334792:950de6fda813
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 08021c9c0a55 -r 950de6fda813 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