# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1257536616 28800
# Node ID 6e39d3b64240e12aa6b2fa2769ac4e794abf0e3a
# Parent 131932045d30226468c63942407321f29c65a33f
This patch add support to input IPv6 address for vncserver.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r 131932045d30 -r 6e39d3b64240 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Fri Nov 06 11:43:25 2009 -0800
+++ b/src/Virt_VirtualSystemManagementService.c Fri Nov 06 11:43:36 2009 -0800
@@ -895,6 +895,44 @@
return NULL;
}
+static int parse_vnc_address(const char *id,
+ char **ip,
+ char **port)
+{
+ int ret;
+ char *tmp_ip = NULL;
+ char *tmp_port = NULL;
+
+ CU_DEBUG("Entering parse_vnc_address, address is %s", id);
+ if (strstr(id, "[") != NULL) {
+ /* its an ipv6 address */
+ ret = sscanf(id, "%a[^]]]:%as", &tmp_ip, &tmp_port);
+ strcat(tmp_ip, "]");
+ } else {
+ ret = sscanf(id, "%a[^:]:%as", &tmp_ip, &tmp_port);
+ }
+
+ if (ret != 2) {
+ ret = 0;
+ goto out;
+ }
+
+ if (ip)
+ *ip = strdup(tmp_ip);
+
+ if (port)
+ *port = strdup(tmp_port);
+
+ ret = 1;
+
+ out:
+ CU_DEBUG("Exiting parse_vnc_address, ip is %s, port is %s", *ip,
*port);
+ free(tmp_ip);
+ free(tmp_port);
+
+ return ret;
+}
+
static const char *graphics_rasd_to_vdev(CMPIInstance *inst,
struct virt_device *dev)
{
@@ -914,7 +952,7 @@
dev->dev.graphics.port = strdup("-1");
dev->dev.graphics.host = strdup("127.0.0.1");
} else {
- ret = parse_id(val,
+ ret = parse_vnc_address(val,
&dev->dev.graphics.host,
&dev->dev.graphics.port);
if (ret != 1) {