Module Name: src
Committed By: martin
Date: Tue Nov 11 12:48:59 UTC 2014
Modified Files:
src/sys/arch/evbarm/awin [netbsd-7]: awin_machdep.c
Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #211):
sys/arch/evbarm/awin/awin_machdep.c: revision 1.27
get_bootconf_option doesnt return the value null-terminated, so look for an
awge0.mac-address value of exactly the correct length
To generate a diff of this commit:
cvs rdiff -u -r1.8.2.4 -r1.8.2.5 src/sys/arch/evbarm/awin/awin_machdep.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/arch/evbarm/awin/awin_machdep.c
diff -u src/sys/arch/evbarm/awin/awin_machdep.c:1.8.2.4 src/sys/arch/evbarm/awin/awin_machdep.c:1.8.2.5
--- src/sys/arch/evbarm/awin/awin_machdep.c:1.8.2.4 Sun Nov 9 14:42:33 2014
+++ src/sys/arch/evbarm/awin/awin_machdep.c Tue Nov 11 12:48:59 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_machdep.c,v 1.8.2.4 2014/11/09 14:42:33 martin Exp $ */
+/* $NetBSD: awin_machdep.c,v 1.8.2.5 2014/11/11 12:48:59 martin Exp $ */
/*
* Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_machdep.c,v 1.8.2.4 2014/11/09 14:42:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_machdep.c,v 1.8.2.5 2014/11/11 12:48:59 martin Exp $");
#include "opt_machdep.h"
#include "opt_ddb.h"
@@ -724,14 +724,18 @@ awin_device_register(device_t self, void
char *mac_addr;
snprintf(argname, sizeof(argname), "%s.mac-address",
device_xname(self));
+
if (get_bootconf_option(boot_args, argname,
- BOOTOPT_TYPE_STRING, &mac_addr) &&
- ether_aton_r(enaddr, sizeof(enaddr), mac_addr) == 0) {
- prop_data_t pd;
- pd = prop_data_create_data(enaddr, sizeof(enaddr));
- KASSERT(pd != NULL);
- prop_dictionary_set(dict, "mac-address", pd);
- prop_object_release(pd);
+ BOOTOPT_TYPE_STRING, &mac_addr)) {
+ char mac[strlen("XX:XX:XX:XX:XX:XX") + 1];
+ strlcpy(mac, mac_addr, sizeof(mac));
+ if (!ether_aton_r(enaddr, sizeof(enaddr), mac)) {
+ prop_data_t pd;
+ pd = prop_data_create_data(enaddr, sizeof(enaddr));
+ KASSERT(pd != NULL);
+ prop_dictionary_set(dict, "mac-address", pd);
+ prop_object_release(pd);
+ }
}
#if AWIN_board == AWIN_cubieboard