[libvirt] [PATCH] build: allow 'make syntax-check' on fresh checkout
by Eric Blake
For good or for bad, I did a fresh checkout, ./autogen.sh, then
'configure', then 'make syntax-check', and was surprised that it
failed. Running 'make' before 'make syntax-check' cleaned up the
issue, but this patch makes it work up front.
* cfg.mk (sc_po_check): Add prerequisite.
---
I debated about pushing this one, but couldn't quite bring myself
to call it a build-breaker. However, if it gets an ACK, I see no
negative effects to pushing before 0.9.3.
cfg.mk | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 69f35a3..fa9ea1c 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -605,6 +605,11 @@ _autogen:
# regenerate HACKING as part of the syntax-check
syntax-check: $(top_srcdir)/HACKING
+# sc_po_check can fail if generated files are not built first
+sc_po_check: daemon/remote_dispatch.h
+daemon/remote_dispatch.h:
+ $(MAKE) -C daemon remote_dispatch.h
+
# List all syntax-check exemptions:
exclude_file_name_regexp--sc_avoid_strcase = ^tools/virsh\.c$$
--
1.7.4.4
13 years, 4 months
[libvirt] [PATCH] build: ignore generated file
by Eric Blake
* .gitignore: Exempt jsontest binary.
---
Pushing under the trivial rule.
.gitignore | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index be4193d..1bfb7b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,6 +57,7 @@
/tests/*.log
/tests/cputest
/tests/hashtest
+/tests/jsontest
/tests/networkxml2argvtest
/tests/nwfilterxml2xmltest
/tests/openvzutilstest
--
1.7.4.4
13 years, 4 months
[libvirt] [PATCH 0/4] several Coverity fixes
by Eric Blake
I ran Coverity on the state of yesterday's git; while I have not
finished reading through all the findings, I figured I'd get some
review started on these.
Eric Blake (4):
virsh: avoid integer overflow
virsh: avoid uninitialized variable
rpc: avoid freeing uninitialized variable
build: avoid double-close bug with pipe2
.gnulib | 2 +-
src/rpc/virnetclient.c | 2 +-
src/rpc/virnetsocket.c | 4 ++--
tools/virsh.c | 7 +++++--
4 files changed, 9 insertions(+), 6 deletions(-)
--
1.7.4.4
13 years, 4 months
[libvirt] [PATCH] Add conditionals to allow build without SASL
by Daniel P. Berrange
* daemon/libvirtd.c, daemon/remote.c: Add #if HAVE_SASL and
suitable function stubs to allow build without SASL
---
daemon/libvirtd.c | 6 ++++++
daemon/remote.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 118aa92..60ee705 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -91,7 +91,9 @@
#include "configmake.h"
+#if HAVE_SASL
virNetSASLContextPtr saslCtxt = NULL;
+#endif
virNetServerProgramPtr remoteProgram = NULL;
virNetServerProgramPtr qemuProgram = NULL;
@@ -560,6 +562,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
}
}
+#if HAVE_SASL
if (config->auth_unix_rw == REMOTE_AUTH_SASL ||
config->auth_unix_ro == REMOTE_AUTH_SASL ||
config->auth_tcp == REMOTE_AUTH_SASL ||
@@ -569,6 +572,7 @@ static int daemonSetupNetworking(virNetServerPtr srv,
if (!saslCtxt)
goto error;
}
+#endif
#if HAVE_POLKIT0
if (auth_unix_rw == REMOTE_AUTH_POLKIT ||
@@ -745,8 +749,10 @@ static int remoteConfigGetAuth(virConfPtr conf, const char *key, int *auth, cons
if (STREQ(p->str, "none")) {
*auth = VIR_NET_SERVER_SERVICE_AUTH_NONE;
+#if HAVE_SASL
} else if (STREQ(p->str, "sasl")) {
*auth = VIR_NET_SERVER_SERVICE_AUTH_SASL;
+#endif
} else if (STREQ(p->str, "polkit")) {
*auth = VIR_NET_SERVER_SERVICE_AUTH_POLKIT;
} else {
diff --git a/daemon/remote.c b/daemon/remote.c
index 9e6cf77..2889908 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1653,6 +1653,7 @@ cleanup:
}
+#ifdef HAVE_SASL
/*
* Initializes the SASL session in prepare for authentication
* and gives the client a list of allowed mechanisms to choose
@@ -1969,6 +1970,49 @@ error:
virMutexUnlock(&priv->lock);
return -1;
}
+#else
+static int
+remoteDispatchAuthSaslInit(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client ATTRIBUTE_UNUSED,
+ virNetMessageHeaderPtr hdr ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_auth_sasl_init_ret *ret ATTRIBUTE_UNUSED)
+{
+ VIR_WARN("Client tried unsupported SASL auth");
+ virNetError(VIR_ERR_AUTH_FAILED, "%s",
+ _("authentication failed"));
+ virNetMessageSaveError(rerr);
+ return -1;
+}
+static int
+remoteDispatchAuthSaslStart(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client ATTRIBUTE_UNUSED,
+ virNetMessageHeaderPtr hdr ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_auth_sasl_start_args *args ATTRIBUTE_UNUSED,
+ remote_auth_sasl_start_ret *ret ATTRIBUTE_UNUSED)
+{
+ VIR_WARN("Client tried unsupported SASL auth");
+ virNetError(VIR_ERR_AUTH_FAILED, "%s",
+ _("authentication failed"));
+ virNetMessageSaveError(rerr);
+ return -1;
+}
+static int
+remoteDispatchAuthSaslStep(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client ATTRIBUTE_UNUSED,
+ virNetMessageHeaderPtr hdr ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_auth_sasl_step_args *args ATTRIBUTE_UNUSED,
+ remote_auth_sasl_step_ret *ret ATTRIBUTE_UNUSED)
+{
+ VIR_WARN("Client tried unsupported SASL auth");
+ virNetError(VIR_ERR_AUTH_FAILED, "%s",
+ _("authentication failed"));
+ virNetMessageSaveError(rerr);
+ return -1;
+}
+#endif
--
1.7.4.4
13 years, 4 months
[libvirt] SIGTERM undeclared, virNetSocketFree
by Jason Helfman
Hi,
I get this error when compiling 0.9.3-rc2 on FreeBSD. Is there a fix for
this?
rpc/virnetsocket.c: In function 'virNetSocketFree':
rpc/virnetsocket.c:654: warning: implicit declaration of function 'kill'
rpc/virnetsocket.c:654: warning: nested extern declaration of 'kill'
[-Wnested-externs]
rpc/virnetsocket.c:654: error: 'SIGTERM' undeclared (first use in this
function)
rpc/virnetsocket.c:654: error: (Each undeclared identifier is reported only
once
rpc/virnetsocket.c:654: error: for each function it appears in.)
gmake[3]: *** [libvirt_net_rpc_la-virnetsocket.lo] Error 1
gmake[3]: Leaving directory
`/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.3/src'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory
`/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.3/src'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory
`/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.3'
gmake: *** [all] Error 2
*** Error code 1
Thanks,
Jason
--
Jason Helfman
System Administrator
experts-exchange.com
http://www.experts-exchange.com/M_4830110.html
E4AD 7CF1 1396 27F6 79DD 4342 5E92 AD66 8C8C FBA5
13 years, 4 months
[libvirt] [PATCH] Fix stream procedure number for virDomainMigratePrepareTunnel3
by Daniel P. Berrange
The virDomainMigratePrepareTunnel3 impl in the remote driver
was using the procedure number for the virDomainMigratePrepareTunnel
method. This doesn't work out so well, because it makes the server
ignore & drop all stream packets
* src/remote/remote_driver.c: Fix procedure for PrepareTunnel3
---
src/remote/remote_driver.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index ce9bcb1..f318740 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -3691,7 +3691,7 @@ remoteDomainMigratePrepareTunnel3(virConnectPtr dconn,
memset(&ret, 0, sizeof(ret));
if (!(netst = virNetClientStreamNew(priv->remoteProgram,
- REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL,
+ REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3,
priv->counter)))
goto done;
--
1.7.4.4
13 years, 4 months
[libvirt] [PATCH] Send back an error if we get unexpected stream control message
by Daniel P. Berrange
We ignore any stream data packets which come in for streams which
are not registered, since these packets are async and do not have
a reply. If we get a stream control packet though we must send back
an actual error, otherwise a (broken) client may hang forever
making it hard to diagnose the client bug.
* src/rpc/virnetserverprogram.c: Send back error for unexpected
stream control messages
---
src/rpc/virnetserverprogram.c | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c
index ca80ae0..63a6b6d 100644
--- a/src/rpc/virnetserverprogram.c
+++ b/src/rpc/virnetserverprogram.c
@@ -257,14 +257,23 @@ int virNetServerProgramDispatch(virNetServerProgramPtr prog,
* stream packets after we closed down a stream. Just drop & ignore
* these.
*/
- VIR_INFO("Ignoring unexpected stream data serial=%d proc=%d status=%d",
- msg->header.serial, msg->header.proc, msg->header.status);
- /* Send a dummy reply to free up 'msg' & unblock client rx */
- memset(msg, 0, sizeof(*msg));
- msg->header.type = VIR_NET_REPLY;
- if (virNetServerClientSendMessage(client, msg) < 0) {
- ret = -1;
- goto cleanup;
+ if (msg->header.status == VIR_NET_CONTINUE) {
+ VIR_INFO("Ignoring unexpected stream data serial=%d proc=%d status=%d",
+ msg->header.serial, msg->header.proc, msg->header.status);
+ /* Send a dummy reply to free up 'msg' & unblock client rx */
+ memset(msg, 0, sizeof(*msg));
+ msg->header.type = VIR_NET_REPLY;
+ if (virNetServerClientSendMessage(client, msg) < 0) {
+ ret = -1;
+ goto cleanup;
+ }
+ } else {
+ VIR_INFO("Unexpected stream control message serial=%d proc=%d status=%d",
+ msg->header.serial, msg->header.proc, msg->header.status);
+ virNetError(VIR_ERR_RPC,
+ _("Unexpected stream control message serial=%d proc=%d status=%d"),
+ msg->header.serial, msg->header.proc, msg->header.status);
+ goto error;
}
ret = 0;
break;
--
1.7.4.4
13 years, 4 months
[libvirt] [PATCH] Fix release of virNetMessagePtr instances in streams processing
by Daniel P. Berrange
If a message packet for a invalid stream is received it is just
free'd. This is not good because it doesn't let the client RPC
request counter decrement. If a stream is shutdown with pending
packets the message also isn't released properly because of an
incorrect header type
* daemon/stream.c: Fix message header type
* src/rpc/virnetserverprogram.c: Send dummy reply instead of
free'ing ignored stream message
---
daemon/stream.c | 1 +
src/rpc/virnetserverprogram.c | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/daemon/stream.c b/daemon/stream.c
index 685cee2..56d79c2 100644
--- a/daemon/stream.c
+++ b/daemon/stream.c
@@ -327,6 +327,7 @@ int daemonFreeClientStream(virNetServerClientPtr client,
virNetMessagePtr tmp = msg->next;
/* Send a dummy reply to free up 'msg' & unblock client rx */
memset(msg, 0, sizeof(*msg));
+ msg->header.type = VIR_NET_REPLY;
if (virNetServerClientSendMessage(client, msg) < 0) {
virNetServerClientMarkClose(client);
virNetMessageFree(msg);
diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c
index 4afed64..ca80ae0 100644
--- a/src/rpc/virnetserverprogram.c
+++ b/src/rpc/virnetserverprogram.c
@@ -259,7 +259,13 @@ int virNetServerProgramDispatch(virNetServerProgramPtr prog,
*/
VIR_INFO("Ignoring unexpected stream data serial=%d proc=%d status=%d",
msg->header.serial, msg->header.proc, msg->header.status);
- virNetMessageFree(msg);
+ /* Send a dummy reply to free up 'msg' & unblock client rx */
+ memset(msg, 0, sizeof(*msg));
+ msg->header.type = VIR_NET_REPLY;
+ if (virNetServerClientSendMessage(client, msg) < 0) {
+ ret = -1;
+ goto cleanup;
+ }
ret = 0;
break;
@@ -275,6 +281,7 @@ int virNetServerProgramDispatch(virNetServerProgramPtr prog,
error:
ret = virNetServerProgramSendReplyError(prog, client, msg, &rerr, &msg->header);
+cleanup:
return ret;
}
--
1.7.4.4
13 years, 4 months