mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
qemu: Reject unsupported chardev backend protocols
QEMU supports only 'raw' and 'telnet' in the <protocol type='telnets'/> element. Reject 'telnets' and 'tls'. TLS transport for qemu chardevs is configured via "tls='yes'" attribute added to the "<source>" element instead, so this prevents potential misconfig as the value would be silently accepted. Closes: https://gitlab.com/libvirt/libvirt/-/issues/412 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3778964207
commit
24d468993c
@ -2044,6 +2044,25 @@ qemuValidateDomainChrSourceDef(const virDomainChrSourceDef *def,
|
||||
{
|
||||
switch ((virDomainChrType)def->type) {
|
||||
case VIR_DOMAIN_CHR_TYPE_TCP:
|
||||
switch (def->data.tcp.protocol) {
|
||||
case VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW:
|
||||
case VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET:
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNETS:
|
||||
case VIR_DOMAIN_CHR_TCP_PROTOCOL_TLS:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("tcp chardev protocol '%1$s' not supported"),
|
||||
virDomainChrTcpProtocolTypeToString(def->data.tcp.protocol));
|
||||
return -1;
|
||||
|
||||
case VIR_DOMAIN_CHR_TCP_PROTOCOL_LAST:
|
||||
default:
|
||||
virReportEnumRangeError(virDomainChrTcpProtocol, def->data.tcp.protocol);
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
if (qemuValidateDomainChrSourceReconnectDef(&def->data.tcp.reconnect) < 0)
|
||||
return -1;
|
||||
break;
|
||||
|
@ -0,0 +1 @@
|
||||
unsupported configuration: tcp chardev protocol 'tls' not supported
|
23
tests/qemuxmlconfdata/serial-tcp-chardev-telnets.xml
Normal file
23
tests/qemuxmlconfdata/serial-tcp-chardev-telnets.xml
Normal file
@ -0,0 +1,23 @@
|
||||
<domain type='qemu'>
|
||||
<name>QEMUGuest1</name>
|
||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
<memory unit='KiB'>219136</memory>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='pc'>hvm</type>
|
||||
</os>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<serial type='tcp'>
|
||||
<source mode='connect' host='127.0.0.1' service='9999'/>
|
||||
<protocol type='tls'/>
|
||||
<target port='0'/>
|
||||
</serial>
|
||||
<console type='tcp'>
|
||||
<source mode='connect' host='127.0.0.1' service='9999'/>
|
||||
<protocol type='telnets'/>
|
||||
<target port='0'/>
|
||||
</console>
|
||||
<memballoon model='virtio'/>
|
||||
</devices>
|
||||
</domain>
|
@ -1845,6 +1845,7 @@ mymain(void)
|
||||
DO_TEST_CAPS_LATEST("serial-unix-chardev");
|
||||
DO_TEST_CAPS_LATEST_PARSE_ERROR("serial-unix-missing-source");
|
||||
DO_TEST_CAPS_LATEST("serial-tcp-chardev");
|
||||
DO_TEST_CAPS_LATEST_PARSE_ERROR("serial-tcp-chardev-telnets");
|
||||
DO_TEST_CAPS_LATEST("serial-udp-chardev");
|
||||
DO_TEST_CAPS_LATEST("serial-tcp-telnet-chardev");
|
||||
driver.config->chardevTLS = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user