Bug 1733165
Summary: | QEMU Guest Agent For Windows Return Garbled NIC Name | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 8 | Reporter: | Su, Jun-Ming <sujunmin> | ||||
Component: | virtio-win | Assignee: | Basil Salman <bsalman> | ||||
virtio-win sub component: | qemu-ga-win | QA Contact: | xiagao | ||||
Status: | CLOSED ERRATA | Docs Contact: | |||||
Severity: | unspecified | ||||||
Priority: | unspecified | CC: | ailan, bsalman, ghammer, haoliu, juzhang, kanderso, knoel, lijin, virt-maint, vrozenfe, xiagao, yvugenfi | ||||
Version: | 8.0 | ||||||
Target Milestone: | rc | ||||||
Target Release: | --- | ||||||
Hardware: | x86_64 | ||||||
OS: | Windows | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | |||||||
: | 1779878 (view as bug list) | Environment: | |||||
Last Closed: | 2020-02-04 12:27:28 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 1779878 | ||||||
Attachments: |
|
My first assessment looking at the QEMU gGuest Agent's Windows commands code is that the issue is related to a conflict in encoding and decoding the ifAlias of a network adapter which is in our case the same as the FriendlyName which name is assigned to. So in the QEMU Guest Agent code the decoding part is done using the code page CP_ACP (The system default Windows ANSI code page), it changes from machine to machine it is changeable, I think that a more concrete code page should be provided to be used in the decoding part of the ifAlias. More tests should be done, but for now this is my first assessment. Yes, and because of the non-latin windows the nic name will be named default by the locale preference (like in Chinese will be "區域連線" for Local Networks), maybe consider to make good usage for output encoding/decoding. The following is the part of code, WideCharToMultiByte() https://github.com/qemu/qemu/blob/629d166994725773dea9cef843fcb0ae5f3585fe/qga/commands-win32.c#L1394 Hi, I've test the thought that I describe before, and it will be fixed to do WideCharToMultiByte() twice. The code of qemu/qga/commands-win32.c should to be modified like this for supporting windows utf-8. static char *guest_wctomb_dup(WCHAR *wstr) { char *str = NULL; size_t i; i = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL); //i = wcslen(wstr) + 1; str = g_malloc(i+1); //WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, // wstr, -1, str, i, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, i, NULL, NULL); return str; } The record of this modification is the link https://gist.github.com/sujunmin/bff63c05df2541dcc5d71dbe04dc1609 Great work. I have tested the functionality with these changes, the name is returned correctly, (Unicode encoded format). But there is now the issue of the returned Chinese name being in a Unicode encoded format, so for a name like "喔喔喔" the returned value is {"name": "\u5594\u5594\u5594"} Is that the wanted behavior? or we need a double decoding? I need to clarify this. (In reply to Bishara AbuHattoum from comment #4) > Great work. > I have tested the functionality with these changes, the name is returned > correctly, (Unicode encoded format). > But there is now the issue of the returned Chinese name being in a Unicode > encoded format, so for a name like "喔喔喔" the returned value is {"name": > "\u5594\u5594\u5594"} > Is that the wanted behavior? or we need a double decoding? I need to clarify > this. I take what I said back, the returned value is correct. Will further test and send changes ASAP. Can reproduce with mingw-qemu-ga-win-100.0.0.0-3.el7ev The nic interface name in chinese is changed to "???" via "guest-network-get-interfaces" guest agent cmd. The following is the result of the NIC name in chinese, the first is "测试", the second is "红帽测试". {"execute":"guest-network-get-interfaces"} {"return": [{"name": "??", "ip-addresses": [{"ip-address-type": "ipv6", "ip-address": "2620:52:0:4948:4c3d:1085:dc2d:8584", "prefix": 64}, {"ip-address-type": "ipv6", "ip-address": "fe80::4c3d:1085:dc2d:8584%5", "prefix": 64}, {"ip-address-type": "ipv4", "ip-address": "10.73.75.113", "prefix": 22}], "statistics": {"tx-packets": 1189, "tx-errs": 0, "rx-bytes": 507263, "rx-dropped": 0, "rx-packets": 933, "rx-errs": 0, "tx-bytes": 299837, "tx-dropped": 0}, "hardware-address": "00:52:11:36:3f:00"}, {"name": "Loopback Pseudo-Interface 1", "ip-addresses": [{"ip-address-type": "ipv6", "ip-address": "::1", "prefix": 128}, {"ip-address-type": "ipv4", "ip-address": "127.0.0.1", "prefix": 8}], "statistics": {"tx-packets": 0, "tx-errs": 0, "rx-bytes": 0, "rx-dropped": 0, "rx-packets": 0, "rx-errs": 0, "tx-bytes": 0, "tx-dropped": 0}}]} {"execute":"guest-network-get-interfaces"} {"return": [{"name": "????", "ip-addresses": [{"ip-address-type": "ipv6", "ip-address": "2620:52:0:4948:4c3d:1085:dc2d:8584", "prefix": 64}, {"ip-address-type": "ipv6", "ip-address": "fe80::4c3d:1085:dc2d:8584%5", "prefix": 64}, {"ip-address-type": "ipv4", "ip-address": "10.73.75.113", "prefix": 22}], "statistics": {"tx-packets": 1210, "tx-errs": 0, "rx-bytes": 529955, "rx-dropped": 0, "rx-packets": 951, "rx-errs": 0, "tx-bytes": 304785, "tx-dropped": 0}, "hardware-address": "00:52:11:36:3f:00"}, {"name": "Loopback Pseudo-Interface 1", "ip-addresses": [{"ip-address-type": "ipv6", "ip-address": "::1", "prefix": 128}, {"ip-address-type": "ipv4", "ip-address": "127.0.0.1", "prefix": 8}], "statistics": {"tx-packets": 0, "tx-errs": 0, "rx-bytes": 0, "rx-dropped": 0, "rx-packets": 0, "rx-errs": 0, "tx-bytes": 0, "tx-dropped": 0}}]} (In reply to xiagao from comment #6) > Can reproduce with mingw-qemu-ga-win-100.0.0.0-3.el7ev > > The nic interface name in chinese is changed to "???" via > "guest-network-get-interfaces" guest agent cmd. > > The following is the result of the NIC name in chinese, the first is "测试", > the second is "红帽测试". > {"execute":"guest-network-get-interfaces"} > {"return": [{"name": "??", "ip-addresses": [{"ip-address-type": "ipv6", > "ip-address": "2620:52:0:4948:4c3d:1085:dc2d:8584", "prefix": 64}, > {"ip-address-type": "ipv6", "ip-address": "fe80::4c3d:1085:dc2d:8584%5", > "prefix": 64}, {"ip-address-type": "ipv4", "ip-address": "10.73.75.113", > "prefix": 22}], "statistics": {"tx-packets": 1189, "tx-errs": 0, "rx-bytes": > 507263, "rx-dropped": 0, "rx-packets": 933, "rx-errs": 0, "tx-bytes": > 299837, "tx-dropped": 0}, "hardware-address": "00:52:11:36:3f:00"}, {"name": > "Loopback Pseudo-Interface 1", "ip-addresses": [{"ip-address-type": "ipv6", > "ip-address": "::1", "prefix": 128}, {"ip-address-type": "ipv4", > "ip-address": "127.0.0.1", "prefix": 8}], "statistics": {"tx-packets": 0, > "tx-errs": 0, "rx-bytes": 0, "rx-dropped": 0, "rx-packets": 0, "rx-errs": 0, > "tx-bytes": 0, "tx-dropped": 0}}]} > {"execute":"guest-network-get-interfaces"} > {"return": [{"name": "????", "ip-addresses": [{"ip-address-type": "ipv6", > "ip-address": "2620:52:0:4948:4c3d:1085:dc2d:8584", "prefix": 64}, > {"ip-address-type": "ipv6", "ip-address": "fe80::4c3d:1085:dc2d:8584%5", > "prefix": 64}, {"ip-address-type": "ipv4", "ip-address": "10.73.75.113", > "prefix": 22}], "statistics": {"tx-packets": 1210, "tx-errs": 0, "rx-bytes": > 529955, "rx-dropped": 0, "rx-packets": 951, "rx-errs": 0, "tx-bytes": > 304785, "tx-dropped": 0}, "hardware-address": "00:52:11:36:3f:00"}, {"name": > "Loopback Pseudo-Interface 1", "ip-addresses": [{"ip-address-type": "ipv6", > "ip-address": "::1", "prefix": 128}, {"ip-address-type": "ipv4", > "ip-address": "127.0.0.1", "prefix": 8}], "statistics": {"tx-packets": 0, > "tx-errs": 0, "rx-bytes": 0, "rx-dropped": 0, "rx-packets": 0, "rx-errs": 0, > "tx-bytes": 0, "tx-dropped": 0}}]} Yes, we are aware of this issue. Sent changes patch to qemu-devel: https://lists.gnu.org/archive/html/qemu-devel/2019-08/msg03564.html The build with the fix: https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=995415 (In reply to Basil Salman from comment #8) > The build with the fix: > https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=995415 I test with this build,but still hit this issue,the network is named "测试". {"execute":"guest-network-get-interfaces"} {"return": [{"name": "??", "ip-addresses": [{"ip-address-type": "ipv6", "ip-address": "fe80::4450:cc:8d84:d48a%3", "prefix": 64}, {"ip-address-type": "ipv4", "ip-address": "10.73.75.87", "prefix": 22}], "statistics": {"tx-packets": 33518, "tx-errs": 0, "rx-bytes": 120006420, "rx-dropped": 0, "rx-packets": 61984, "rx-errs": 0, "tx-bytes": 8352964, "tx-dropped": 0}, "hardware-address": "00:52:11:36:3f:00"}, {"name": "Loopback Pseudo-Interface 1", "ip-addresses": [{"ip-address-type": "ipv6", "ip-address": "::1", "prefix": 128}, {"ip-address-type": "ipv4", "ip-address": "127.0.0.1", "prefix": 8}], "statistics": {"tx-packets": 0, "tx-errs": 0, "rx-bytes": 0, "rx-dropped": 0, "rx-packets": 0, "rx-errs": 0, "tx-bytes": 0, "tx-dropped": 0}}, {"name": "isatap.lab.eng.pek2.redhat.com", "ip-addresses": [{"ip-address-type": "ipv6", "ip-address": "fe80::5efe:10.73.75.87%7", "prefix": 128}], "statistics": {"tx-packets": 0, "tx-errs": 0, "rx-bytes": 0, "rx-dropped": 0, "rx-packets": 0, "rx-errs": 0, "tx-bytes": 0, "tx-dropped": 0}, "hardware-address": "00:00:00:00:00:00"}]} (In reply to Basil Salman from comment #8) > The build with the fix: > https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=995415 Hi, can this build be tested from others (like me)? I can access this site o get the build. Thanks. (In reply to xiagao from comment #10) > (In reply to Basil Salman from comment #8) > > The build with the fix: > > https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=995415 > > I test with this build,but still hit this issue,the network is named "测试". > > {"execute":"guest-network-get-interfaces"} > {"return": [{"name": "??", "ip-addresses": [{"ip-address-type": "ipv6", > "ip-address": "fe80::4450:cc:8d84:d48a%3", "prefix": 64}, > {"ip-address-type": "ipv4", "ip-address": "10.73.75.87", "prefix": 22}], > "statistics": {"tx-packets": 33518, "tx-errs": 0, "rx-bytes": 120006420, > "rx-dropped": 0, "rx-packets": 61984, "rx-errs": 0, "tx-bytes": 8352964, > "tx-dropped": 0}, "hardware-address": "00:52:11:36:3f:00"}, {"name": > "Loopback Pseudo-Interface 1", "ip-addresses": [{"ip-address-type": "ipv6", > "ip-address": "::1", "prefix": 128}, {"ip-address-type": "ipv4", > "ip-address": "127.0.0.1", "prefix": 8}], "statistics": {"tx-packets": 0, > "tx-errs": 0, "rx-bytes": 0, "rx-dropped": 0, "rx-packets": 0, "rx-errs": 0, > "tx-bytes": 0, "tx-dropped": 0}}, {"name": "isatap.lab.eng.pek2.redhat.com", > "ip-addresses": [{"ip-address-type": "ipv6", "ip-address": > "fe80::5efe:10.73.75.87%7", "prefix": 128}], "statistics": {"tx-packets": 0, > "tx-errs": 0, "rx-bytes": 0, "rx-dropped": 0, "rx-packets": 0, "rx-errs": 0, > "tx-bytes": 0, "tx-dropped": 0}, "hardware-address": "00:00:00:00:00:00"}]} Can you confirm this build fixes the issue: https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=1007350 I tested it myself with network name '喔喔喔' and i think that the issue is fixed: {"execute":"guest-network-get-interfaces"} {"return": [{"name": "\u5594\u5594\u5594", "ip-addresses": [{"ip-address-type": "ipv6", "ip-address": "fe80::64c5:2f6a:d6c2:4752%7", "prefix": 64}, {"ip-address-type": "ipv4", "ip-address": "10.0.1.2", "prefix": 16}], "statistics": {"tx-packets": 91746, "tx-errs": 0, "rx-bytes": 154917677, "rx-dropped": 0, "rx-packets": 92226, "rx-errs": 0, "tx-bytes": 10544102, "tx-dropped": 0}, "hardware-addre": "52:4c:c1:61:cc:c3"}, {"name": "Loopback Pseudo-Interface 1", "ip-addresses": [{"ip-address-type": "ipv6", "ip-address": "::1", "prefix": 128}, {"ip-address-type": "ipv4", "ip-address": "127.0.0.1 "prefix": 8}], "statistics": {"tx-packets": 0, "tx-errs": 0, "rx-bytes": 0, "rx-dropped": 0, "rx-packets": 0, "rx-errs": 0, "tx-bytes": 0, "tx-dropped": 0}}]} Verify this bug with mingw-qemu-ga-win-101.0.0.1-4.el7ev pkg. network name is "测试(ABCD)" {"execute":"guest-network-get-interfaces"} {"return": [{"name": "\u6D4B\u8BD5(ABCD)", "ip-addresses": [{"ip-address-type": "ipv6", "ip-address": "2620:52:0:4948:947c:6e7d:3d6c:864d", "prefix": 64}, {"ip-address-type": "ipv6", "ip-address": "fe80::947c:6e7d:3d6c:864d%14", "prefix": 64}, {"ip-address-type": "ipv4", "ip-address": "10.73.75.87", "prefix": 22}], "statistics": {"tx-packets": 3116, "tx-errs": 0, "rx-bytes": 7324880, "rx-dropped": 0, "rx-packets": 6768, "rx-errs": 0, "tx-bytes": 874122, "tx-dropped": 0}, "hardware-address": "00:52:11:36:3f:00"}, {"name": "Loopback Pseudo-Interface 1", "ip-addresses": [{"ip-address-type": "ipv6", "ip-address": "::1", "prefix": 128}, {"ip-address-type": "ipv4", "ip-address": "127.0.0.1", "prefix": 8}], "statistics": {"tx-packets": 0, "tx-errs": 0, "rx-bytes": 0, "rx-dropped": 0, "rx-packets": 0, "rx-errs": 0, "tx-bytes": 0, "tx-dropped": 0}}]}
> Can you confirm this build fixes the issue:
> https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=1007350
>
>
> I tested it myself with network name '喔喔喔' and i think that the issue is
> fixed:
> {"execute":"guest-network-get-interfaces"}
> {"return": [{"name": "\u5594\u5594\u5594", "ip-addresses":
> [{"ip-address-type": "ipv6", "ip-address": "fe80::64c5:2f6a:d6c2:4752%7",
> "prefix": 64}, {"ip-address-type": "ipv4", "ip-address": "10.0.1.2",
> "prefix": 16}], "statistics": {"tx-packets": 91746, "tx-errs": 0,
> "rx-bytes": 154917677, "rx-dropped": 0, "rx-packets": 92226, "rx-errs": 0,
> "tx-bytes": 10544102, "tx-dropped": 0}, "hardware-addre":
> "52:4c:c1:61:cc:c3"}, {"name": "Loopback Pseudo-Interface 1",
> "ip-addresses": [{"ip-address-type": "ipv6", "ip-address": "::1", "prefix":
> 128}, {"ip-address-type": "ipv4", "ip-address": "127.0.0.1 "prefix": 8}],
> "statistics": {"tx-packets": 0, "tx-errs": 0, "rx-bytes": 0, "rx-dropped":
> 0, "rx-packets": 0, "rx-errs": 0, "tx-bytes": 0, "tx-dropped": 0}}]}
I can not download this build, but it seems fixed for the result.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2020:0351 |
Created attachment 1593353 [details] socat results Description of problem: I have a windows 2019 server guest and installed qemu guest agent on the guest VM. Once I use socat to connect the socket to the guest qemu agent and show network interface name, It will garbled when the network interface name is texted by chinese. Version-Release number of selected component (if applicable): virtio-version: 0.1.149 host disto: Proxmox VE 6.0-4 (Debian Buster) qemu server: 6.0-5 How reproducible: Install a Windows and QEMU guest agent on it, naming the NIC in chinese, use socat to connect the agent and send command to get the result. Steps to Reproduce: 1. Install a Windows. 2. Install the latest QEMU Guest Agent on the Windows guest VM. 3. At the host socat /var/run/qemu-server/XXX.qga - XXX is the vmid 4. Input {"execute":"guest-network-get-interfaces"} 5. Get the result Actual results: The network interface name will garbled when they named in chinese. Expected results: The network interface name should be displayed correctly as naming in chinese. Additional info: The attachment is the result of the NIC name in chinese, the first is "喔喔喔", the second is "阿阿阿" , and the last is "嗯嗯", they all translated into Replacement Character, and be garbled.