From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel@nongnu.org
Cc: armbru@redhat.com
Subject: [Qemu-devel] [PATCH 4/8] VNC: Add 'family' key
Date: Thu, 14 Jan 2010 14:50:55 -0200 [thread overview]
Message-ID: <1263487859-6318-5-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1263487859-6318-1-git-send-email-lcapitulino@redhat.com>
It contains the socket adress family name, like "ipv4" or
"ipv6".
This is useful for clients so that they can interpret the
'host' key reliably.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
vnc.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/vnc.c b/vnc.c
index e35cc36..e023824 100644
--- a/vnc.c
+++ b/vnc.c
@@ -100,6 +100,26 @@ char *vnc_socket_remote_addr(const char *format, int fd) {
return addr_to_string(format, &sa, salen);
}
+static QString *get_sock_family(const struct sockaddr_storage *sa)
+{
+ const char *name;
+
+ switch (sa->ss_family)
+ {
+ case AF_INET:
+ name = "ipv4";
+ break;
+ case AF_INET6:
+ name = "ipv6";
+ break;
+ default:
+ name = "unknown";
+ break;
+ }
+
+ return qstring_from_str(name);
+}
+
static int put_addr_qdict(QDict *qdict, struct sockaddr_storage *sa,
socklen_t salen)
{
@@ -118,6 +138,7 @@ static int put_addr_qdict(QDict *qdict, struct sockaddr_storage *sa,
qdict_put(qdict, "host", qstring_from_str(host));
qdict_put(qdict, "service", qstring_from_str(serv));
+ qdict_put(qdict, "family", get_sock_family(sa));
return 0;
}
@@ -294,6 +315,7 @@ void do_info_vnc_print(Monitor *mon, const QObject *data)
*
* - "enabled": true or false
* - "host": server's IP address
+ * - "family": address family ("ipv4" or "ipv6")
* - "service": server's port number
* - "auth": authentication method
* - "clients": a QList of all connected clients
@@ -301,6 +323,7 @@ void do_info_vnc_print(Monitor *mon, const QObject *data)
* Clients are described by a QDict, with the following information:
*
* - "host": client's IP address
+ * - "family": address family ("ipv4" or "ipv6")
* - "service": client's port number
* - "x509_dname": TLS dname (optional)
* - "sasl_username": SASL username (optional)
@@ -308,7 +331,8 @@ void do_info_vnc_print(Monitor *mon, const QObject *data)
* Example:
*
* { "enabled": true, "host": "0.0.0.0", "service": "50402", "auth": "vnc",
- * "clients": [ { "host": "127.0.0.1", "service": "50401" } ] }
+ * "family": "ipv4",
+ * "clients": [{ "host": "127.0.0.1", "service": "50401", "family": "ipv4" }]}
*/
void do_info_vnc(Monitor *mon, QObject **ret_data)
{
--
1.6.6
next prev parent reply other threads:[~2010-01-14 16:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-14 16:50 [Qemu-devel] [PATCH v0 0/8]: VNC events and cleanup Luiz Capitulino
2010-01-14 16:50 ` [Qemu-devel] [PATCH 1/8] VNC: Use 'enabled' key instead of 'status' Luiz Capitulino
2010-01-19 22:39 ` Anthony Liguori
2010-01-14 16:50 ` [Qemu-devel] [PATCH 2/8] VNC: Make 'auth' key mandatory Luiz Capitulino
2010-01-14 16:50 ` [Qemu-devel] [PATCH 3/8] VNC: Rename client's 'username' key Luiz Capitulino
2010-01-14 16:50 ` Luiz Capitulino [this message]
2010-01-15 7:54 ` [Qemu-devel] [PATCH 4/8] VNC: Add 'family' key Gerd Hoffmann
2010-01-15 11:54 ` Luiz Capitulino
2010-01-14 16:50 ` [Qemu-devel] [PATCH 5/8] VNC: Cache client info at connection time Luiz Capitulino
2010-01-14 16:50 ` [Qemu-devel] [PATCH 6/8] QMP: Introduce VNC_CONNECTED event Luiz Capitulino
2010-01-14 16:50 ` [Qemu-devel] [PATCH 7/8] QMP: Introduce VNC_DISCONNECTED event Luiz Capitulino
2010-01-14 16:50 ` [Qemu-devel] [PATCH 8/8] QMP: Introduce VNC_INITIALIZED event Luiz Capitulino
2010-01-14 17:32 ` [Qemu-devel] Re: [PATCH v0 0/8]: VNC events and cleanup Daniel P. Berrange
2010-01-14 19:01 ` Luiz Capitulino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1263487859-6318-5-git-send-email-lcapitulino@redhat.com \
--to=lcapitulino@redhat.com \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).