svn commit: r301022 - head/sys/dev/hyperv/utilities

Sepherosa Ziehau sephe at FreeBSD.org
Tue May 31 06:00:19 UTC 2016


Author: sephe
Date: Tue May 31 06:00:18 2016
New Revision: 301022
URL: https://svnweb.freebsd.org/changeset/base/301022

Log:
  hyperv/kvp: Use if_xname.
  
  MFC after:	1 week
  Sponsored by:	Microsoft OSTC
  Differential Revision:	https://reviews.freebsd.org/D6641

Modified:
  head/sys/dev/hyperv/utilities/hv_kvp.c

Modified: head/sys/dev/hyperv/utilities/hv_kvp.c
==============================================================================
--- head/sys/dev/hyperv/utilities/hv_kvp.c	Tue May 31 05:43:59 2016	(r301021)
+++ head/sys/dev/hyperv/utilities/hv_kvp.c	Tue May 31 06:00:18 2016	(r301022)
@@ -58,7 +58,10 @@ __FBSDID("$FreeBSD$");
 #include <sys/syslog.h>
 #include <sys/systm.h>
 #include <sys/mutex.h>
+
+#include <net/if.h>
 #include <net/if_arp.h>
+#include <net/if_var.h>
 
 #include <dev/hyperv/include/hyperv.h>
 #include <dev/hyperv/netvsc/hv_net_vsc.h>
@@ -306,7 +309,6 @@ hv_kvp_convert_utf16_ipinfo_to_utf8(stru
 	int UNUSED_FLAG = 1;
 	struct hv_device *hv_dev;       /* GUID Data Structure */
 	hn_softc_t *sc;                 /* hn softc structure  */
-	char if_name[4];
 	char buf[HYPERV_GUID_STRLEN];
 
 	device_t *devs;
@@ -336,11 +338,11 @@ hv_kvp_convert_utf16_ipinfo_to_utf8(stru
 			hv_dev = sc->hn_dev_obj;
 
 			hyperv_guid2str(&hv_dev->device_id, buf, sizeof(buf));
-			sprintf(if_name, "%s%d", "hn", device_get_unit(devs[devcnt]));
 
 			if (strncmp(buf, (char *)umsg->body.kvp_ip_val.adapter_id,
 			    HYPERV_GUID_STRLEN - 1) == 0) {
-				strcpy((char *)umsg->body.kvp_ip_val.adapter_id, if_name);
+				strlcpy((char *)umsg->body.kvp_ip_val.adapter_id,
+				    sc->hn_ifp->if_xname, MAX_ADAPTER_ID_SIZE);
 				break;
 			}
 		}


More information about the svn-src-all mailing list