The 'pipe' character type wasn't documented.
TCP uses a <protocol> element, not <wire>
We weren't doing strict validation for protocol and source mode values.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
docs/formatdomain.html | 18 +++++++++++++++++-
docs/formatdomain.html.in | 17 ++++++++++++++++-
src/domain_conf.c | 23 ++++++++++++++++++-----
3 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/docs/formatdomain.html b/docs/formatdomain.html
index bb6da11..0b21c6b 100644
--- a/docs/formatdomain.html
+++ b/docs/formatdomain.html
@@ -181,6 +181,8 @@
</li><li>
<a href="#elementsCharHost">Host device
proxy</a>
</li><li>
+ <a href="#elementsCharPipe">Named pipe</a>
+ </li><li>
<a href="#elementsCharTCP">TCP
client/server</a>
</li><li>
<a href="#elementsCharUDP">UDP network
console</a>
@@ -879,6 +881,20 @@ qemu-kvm -net nic,model=? /dev/null
</serial>
...</pre>
<h5>
+ <a name="elementsCharPipe"
id="elementsCharPipe">Named pipe</a>
+ </h5>
+ <p>
+ The character device writes output to a named pipe. See pipe(7) for
+ more info.
+ </p>
+ <pre>
+ ...
+ <serial type="pipe">
+ <source path="/tmp/mypipe"/>
+ <target port="1"/>
+ </serial>
+ ...</pre>
+ <h5>
<a name="elementsCharTCP" id="elementsCharTCP">TCP
client/server</a>
</h5>
<p>
@@ -889,7 +905,7 @@ qemu-kvm -net nic,model=? /dev/null
...
<serial type="tcp">
<source mode="connect" host="0.0.0.0"
service="2445"/>
- <wiremode type="telnet"/>
+ <protocol type="telnet"/>
<target port="1"/>
</serial>
...</pre>
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 48d689d..191b03e 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -839,6 +839,21 @@ qemu-kvm -net nic,model=? /dev/null
</serial>
...</pre>
+ <h5><a name="elementsCharPipe">Named pipe</a></h5>
+
+ <p>
+ The character device writes output to a named pipe. See pipe(7) for
+ more info.
+ </p>
+
+ <pre>
+ ...
+ <serial type="pipe">
+ <source path="/tmp/mypipe"/>
+ <target port="1"/>
+ </serial>
+ ...</pre>
+
<h5><a name="elementsCharTCP">TCP
client/server</a></h5>
<p>
@@ -850,7 +865,7 @@ qemu-kvm -net nic,model=? /dev/null
...
<serial type="tcp">
<source mode="connect" host="0.0.0.0"
service="2445"/>
- <wiremode type="telnet"/>
+ <protocol type="telnet"/>
<target port="1"/>
</serial>
...</pre>
diff --git a/src/domain_conf.c b/src/domain_conf.c
index cc8c3ef..a04a131 100644
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -1169,6 +1169,7 @@ error:
* <serial type="tcp">
* <source mode="bind" host="0.0.0.0"
service="2445"/>
* <target port="1"/>
+ * <protocol type='raw'/>
* </serial>
*
* <serial type="udp">
@@ -1257,11 +1258,16 @@ virDomainChrDefParseXML(virConnectPtr conn,
connectHost = virXMLPropString(cur, "host");
if (connectService == NULL)
connectService = virXMLPropString(cur, "service");
- } else {
+ } else if (STREQ((const char *)mode, "bind")) {
if (bindHost == NULL)
bindHost = virXMLPropString(cur, "host");
if (bindService == NULL)
bindService = virXMLPropString(cur, "service");
+ } else {
+ virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Unknown source mode
'%s'"),
+ mode);
+ goto error;
}
if (def->type == VIR_DOMAIN_CHR_TYPE_UDP)
@@ -1340,11 +1346,18 @@ virDomainChrDefParseXML(virConnectPtr conn,
bindService = NULL;
def->data.tcp.listen = 1;
}
- if (protocol != NULL &&
- STREQ(protocol, "telnet"))
- def->data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET;
- else
+
+ if (protocol == NULL ||
+ STREQ(protocol, "raw"))
def->data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_RAW;
+ else if (STREQ(protocol, "telnet"))
+ def->data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET;
+ else {
+ virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Unknown protocol '%s'"),
protocol);
+ goto error;
+ }
+
break;
case VIR_DOMAIN_CHR_TYPE_UDP:
--
1.6.0.6
Show replies by date
On Wed, Jul 08, 2009 at 05:59:23PM -0400, Cole Robinson wrote:
The 'pipe' character type wasn't documented.
TCP uses a <protocol> element, not <wire>
We weren't doing strict validation for protocol and source mode values.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
docs/formatdomain.html | 18 +++++++++++++++++-
docs/formatdomain.html.in | 17 ++++++++++++++++-
src/domain_conf.c | 23 ++++++++++++++++++-----
3 files changed, 51 insertions(+), 7 deletions(-)
ACK
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Daniel P. Berrange wrote:
On Wed, Jul 08, 2009 at 05:59:23PM -0400, Cole Robinson wrote:
> The 'pipe' character type wasn't documented.
> TCP uses a <protocol> element, not <wire>
> We weren't doing strict validation for protocol and source mode values.
>
> Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
> ---
> docs/formatdomain.html | 18 +++++++++++++++++-
> docs/formatdomain.html.in | 17 ++++++++++++++++-
> src/domain_conf.c | 23 ++++++++++++++++++-----
> 3 files changed, 51 insertions(+), 7 deletions(-)
ACK
Pushed now.
Thanks,
Cole
On Wed, Jul 08, 2009 at 05:59:23PM -0400, Cole Robinson wrote:
The 'pipe' character type wasn't documented.
TCP uses a <protocol> element, not <wire>
Oops :-)
We weren't doing strict validation for protocol and source mode
values.
Cool, looks fine, ACK,
thanks !
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/