hyperv/kvp: Fix IPv4/IPv6 address injection support.
The GUID string provided by hypervisor has leading and trailing braces, while our GUID string does not have braces at all. Both braces should be ignored, when the GUID strings are compared. Submitted by: Hongjiang Zhang <honzhan microsoft com> Modified by: sephe MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7809
This commit is contained in:
parent
a74e025394
commit
74decee899
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=305585
@ -332,20 +332,23 @@ hv_kvp_convert_utf16_ipinfo_to_utf8(struct hv_kvp_ip_msg *host_ip_msg,
|
||||
|
||||
if (devclass_get_devices(devclass_find("hn"), &devs, &devcnt) == 0) {
|
||||
for (devcnt = devcnt - 1; devcnt >= 0; devcnt--) {
|
||||
/* XXX access other driver's softc? are you kidding? */
|
||||
device_t dev = devs[devcnt];
|
||||
struct vmbus_channel *chan;
|
||||
char buf[HYPERV_GUID_STRLEN];
|
||||
int n;
|
||||
|
||||
chan = vmbus_get_channel(dev);
|
||||
n = hyperv_guid2str(vmbus_chan_guid_inst(chan), buf,
|
||||
sizeof(buf));
|
||||
|
||||
/*
|
||||
* Trying to find GUID of Network Device
|
||||
* The string in the 'kvp_ip_val.adapter_id' has
|
||||
* braces around the GUID; skip the leading brace
|
||||
* in 'kvp_ip_val.adapter_id'.
|
||||
*/
|
||||
chan = vmbus_get_channel(dev);
|
||||
hyperv_guid2str(vmbus_chan_guid_inst(chan),
|
||||
buf, sizeof(buf));
|
||||
|
||||
if (strncmp(buf, (char *)umsg->body.kvp_ip_val.adapter_id,
|
||||
HYPERV_GUID_STRLEN - 1) == 0) {
|
||||
if (strncmp(buf,
|
||||
((char *)&umsg->body.kvp_ip_val.adapter_id) + 1,
|
||||
n) == 0) {
|
||||
strlcpy((char *)umsg->body.kvp_ip_val.adapter_id,
|
||||
device_get_nameunit(dev), MAX_ADAPTER_ID_SIZE);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user