changeset 4172:a08c5d71a686

6490981 netstrategy continues to report empty strings for dhcp'd interfaces even after a driver is added
author setje
date Fri, 04 May 2007 14:25:21 -0700
parents 22b5de9a99d1
children dd63c52d1998
files usr/src/uts/common/io/strplumb.c usr/src/uts/common/syscall/systeminfo.c usr/src/uts/sparc/ml/modstubs.s usr/src/uts/sun/sys/bootconf.h
diffstat 4 files changed, 24 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/strplumb.c	Fri May 04 14:10:43 2007 -0700
+++ b/usr/src/uts/common/io/strplumb.c	Fri May 04 14:25:21 2007 -0700
@@ -667,9 +667,12 @@
     uint_t service, uint_t conn_mgmt);
 int dl_phys_addr(ldi_handle_t lh, struct ether_addr *eaddr);
 
+#endif  /* !__sparc */
+
 char *
 strplumb_get_netdev_path(void)
 {
+#ifndef	__sparc
 	char *macstr, *devpath = NULL;
 	uchar_t *bootp;
 	uint_t bootp_len, len;
@@ -710,8 +713,14 @@
 
 	ddi_walk_devs(ddi_root_node(), matchmac, (void *)&devpath);
 	return (devpath);
+
+#else
+	return (NULL);
+#endif  /* !__sparc */
 }
 
+#ifndef __sparc
+
 /*
  * Get boot path from the boot_mac address
  */
--- a/usr/src/uts/common/syscall/systeminfo.c	Fri May 04 14:10:43 2007 -0700
+++ b/usr/src/uts/common/syscall/systeminfo.c	Fri May 04 14:25:21 2007 -0700
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -147,10 +147,20 @@
 			strcnt = 0;
 		} else {
 			/*
+			 * If the interface didn't have a name (bindable
+			 * driver) to begin with, it might have one now.
+			 * So, re-run strplumb_get_netdev_path() to see
+			 * if one can be established at this time.
+			 */
+			if (netdev_path == NULL || netdev_path[0] == '\0') {
+				netdev_path = strplumb_get_netdev_path();
+			}
+			/*
 			 * If the interface name has not yet been resolved
 			 * (first IFNAMSIZ bytes of dhcack[]) and a valid
 			 * netdev_path[] was stashed by loadrootmodules in
-			 * swapgeneric.c, resolve the interface name now.
+			 * swapgeneric.c, or established above, resolve
+			 * the interface name now.
 			 */
 			if (dhcack[0] == '\0' &&
 			    netdev_path != NULL && netdev_path[0] != '\0') {
--- a/usr/src/uts/sparc/ml/modstubs.s	Fri May 04 14:10:43 2007 -0700
+++ b/usr/src/uts/sparc/ml/modstubs.s	Fri May 04 14:25:21 2007 -0700
@@ -731,6 +731,7 @@
 	MODULE(strplumb,misc);
 	STUB(strplumb, strplumb,     0);
 	STUB(strplumb, strplumb_load, 0);
+	STUB(strplumb, strplumb_get_netdev_path, 0)
 	END_MODULE(strplumb);
 #endif
 
--- a/usr/src/uts/sun/sys/bootconf.h	Fri May 04 14:10:43 2007 -0700
+++ b/usr/src/uts/sun/sys/bootconf.h	Fri May 04 14:25:21 2007 -0700
@@ -245,6 +245,8 @@
 extern char *dhcack;
 extern char *netdev_path;
 
+extern char *strplumb_get_netdev_path(void);
+
 #endif /* _KERNEL && !_BOOT */
 
 #ifdef __cplusplus