--name=virJSONValueFree \
--name=virLastErrFreeData \
--name=virNetMessageFree \
- --name=virNetServerMDNSFree \
- --name=virNetServerMDNSEntryFree \
- --name=virNetServerMDNSGroupFree \
--name=virNWFilterDefFree \
--name=virNWFilterEntryFree \
--name=virNWFilterHashTableFree \
LIBVIRT_ARG_APPARMOR
LIBVIRT_ARG_ATTR
LIBVIRT_ARG_AUDIT
-LIBVIRT_ARG_AVAHI
LIBVIRT_ARG_BASH_COMPLETION
LIBVIRT_ARG_BLKID
LIBVIRT_ARG_CAPNG
LIBVIRT_CHECK_ATOMIC
LIBVIRT_CHECK_ATTR
LIBVIRT_CHECK_AUDIT
-LIBVIRT_CHECK_AVAHI
LIBVIRT_CHECK_BASH_COMPLETION
LIBVIRT_CHECK_BLKID
LIBVIRT_CHECK_CAPNG
LIBVIRT_RESULT_APPARMOR
LIBVIRT_RESULT_ATTR
LIBVIRT_RESULT_AUDIT
-LIBVIRT_RESULT_AVAHI
LIBVIRT_RESULT_BASH_COMPLETION
LIBVIRT_RESULT_BLKID
LIBVIRT_RESULT_CAPNG
be part of the underlying server.
</dd>
- <dt><code>virNetServerMDNSPtr</code> (virnetservermdns.h)</dt>
- <dd>The virNetServerMDNS APIs are used to advertise a server
- across the local network, enabling clients to automatically
- detect the existence of remote services. This is done by
- interfacing with the Avahi mDNS advertisement service.
- </dd>
-
<dt><code>virNetServerClientPtr</code> (virnetserverclient.h)</dt>
<dd>The virNetServerClient APIs are used to manage I/O related
to a single client network connection. It handles initial
<td> "16509" </td>
<td>
The port number or service name to listen on for unencrypted TCP connections.
-</td>
- </tr>
- <tr>
- <td> mdns_adv <i>[0|1]</i> </td>
- <td> 0 (advertise with mDNS) </td>
- <td>
- If set to 1 then the virtualization service will be advertised over
- mDNS to hosts on the local LAN segment.
-</td>
- </tr>
- <tr>
- <td> mdns_name <i>"name"</i> </td>
- <td> "Virtualization Host HOSTNAME" </td>
- <td>
- The name to advertise for this host with Avahi mDNS. The default
- includes the machine's short hostname. This must be unique to the
- local LAN segment.
</td>
</tr>
<tr>
<pre>
./configure \
--without-sasl \
- --without-avahi \
--without-polkit \
--without-python \
--without-libxl \
%endif
BuildRequires: libpcap-devel
BuildRequires: libnl3-devel
-BuildRequires: avahi-devel
BuildRequires: libselinux-devel
BuildRequires: dnsmasq >= 2.41
BuildRequires: iptables
Requires: iproute-tc
%endif
-Requires: avahi-libs
Requires: polkit >= 0.112
%ifarch %{ix86} x86_64 ia64
# For virConnectGetSysinfo
%{?arg_vbox} \
%{?arg_libxl} \
--with-sasl \
- --with-avahi \
--with-polkit \
--with-libvirtd \
%{?arg_phyp} \
+++ /dev/null
-dnl The libavahi.so library
-dnl
-dnl Copyright (C) 2012-2013 Red Hat, Inc.
-dnl
-dnl This library is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU Lesser General Public
-dnl License as published by the Free Software Foundation; either
-dnl version 2.1 of the License, or (at your option) any later version.
-dnl
-dnl This library is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-dnl Lesser General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU Lesser General Public
-dnl License along with this library. If not, see
-dnl <http://www.gnu.org/licenses/>.
-dnl
-
-AC_DEFUN([LIBVIRT_ARG_AVAHI],[
- LIBVIRT_ARG_WITH_FEATURE([AVAHI], [avahi-client], [check], [0.6.0])
-])
-
-AC_DEFUN([LIBVIRT_CHECK_AVAHI],[
- LIBVIRT_CHECK_PKG([AVAHI], [avahi-client], [0.6.0])
-])
-
-AC_DEFUN([LIBVIRT_RESULT_AVAHI],[
- LIBVIRT_RESULT_LIB([AVAHI])
-])
--without-vbox \
%{?_without_xenapi} \
--without-sasl \
- --without-avahi \
--without-polkit \
--without-libvirtd \
%{?_without_phyp} \
src/rpc/virnetsaslcontext.c
src/rpc/virnetserver.c
src/rpc/virnetserverclient.c
-src/rpc/virnetservermdns.c
src/rpc/virnetserverprogram.c
src/rpc/virnetserverservice.c
src/rpc/virnetsocket.c
virNetServerSetClientLimits;
virNetServerSetThreadPoolParameters;
virNetServerSetTLSContext;
-virNetServerStart;
virNetServerUpdateServices;
virNetServerClientWantCloseLocked;
-# rpc/virnetservermdns.h
-virNetServerMDNSAddEntry;
-virNetServerMDNSAddGroup;
-virNetServerMDNSEntryFree;
-virNetServerMDNSFree;
-virNetServerMDNSGroupFree;
-virNetServerMDNSNew;
-virNetServerMDNSRemoveEntry;
-virNetServerMDNSRemoveGroup;
-virNetServerMDNSStart;
-virNetServerMDNSStop;
-
-
# rpc/virnetserverprogram.h
virNetServerProgramDispatch;
virNetServerProgramGetID;
if (!(srv = virNetServerNew("virtlockd", 1,
0, 0, 0, config->max_clients,
config->max_clients, -1, 0,
- NULL,
virLockDaemonClientNew,
virLockDaemonClientPreExecRestart,
virLockDaemonClientFree,
if (!(srv = virNetServerNew("admin", 1,
0, 0, 0, config->admin_max_clients,
config->admin_max_clients, -1, 0,
- NULL,
remoteAdmClientNew,
remoteAdmClientPreExecRestart,
remoteAdmClientFree,
false, 0, 1)))
return -1;
- if (virNetServerAddService(srv, svc, NULL) < 0) {
+ if (virNetServerAddService(srv, svc) < 0) {
virObjectUnref(svc);
return -1;
}
false, 0, 1)))
return -1;
- if (virNetServerAddService(srv, svc, NULL) < 0) {
+ if (virNetServerAddService(srv, svc) < 0) {
virObjectUnref(svc);
return -1;
}
if (!(srv = virNetServerNew("virtlogd", 1,
0, 0, 0, config->max_clients,
config->max_clients, -1, 0,
- NULL,
virLogDaemonClientNew,
virLogDaemonClientPreExecRestart,
virLogDaemonClientFree,
if (!(srv = virNetServerNew("admin", 1,
0, 0, 0, config->admin_max_clients,
config->admin_max_clients, -1, 0,
- NULL,
remoteAdmClientNew,
remoteAdmClientPreExecRestart,
remoteAdmClientFree,
false, 0, 1)))
return -1;
- if (virNetServerAddService(srv, svc, NULL) < 0) {
+ if (virNetServerAddService(srv, svc) < 0) {
virObjectUnref(svc);
return -1;
}
false, 0, 1)))
return -1;
- if (virNetServerAddService(srv, svc, NULL) < 0) {
+ if (virNetServerAddService(srv, svc) < 0) {
virObjectUnref(svc);
return -1;
}
if (!(srv = virNetServerNew("LXC", 1,
0, 0, 0, 1,
0, -1, 0,
- NULL,
virLXCControllerClientPrivateNew,
NULL,
virLXCControllerClientPrivateFree,
if (virSecurityManagerClearSocketLabel(ctrl->securityManager, ctrl->def) < 0)
goto error;
- if (virNetServerAddService(srv, svc, NULL) < 0)
+ if (virNetServerAddService(srv, svc) < 0)
goto error;
virObjectUnref(svc);
svc = NULL;
| str_entry "tls_port"
| str_entry "tcp_port"
| str_entry "listen_addr"
- | bool_entry "mdns_adv"
- | str_entry "mdns_name"
let sock_acl_entry = str_entry "unix_sock_group"
| str_entry "unix_sock_ro_perms"
#listen_addr = "192.168.0.1"
-# Flag toggling mDNS advertizement of the libvirt service.
-#
-# Alternatively can disable for all services on a host by
-# stopping the Avahi daemon
-#
-# This is disabled by default, uncomment this to enable it
-#mdns_adv = 1
-
-# Override the default mDNS advertizement name. This must be
-# unique on the immediate broadcast network.
-#
-# The default is "Virtualization Host HOSTNAME", where HOSTNAME
-# is substituted for the short hostname of the machine (without domain)
-#
-#mdns_name = "Virtualization Host Joe Demo"
-
-
#################################################################
#
# UNIX socket access controls
goto cleanup;
}
- if (virNetServerAddService(srv, svc,
- config->mdns_adv && !ipsock ?
- "_libvirt._tcp" :
- NULL) < 0)
+ if (virNetServerAddService(srv, svc) < 0)
goto cleanup;
if (svcRO &&
- virNetServerAddService(srv, svcRO, NULL) < 0)
+ virNetServerAddService(srv, svcRO) < 0)
goto cleanup;
if (sock_path_adm) {
config->admin_max_client_requests)))
goto cleanup;
- if (virNetServerAddService(srvAdm, svcAdm, NULL) < 0)
+ if (virNetServerAddService(srvAdm, svcAdm) < 0)
goto cleanup;
}
config->max_client_requests)))
goto cleanup;
- if (virNetServerAddService(srv, svcTCP,
- config->mdns_adv ? "_libvirt._tcp" : NULL) < 0)
+ if (virNetServerAddService(srv, svcTCP) < 0)
goto cleanup;
}
virObjectUnref(ctxt);
goto cleanup;
}
- if (virNetServerAddService(srv, svcTLS,
- config->mdns_adv &&
- !config->listen_tcp ? "_libvirt._tcp" : NULL) < 0)
+ if (virNetServerAddService(srv, svcTLS) < 0)
goto cleanup;
virObjectUnref(ctxt);
config->max_anonymous_clients,
config->keepalive_interval,
config->keepalive_count,
- config->mdns_adv ? config->mdns_name : NULL,
remoteClientNew,
NULL,
remoteClientFree,
0,
config->admin_keepalive_interval,
config->admin_keepalive_count,
- NULL,
remoteAdmClientNew,
NULL,
remoteAdmClientFree,
daemonConfigNew(bool privileged ATTRIBUTE_UNUSED)
{
struct daemonConfig *data;
- char *localhost;
- int ret;
if (VIR_ALLOC(data) < 0)
return NULL;
#endif
data->auth_tls = REMOTE_AUTH_NONE;
- data->mdns_adv = 0;
-
data->min_workers = 5;
data->max_workers = 20;
data->max_clients = 5000;
data->ovs_timeout = VIR_NETDEV_OVS_DEFAULT_TIMEOUT;
- localhost = virGetHostname();
- if (localhost == NULL) {
- /* we couldn't resolve the hostname; assume that we are
- * running in disconnected operation, and report a less
- * useful Avahi string
- */
- ret = VIR_STRDUP(data->mdns_name, "Virtualization Host");
- } else {
- char *tmp;
- /* Extract the host part of the potentially FQDN */
- if ((tmp = strchr(localhost, '.')))
- *tmp = '\0';
- ret = virAsprintf(&data->mdns_name, "Virtualization Host %s",
- localhost);
- }
- VIR_FREE(localhost);
- if (ret < 0)
- goto error;
-
return data;
error:
VIR_FREE(data->unix_sock_rw_perms);
VIR_FREE(data->unix_sock_group);
VIR_FREE(data->unix_sock_dir);
- VIR_FREE(data->mdns_name);
tmp = data->tls_allowed_dn_list;
while (tmp && *tmp) {
if (virConfGetValueString(conf, "unix_sock_dir", &data->unix_sock_dir) < 0)
goto error;
- if (virConfGetValueBool(conf, "mdns_adv", &data->mdns_adv) < 0)
- goto error;
- if (virConfGetValueString(conf, "mdns_name", &data->mdns_name) < 0)
- goto error;
-
if (virConfGetValueBool(conf, "tls_no_sanity_certificate", &data->tls_no_sanity_certificate) < 0)
goto error;
if (virConfGetValueBool(conf, "tls_no_verify_certificate", &data->tls_no_verify_certificate) < 0)
char **access_drivers;
- bool mdns_adv;
- char *mdns_name;
-
bool tls_no_verify_certificate;
bool tls_no_sanity_certificate;
char **tls_allowed_dn_list;
{ "tls_port" = "16514" }
{ "tcp_port" = "16509" }
{ "listen_addr" = "192.168.0.1" }
- { "mdns_adv" = "1" }
- { "mdns_name" = "Virtualization Host Joe Demo" }
{ "unix_sock_group" = "libvirt" }
{ "unix_sock_ro_perms" = "0777" }
{ "unix_sock_rw_perms" = "0770" }
rpc/virnetserverservice.c \
rpc/virnetserverclient.h \
rpc/virnetserverclient.c \
- rpc/virnetservermdns.h \
- rpc/virnetservermdns.c \
rpc/virnetdaemon.h \
rpc/virnetdaemon.c \
rpc/virnetserver.h \
rpc/virnetserver.c \
$(NULL)
libvirt_net_rpc_server_la_CFLAGS = \
- $(AVAHI_CFLAGS) \
$(DBUS_CFLAGS) \
$(XDR_CFLAGS) \
$(AM_CFLAGS) \
$(NULL)
libvirt_net_rpc_server_la_LDFLAGS = \
$(AM_LDFLAGS) \
- $(AVAHI_LIBS) \
$(DBUS_LIBS) \
$(NULL)
libvirt_net_rpc_server_la_LIBADD = $(CYGWIN_EXTRA_LIBADD)
#include "virutil.h"
#include "virfile.h"
#include "virnetserver.h"
-#include "virnetservermdns.h"
#include "virdbus.h"
#include "virhash.h"
#include "virstring.h"
virObjectUnlock(dmn);
}
-static int
-daemonServerRun(void *payload,
- const void *key ATTRIBUTE_UNUSED,
- void *opaque ATTRIBUTE_UNUSED)
-{
- virNetServerPtr srv = payload;
-
- return virNetServerStart(srv);
-};
-
static int
daemonServerProcessClients(void *payload,
const void *key ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (virHashForEach(dmn->servers, daemonServerRun, NULL) < 0)
- goto cleanup;
-
dmn->quit = false;
if (dmn->autoShutdownTimeout &&
#include "virerror.h"
#include "virthread.h"
#include "virthreadpool.h"
-#include "virnetservermdns.h"
#include "virstring.h"
#define VIR_FROM_THIS VIR_FROM_RPC
/* Immutable pointer, self-locking APIs */
virThreadPoolPtr workers;
- char *mdnsGroupName;
- virNetServerMDNSPtr mdns;
- virNetServerMDNSGroupPtr mdnsGroup;
-
size_t nservices;
virNetServerServicePtr *services;
size_t max_anonymous_clients,
int keepaliveInterval,
unsigned int keepaliveCount,
- const char *mdnsGroupName,
virNetServerClientPrivNew clientPrivNew,
virNetServerClientPrivPreExecRestart clientPrivPreExecRestart,
virFreeCallback clientPrivFree,
srv->clientPrivFree = clientPrivFree;
srv->clientPrivOpaque = clientPrivOpaque;
- if (VIR_STRDUP(srv->mdnsGroupName, mdnsGroupName) < 0)
- goto error;
- if (srv->mdnsGroupName) {
- if (!(srv->mdns = virNetServerMDNSNew()))
- goto error;
- if (!(srv->mdnsGroup = virNetServerMDNSAddGroup(srv->mdns,
- srv->mdnsGroupName)))
- goto error;
- }
-
return srv;
error:
virObjectUnref(srv);
unsigned int keepaliveInterval;
unsigned int keepaliveCount;
unsigned long long next_client_id;
- const char *mdnsGroupName = NULL;
if (virJSONValueObjectGetNumberUint(object, "min_workers", &min_workers) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
goto error;
}
- if (virJSONValueObjectHasKey(object, "mdnsGroupName") &&
- (!(mdnsGroupName = virJSONValueObjectGetString(object, "mdnsGroupName")))) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Malformed mdnsGroupName data in JSON document"));
- goto error;
- }
-
if (virJSONValueObjectGetNumberUlong(object, "next_client_id",
&next_client_id) < 0) {
VIR_WARN("Missing next_client_id data in JSON document");
priority_workers, max_clients,
max_anonymous_clients,
keepaliveInterval, keepaliveCount,
- mdnsGroupName,
clientPrivNew, clientPrivPreExecRestart,
clientPrivFree, clientPrivOpaque)))
goto error;
if (!(service = virNetServerServiceNewPostExecRestart(child)))
goto error;
- /* XXX mdns entry names ? */
- if (virNetServerAddService(srv, service, NULL) < 0) {
+ if (virNetServerAddService(srv, service) < 0) {
virObjectUnref(service);
goto error;
}
goto error;
}
- if (srv->mdnsGroupName &&
- virJSONValueObjectAppendString(object, "mdnsGroupName", srv->mdnsGroupName) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Cannot set mdnsGroupName data in JSON document"));
- goto error;
- }
-
if (!(services = virJSONValueNewArray()))
goto error;
int virNetServerAddService(virNetServerPtr srv,
- virNetServerServicePtr svc,
- const char *mdnsEntryName)
+ virNetServerServicePtr svc)
{
virObjectLock(srv);
if (VIR_EXPAND_N(srv->services, srv->nservices, 1) < 0)
goto error;
- if (mdnsEntryName) {
- int port = virNetServerServiceGetPort(svc);
-
- if (!virNetServerMDNSAddEntry(srv->mdnsGroup,
- mdnsEntryName,
- port)) {
- srv->nservices--;
- goto error;
- }
- }
-
srv->services[srv->nservices-1] = virObjectRef(svc);
virNetServerServiceSetDispatcher(svc,
for (i = 0; i < srv->nclients; i++)
virObjectUnref(srv->clients[i]);
VIR_FREE(srv->clients);
-
- VIR_FREE(srv->mdnsGroupName);
- virNetServerMDNSFree(srv->mdns);
}
void virNetServerClose(virNetServerPtr srv)
virObjectUnlock(srv);
}
-int
-virNetServerStart(virNetServerPtr srv)
-{
- /*
- * Do whatever needs to be done before starting.
- */
- if (!srv->mdns)
- return 0;
-
- return virNetServerMDNSStart(srv->mdns);
-}
-
const char *
virNetServerGetName(virNetServerPtr srv)
{
size_t max_anonymous_clients,
int keepaliveInterval,
unsigned int keepaliveCount,
- const char *mdnsGroupName,
virNetServerClientPrivNew clientPrivNew,
virNetServerClientPrivPreExecRestart clientPrivPreExecRestart,
virFreeCallback clientPrivFree,
virJSONValuePtr virNetServerPreExecRestart(virNetServerPtr srv);
int virNetServerAddService(virNetServerPtr srv,
- virNetServerServicePtr svc,
- const char *mdnsEntryName);
+ virNetServerServicePtr svc);
int virNetServerAddProgram(virNetServerPtr srv,
virNetServerProgramPtr prog);
void virNetServerUpdateServices(virNetServerPtr srv, bool enabled);
-int virNetServerStart(virNetServerPtr srv);
-
const char *virNetServerGetName(virNetServerPtr srv);
int virNetServerGetThreadPoolParameters(virNetServerPtr srv,
+++ /dev/null
-/*
- * virnetservermdns.c: advertise server sockets
- *
- * Copyright (C) 2011-2012 Red Hat, Inc.
- * Copyright (C) 2007 Daniel P. Berrange
- *
- * Derived from Avahi example service provider code.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-#include <config.h>
-
-#include <time.h>
-
-#if WITH_AVAHI
-# include <avahi-client/client.h>
-# include <avahi-client/publish.h>
-
-# include <avahi-common/alternative.h>
-# include <avahi-common/simple-watch.h>
-# include <avahi-common/malloc.h>
-# include <avahi-common/error.h>
-# include <avahi-common/timeval.h>
-#endif
-
-#include "virnetservermdns.h"
-#include "vireventpoll.h"
-#include "viralloc.h"
-#include "virerror.h"
-#include "virlog.h"
-#include "virstring.h"
-
-#define VIR_FROM_THIS VIR_FROM_RPC
-
-VIR_LOG_INIT("rpc.netservermdns");
-
-struct _virNetServerMDNSEntry {
- char *type;
- int port;
- virNetServerMDNSEntryPtr next;
-};
-
-struct _virNetServerMDNSGroup {
- virNetServerMDNSPtr mdns;
-#if WITH_AVAHI
- AvahiEntryGroup *handle;
-#endif
- char *name;
- virNetServerMDNSEntryPtr entry;
- virNetServerMDNSGroupPtr next;
-};
-
-struct _virNetServerMDNS {
-#if WITH_AVAHI
- AvahiClient *client;
- AvahiPoll *poller;
-#endif
- virNetServerMDNSGroupPtr group;
-};
-
-#if WITH_AVAHI
-/* Avahi API requires this struct name in the app :-( */
-struct AvahiWatch {
- int watch;
- int fd;
- int revents;
- AvahiWatchCallback callback;
- void *userdata;
-};
-
-/* Avahi API requires this struct name in the app :-( */
-struct AvahiTimeout {
- int timer;
- AvahiTimeoutCallback callback;
- void *userdata;
-};
-
-static void virNetServerMDNSCreateServices(virNetServerMDNSGroupPtr group);
-
-/* Called whenever the entry group state changes */
-static void virNetServerMDNSGroupCallback(AvahiEntryGroup *g ATTRIBUTE_UNUSED,
- AvahiEntryGroupState state,
- void *data)
-{
- virNetServerMDNSGroupPtr group = data;
-
- switch (state) {
- case AVAHI_ENTRY_GROUP_ESTABLISHED:
- /* The entry group has been established successfully */
- VIR_DEBUG("Group '%s' established", group->name);
- break;
-
- case AVAHI_ENTRY_GROUP_COLLISION:
- {
- char *n;
-
- /* A service name collision happened. Let's pick a new name */
- n = avahi_alternative_service_name(group->name);
- VIR_FREE(group->name);
- group->name = n;
-
- VIR_DEBUG("Group name collision, renaming service to '%s'", group->name);
-
- /* And recreate the services */
- virNetServerMDNSCreateServices(group);
- }
- break;
-
- case AVAHI_ENTRY_GROUP_FAILURE :
- VIR_DEBUG("Group failure: %s",
- avahi_strerror(avahi_client_errno(group->mdns->client)));
-
- /* Some kind of failure happened while we were registering our services */
- /* avahi_simple_poll_quit(simple_poll); */
- break;
-
- case AVAHI_ENTRY_GROUP_UNCOMMITED:
- case AVAHI_ENTRY_GROUP_REGISTERING:
- ;
- }
-}
-
-static void virNetServerMDNSCreateServices(virNetServerMDNSGroupPtr group)
-{
- virNetServerMDNSPtr mdns = group->mdns;
- virNetServerMDNSEntryPtr entry;
- int ret;
- VIR_DEBUG("Adding services to '%s'", group->name);
-
- /* If we've no services to advertise, just reset the group to make
- * sure it is emptied of any previously advertised services */
- if (!group->entry) {
- if (group->handle)
- avahi_entry_group_reset(group->handle);
- return;
- }
-
- /* If this is the first time we're called, let's create a new entry group */
- if (!group->handle) {
- VIR_DEBUG("Creating initial group %s", group->name);
- if (!(group->handle =
- avahi_entry_group_new(mdns->client,
- virNetServerMDNSGroupCallback,
- group))) {
- VIR_DEBUG("avahi_entry_group_new() failed: %s",
- avahi_strerror(avahi_client_errno(mdns->client)));
- return;
- }
- }
-
- entry = group->entry;
- while (entry) {
- if ((ret = avahi_entry_group_add_service(group->handle,
- AVAHI_IF_UNSPEC,
- AVAHI_PROTO_UNSPEC,
- 0,
- group->name,
- entry->type,
- NULL,
- NULL,
- entry->port,
- NULL)) < 0) {
- VIR_DEBUG("Failed to add %s service on port %d: %s",
- entry->type, entry->port, avahi_strerror(ret));
- avahi_entry_group_reset(group->handle);
- return;
- }
- entry = entry->next;
- }
-
- /* Tell the server to register the service */
- if ((ret = avahi_entry_group_commit(group->handle)) < 0) {
- avahi_entry_group_reset(group->handle);
- VIR_DEBUG("Failed to commit entry_group: %s",
- avahi_strerror(ret));
- return;
- }
-}
-
-
-static void virNetServerMDNSClientCallback(AvahiClient *c,
- AvahiClientState state,
- void *data)
-{
- virNetServerMDNSPtr mdns = data;
- virNetServerMDNSGroupPtr group;
- if (!mdns->client)
- mdns->client = c;
-
- VIR_DEBUG("Callback state=%d", state);
-
- /* Called whenever the client or server state changes */
- switch (state) {
- case AVAHI_CLIENT_S_RUNNING:
- /* The server has startup successfully and registered its host
- * name on the network, so it's time to create our services */
- VIR_DEBUG("Client running %p", mdns->client);
- group = mdns->group;
- while (group) {
- virNetServerMDNSCreateServices(group);
- group = group->next;
- }
- break;
-
- case AVAHI_CLIENT_FAILURE:
- VIR_DEBUG("Client failure: %s",
- avahi_strerror(avahi_client_errno(c)));
- virNetServerMDNSStop(mdns);
- virNetServerMDNSStart(mdns);
- break;
-
- case AVAHI_CLIENT_S_COLLISION:
- /* Let's drop our registered services. When the server is back
- * in AVAHI_SERVER_RUNNING state we will register them
- * again with the new host name. */
-
- ATTRIBUTE_FALLTHROUGH;
-
- case AVAHI_CLIENT_S_REGISTERING:
- /* The server records are now being established. This
- * might be caused by a host name change. We need to wait
- * for our own records to register until the host name is
- * properly established. */
- VIR_DEBUG("Client collision/connecting %p", mdns->client);
- group = mdns->group;
- while (group) {
- if (group->handle)
- avahi_entry_group_reset(group->handle);
- group = group->next;
- }
- break;
-
- case AVAHI_CLIENT_CONNECTING:
- VIR_DEBUG("Client connecting.... %p", mdns->client);
- ;
- }
-}
-
-
-static void virNetServerMDNSWatchDispatch(int watch, int fd, int events, void *opaque)
-{
- AvahiWatch *w = opaque;
- int fd_events = virEventPollToNativeEvents(events);
- VIR_DEBUG("Dispatch watch %d FD %d Event %d", watch, fd, fd_events);
- w->revents = fd_events;
- w->callback(w, fd, fd_events, w->userdata);
-}
-
-static void virNetServerMDNSWatchDofree(void *w)
-{
- VIR_FREE(w);
-}
-
-
-static AvahiWatch *virNetServerMDNSWatchNew(const AvahiPoll *api ATTRIBUTE_UNUSED,
- int fd, AvahiWatchEvent event,
- AvahiWatchCallback cb, void *userdata)
-{
- AvahiWatch *w;
- virEventHandleType hEvents;
- if (VIR_ALLOC(w) < 0)
- return NULL;
-
- w->fd = fd;
- w->revents = 0;
- w->callback = cb;
- w->userdata = userdata;
-
- VIR_DEBUG("New handle %p FD %d Event %d", w, w->fd, event);
- hEvents = virEventPollFromNativeEvents(event);
- if ((w->watch = virEventAddHandle(fd, hEvents,
- virNetServerMDNSWatchDispatch,
- w,
- virNetServerMDNSWatchDofree)) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to add watch for fd %d events %d"), fd, hEvents);
- VIR_FREE(w);
- return NULL;
- }
-
- return w;
-}
-
-static void virNetServerMDNSWatchUpdate(AvahiWatch *w, AvahiWatchEvent event)
-{
- VIR_DEBUG("Update handle %p FD %d Event %d", w, w->fd, event);
- virEventUpdateHandle(w->watch, event);
-}
-
-static AvahiWatchEvent virNetServerMDNSWatchGetEvents(AvahiWatch *w)
-{
- VIR_DEBUG("Get handle events %p %d", w, w->fd);
- return w->revents;
-}
-
-static void virNetServerMDNSWatchFree(AvahiWatch *w)
-{
- VIR_DEBUG("Free handle %p %d", w, w->fd);
- virEventRemoveHandle(w->watch);
-}
-
-static void virNetServerMDNSTimeoutDispatch(int timer ATTRIBUTE_UNUSED, void *opaque)
-{
- AvahiTimeout *t = (AvahiTimeout*)opaque;
- VIR_DEBUG("Dispatch timeout %p %d", t, timer);
- virEventUpdateTimeout(t->timer, -1);
- t->callback(t, t->userdata);
-}
-
-static void virNetServerMDNSTimeoutDofree(void *t)
-{
- VIR_FREE(t);
-}
-
-static AvahiTimeout *virNetServerMDNSTimeoutNew(const AvahiPoll *api ATTRIBUTE_UNUSED,
- const struct timeval *tv,
- AvahiTimeoutCallback cb,
- void *userdata)
-{
- AvahiTimeout *t;
- struct timeval now;
- long long nowms, thenms, timeout;
- VIR_DEBUG("Add timeout TV %p", tv);
- if (VIR_ALLOC(t) < 0)
- return NULL;
-
- if (gettimeofday(&now, NULL) < 0) {
- virReportSystemError(errno, "%s",
- _("Unable to get current time"));
- VIR_FREE(t);
- return NULL;
- }
-
- VIR_DEBUG("Trigger timed for %d %d %d %d",
- (int)now.tv_sec, (int)now.tv_usec,
- (int)(tv ? tv->tv_sec : 0), (int)(tv ? tv->tv_usec : 0));
- nowms = (now.tv_sec * 1000ll) + (now.tv_usec / 1000ll);
- if (tv) {
- thenms = (tv->tv_sec * 1000ll) + (tv->tv_usec/1000ll);
- timeout = thenms > nowms ? nowms - thenms : 0;
- if (timeout < 0)
- timeout = 0;
- } else {
- timeout = -1;
- }
-
- t->timer = virEventAddTimeout(timeout,
- virNetServerMDNSTimeoutDispatch,
- t,
- virNetServerMDNSTimeoutDofree);
- t->callback = cb;
- t->userdata = userdata;
-
- if (t->timer < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to add timer with timeout %lld"), timeout);
- VIR_FREE(t);
- return NULL;
- }
-
- return t;
-}
-
-static void virNetServerMDNSTimeoutUpdate(AvahiTimeout *t, const struct timeval *tv)
-{
- struct timeval now;
- long long nowms, thenms, timeout;
- VIR_DEBUG("Update timeout %p TV %p", t, tv);
- if (gettimeofday(&now, NULL) < 0) {
- VIR_FREE(t);
- return;
- }
-
- nowms = (now.tv_sec * 1000ll) + (now.tv_usec / 1000ll);
- if (tv) {
- thenms = ((tv->tv_sec * 1000ll) + (tv->tv_usec/1000ll));
- timeout = thenms > nowms ? nowms - thenms : 0;
- if (timeout < 0)
- timeout = 0;
- } else {
- timeout = -1;
- }
-
- virEventUpdateTimeout(t->timer, timeout);
-}
-
-static void virNetServerMDNSTimeoutFree(AvahiTimeout *t)
-{
- VIR_DEBUG("Free timeout %p", t);
- virEventRemoveTimeout(t->timer);
-}
-
-
-static AvahiPoll *virNetServerMDNSCreatePoll(void)
-{
- AvahiPoll *p;
- if (VIR_ALLOC(p) < 0)
- return NULL;
-
- p->userdata = NULL;
-
- p->watch_new = virNetServerMDNSWatchNew;
- p->watch_update = virNetServerMDNSWatchUpdate;
- p->watch_get_events = virNetServerMDNSWatchGetEvents;
- p->watch_free = virNetServerMDNSWatchFree;
-
- p->timeout_new = virNetServerMDNSTimeoutNew;
- p->timeout_update = virNetServerMDNSTimeoutUpdate;
- p->timeout_free = virNetServerMDNSTimeoutFree;
-
- return p;
-}
-
-
-virNetServerMDNS *virNetServerMDNSNew(void)
-{
- virNetServerMDNS *mdns;
- if (VIR_ALLOC(mdns) < 0)
- return NULL;
-
- /* Allocate main loop object */
- if (!(mdns->poller = virNetServerMDNSCreatePoll())) {
- VIR_FREE(mdns);
- return NULL;
- }
-
- return mdns;
-}
-
-
-int virNetServerMDNSStart(virNetServerMDNS *mdns)
-{
- int error;
- VIR_DEBUG("Starting client %p", mdns);
- mdns->client = avahi_client_new(mdns->poller,
- AVAHI_CLIENT_NO_FAIL,
- virNetServerMDNSClientCallback,
- mdns, &error);
-
- if (!mdns->client) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to create mDNS client: %s"),
- avahi_strerror(error));
- return -1;
- }
-
- return 0;
-}
-
-
-virNetServerMDNSGroupPtr virNetServerMDNSAddGroup(virNetServerMDNS *mdns,
- const char *name)
-{
- virNetServerMDNSGroupPtr group;
-
- VIR_DEBUG("Adding group '%s'", name);
- if (VIR_ALLOC(group) < 0)
- return NULL;
-
- if (VIR_STRDUP(group->name, name) < 0) {
- VIR_FREE(group);
- return NULL;
- }
- group->mdns = mdns;
- group->next = mdns->group;
- mdns->group = group;
- return group;
-}
-
-
-void virNetServerMDNSRemoveGroup(virNetServerMDNSPtr mdns,
- virNetServerMDNSGroupPtr group)
-{
- virNetServerMDNSGroupPtr tmp = mdns->group, prev = NULL;
-
- while (tmp) {
- if (tmp == group) {
- VIR_FREE(group->name);
- if (prev)
- prev->next = group->next;
- else
- group->mdns->group = group->next;
- VIR_FREE(group);
- return;
- }
- prev = tmp;
- tmp = tmp->next;
- }
-}
-
-
-virNetServerMDNSEntryPtr virNetServerMDNSAddEntry(virNetServerMDNSGroupPtr group,
- const char *type,
- int port)
-{
- virNetServerMDNSEntryPtr entry;
-
- VIR_DEBUG("Adding entry %s %d to group %s", type, port, group->name);
- if (VIR_ALLOC(entry) < 0)
- return NULL;
-
- entry->port = port;
- if (VIR_STRDUP(entry->type, type) < 0) {
- VIR_FREE(entry);
- return NULL;
- }
- entry->next = group->entry;
- group->entry = entry;
- return entry;
-}
-
-
-void virNetServerMDNSRemoveEntry(virNetServerMDNSGroupPtr group,
- virNetServerMDNSEntryPtr entry)
-{
- virNetServerMDNSEntryPtr tmp = group->entry, prev = NULL;
-
- while (tmp) {
- if (tmp == entry) {
- VIR_FREE(entry->type);
- if (prev)
- prev->next = entry->next;
- else
- group->entry = entry->next;
- return;
- }
- prev = tmp;
- tmp = tmp->next;
- }
-}
-
-
-void virNetServerMDNSStop(virNetServerMDNSPtr mdns)
-{
- virNetServerMDNSGroupPtr group = mdns->group;
- while (group) {
- if (group->handle) {
- avahi_entry_group_free(group->handle);
- group->handle = NULL;
- }
- group = group->next;
- }
- if (mdns->client)
- avahi_client_free(mdns->client);
- mdns->client = NULL;
-}
-
-
-void virNetServerMDNSFree(virNetServerMDNSPtr mdns)
-{
- virNetServerMDNSGroupPtr group, tmp;
-
- if (!mdns)
- return;
-
- group = mdns->group;
- while (group) {
- tmp = group->next;
- virNetServerMDNSGroupFree(group);
- group = tmp;
- }
-
- VIR_FREE(mdns->poller);
- VIR_FREE(mdns);
-}
-
-
-void virNetServerMDNSGroupFree(virNetServerMDNSGroupPtr grp)
-{
- virNetServerMDNSEntryPtr entry, tmp;
-
- if (!grp)
- return;
-
- entry = grp->entry;
- while (entry) {
- tmp = entry->next;
- virNetServerMDNSEntryFree(entry);
- entry = tmp;
- }
-
- VIR_FREE(grp->name);
- VIR_FREE(grp);
-}
-
-
-void virNetServerMDNSEntryFree(virNetServerMDNSEntryPtr entry)
-{
- if (!entry)
- return;
-
- VIR_FREE(entry->type);
- VIR_FREE(entry);
-}
-
-#else /* ! WITH_AVAHI */
-
-static const char *unsupported = N_("avahi not available at build time");
-
-virNetServerMDNS *
-virNetServerMDNSNew(void)
-{
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
- return NULL;
-}
-
-int
-virNetServerMDNSStart(virNetServerMDNS *mdns ATTRIBUTE_UNUSED)
-{
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
- return -1;
-}
-
-virNetServerMDNSGroupPtr
-virNetServerMDNSAddGroup(virNetServerMDNS *mdns ATTRIBUTE_UNUSED,
- const char *name ATTRIBUTE_UNUSED)
-{
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
- return NULL;
-}
-
-void
-virNetServerMDNSRemoveGroup(virNetServerMDNSPtr mdns ATTRIBUTE_UNUSED,
- virNetServerMDNSGroupPtr group ATTRIBUTE_UNUSED)
-{
- VIR_DEBUG("%s", _(unsupported));
-}
-
-virNetServerMDNSEntryPtr
-virNetServerMDNSAddEntry(virNetServerMDNSGroupPtr group ATTRIBUTE_UNUSED,
- const char *type ATTRIBUTE_UNUSED,
- int port ATTRIBUTE_UNUSED)
-{
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
- return NULL;
-}
-
-void
-virNetServerMDNSRemoveEntry(virNetServerMDNSGroupPtr group ATTRIBUTE_UNUSED,
- virNetServerMDNSEntryPtr entry ATTRIBUTE_UNUSED)
-{
- VIR_DEBUG("%s", _(unsupported));
-}
-
-void
-virNetServerMDNSStop(virNetServerMDNSPtr mdns ATTRIBUTE_UNUSED)
-{
- VIR_DEBUG("%s", _(unsupported));
-}
-
-void
-virNetServerMDNSFree(virNetServerMDNSPtr mdns ATTRIBUTE_UNUSED)
-{
- VIR_DEBUG("%s", _(unsupported));
-}
-
-void
-virNetServerMDNSGroupFree(virNetServerMDNSGroupPtr grp ATTRIBUTE_UNUSED)
-{
- VIR_DEBUG("%s", _(unsupported));
-}
-
-void
-virNetServerMDNSEntryFree(virNetServerMDNSEntryPtr entry ATTRIBUTE_UNUSED)
-{
- VIR_DEBUG("%s", _(unsupported));
-}
-
-#endif /* ! WITH_AVAHI */
+++ /dev/null
-/*
- * virnetservermdns.h: advertise server sockets
- *
- * Copyright (C) 2011 Red Hat, Inc.
- * Copyright (C) 2007 Daniel P. Berrange
- *
- * Derived from Avahi example service provider code.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include "internal.h"
-
-typedef struct _virNetServerMDNS virNetServerMDNS;
-typedef virNetServerMDNS *virNetServerMDNSPtr;
-typedef struct _virNetServerMDNSGroup virNetServerMDNSGroup;
-typedef virNetServerMDNSGroup *virNetServerMDNSGroupPtr;
-typedef struct _virNetServerMDNSEntry virNetServerMDNSEntry;
-typedef virNetServerMDNSEntry *virNetServerMDNSEntryPtr;
-
-
-/**
- * Prepares a new mdns manager object for use
- */
-virNetServerMDNSPtr virNetServerMDNSNew(void);
-
-/**
- * Starts the mdns client, advertising any groups/entries currently registered
- *
- * @mdns: manager to start advertising
- *
- * Starts the mdns client. Services may not be immediately visible, since
- * it may asynchronously wait for the mdns service to startup
- *
- * returns -1 upon failure, 0 upon success.
- */
-int virNetServerMDNSStart(virNetServerMDNSPtr mdns);
-
-/**
- * Stops the mdns client, removing any advertisements
- *
- * @mdns: manager to start advertising
- *
- */
-void virNetServerMDNSStop(virNetServerMDNSPtr mdns);
-
-/**
- * Adds a group container for advertisement
- *
- * @mdns manager to attach the group to
- * @name unique human readable service name
- *
- * returns the group record, or NULL upon failure
- */
-virNetServerMDNSGroupPtr virNetServerMDNSAddGroup(virNetServerMDNSPtr mdns,
- const char *name);
-
-/**
- * Removes a group container from advertisement
- *
- * @mdns amanger to detach group from
- * @group group to remove
- */
-void virNetServerMDNSRemoveGroup(virNetServerMDNSPtr mdns,
- virNetServerMDNSGroupPtr group);
-
-/**
- * Adds a service entry in a group
- *
- * @group group to attach the entry to
- * @type service type string
- * @port tcp port number
- *
- * returns the service record, or NULL upon failure
- */
-virNetServerMDNSEntryPtr virNetServerMDNSAddEntry(virNetServerMDNSGroupPtr group,
- const char *type, int port);
-
-/**
- * Removes a service entry from a group
- *
- * @group group to detach service entry from
- * @entry service entry to remove
- */
-void virNetServerMDNSRemoveEntry(virNetServerMDNSGroupPtr group,
- virNetServerMDNSEntryPtr entry);
-
-void virNetServerMDNSFree(virNetServerMDNSPtr ptr);
-void virNetServerMDNSGroupFree(virNetServerMDNSGroupPtr ptr);
-void virNetServerMDNSEntryFree(virNetServerMDNSEntryPtr ptr);
-# Flag toggling mDNS advertizement of the libvirt service.
-#
-# Alternatively can disable for all services on a host by
-# stopping the Avahi daemon
-#
-# This is disabled by default, uncomment this to enable it
-mdns_adv = 1
-
-# Override the default mDNS advertizement name. This must be
-# unique on the immediate broadcast network.
-#
-# The default is "Virtualization Host HOSTNAME", where HOSTNAME
-# is subsituted for the short hostname of the machine (without domain)
-#
-mdns_name = "Virtualization Host Joe Demo"
-
-
#################################################################
#
# UNIX socket access controls
# This can be a port number, or service name
#
tcp_port = "16509"
-# Flag toggling mDNS advertizement of the libvirt service.
-#
-# Alternatively can disable for all services on a host by
-# stopping the Avahi daemon
-#
-# This is disabled by default, uncomment this to enable it
-mdns_adv = 1
-# Override the default mDNS advertizement name. This must be
-# unique on the immediate broadcast network.
-#
-# The default is "Virtualization Host HOSTNAME", where HOSTNAME
-# is subsituted for the short hostname of the machine (without domain)
-#
-mdns_name = "Virtualization Host Joe Demo"
#################################################################
#
# UNIX socket access controls
+++ /dev/null
-{
- "servers": [
- {
- "min_workers": 10,
- "max_workers": 50,
- "priority_workers": 5,
- "max_clients": 100,
- "keepaliveInterval": 120,
- "keepaliveCount": 5,
- "keepaliveRequired": true,
- "services": [
- {
- "auth": 0,
- "readonly": true,
- "nrequests_client_max": 2,
- "socks": [
- {
- "fd": 100,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- },
- {
- "auth": 2,
- "readonly": false,
- "nrequests_client_max": 5,
- "socks": [
- {
- "fd": 101,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- }
- ],
- "clients": [
- {
- "auth": 1,
- "readonly": true,
- "nrequests_max": 15,
- "sock": {
- "fd": 102,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- },
- {
- "auth": 2,
- "readonly": true,
- "nrequests_max": 66,
- "sock": {
- "fd": 103,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- }
- ]
- },
- {
- "min_workers": 2,
- "max_workers": 50,
- "priority_workers": 5,
- "max_clients": 100,
- "keepaliveInterval": 120,
- "keepaliveCount": 5,
- "keepaliveRequired": true,
- "services": [
- {
- "auth": 0,
- "readonly": true,
- "nrequests_client_max": 2,
- "socks": [
- {
- "fd": 100,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- },
- {
- "auth": 2,
- "readonly": false,
- "nrequests_client_max": 5,
- "socks": [
- {
- "fd": 101,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- }
- ],
- "clients": [
- {
- "auth": 1,
- "readonly": true,
- "nrequests_max": 15,
- "sock": {
- "fd": 102,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- },
- {
- "auth": 2,
- "readonly": true,
- "nrequests_max": 66,
- "sock": {
- "fd": 103,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- }
- ]
- }
- ]
-}
--- /dev/null
+{
+ "servers": [
+ {
+ "min_workers": 10,
+ "max_workers": 50,
+ "priority_workers": 5,
+ "max_clients": 100,
+ "keepaliveInterval": 120,
+ "keepaliveCount": 5,
+ "keepaliveRequired": true,
+ "services": [
+ {
+ "auth": 0,
+ "readonly": true,
+ "nrequests_client_max": 2,
+ "socks": [
+ {
+ "fd": 100,
+ "errfd": -1,
+ "pid": 0,
+ "isClient": false
+ }
+ ]
+ },
+ {
+ "auth": 2,
+ "readonly": false,
+ "nrequests_client_max": 5,
+ "socks": [
+ {
+ "fd": 101,
+ "errfd": -1,
+ "pid": 0,
+ "isClient": false
+ }
+ ]
+ }
+ ],
+ "clients": [
+ {
+ "auth": 1,
+ "readonly": true,
+ "nrequests_max": 15,
+ "sock": {
+ "fd": 102,
+ "errfd": -1,
+ "pid": -1,
+ "isClient": true
+ },
+ "privateData": 1729
+ },
+ {
+ "auth": 2,
+ "readonly": true,
+ "nrequests_max": 66,
+ "sock": {
+ "fd": 103,
+ "errfd": -1,
+ "pid": -1,
+ "isClient": true
+ },
+ "privateData": 1729
+ }
+ ]
+ },
+ {
+ "min_workers": 2,
+ "max_workers": 50,
+ "priority_workers": 5,
+ "max_clients": 100,
+ "keepaliveInterval": 120,
+ "keepaliveCount": 5,
+ "keepaliveRequired": true,
+ "services": [
+ {
+ "auth": 0,
+ "readonly": true,
+ "nrequests_client_max": 2,
+ "socks": [
+ {
+ "fd": 100,
+ "errfd": -1,
+ "pid": 0,
+ "isClient": false
+ }
+ ]
+ },
+ {
+ "auth": 2,
+ "readonly": false,
+ "nrequests_client_max": 5,
+ "socks": [
+ {
+ "fd": 101,
+ "errfd": -1,
+ "pid": 0,
+ "isClient": false
+ }
+ ]
+ }
+ ],
+ "clients": [
+ {
+ "auth": 1,
+ "readonly": true,
+ "nrequests_max": 15,
+ "sock": {
+ "fd": 102,
+ "errfd": -1,
+ "pid": -1,
+ "isClient": true
+ },
+ "privateData": 1729
+ },
+ {
+ "auth": 2,
+ "readonly": true,
+ "nrequests_max": 66,
+ "sock": {
+ "fd": 103,
+ "errfd": -1,
+ "pid": -1,
+ "isClient": true
+ },
+ "privateData": 1729
+ }
+ ]
+ }
+ ]
+}
+++ /dev/null
-{
- "min_workers": 10,
- "max_workers": 50,
- "priority_workers": 5,
- "max_clients": 100,
- "keepaliveInterval": 120,
- "keepaliveCount": 5,
- "keepaliveRequired": true,
- "services": [
- {
- "auth": 0,
- "readonly": true,
- "nrequests_client_max": 2,
- "socks": [
- {
- "fd": 100,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- },
- {
- "auth": 2,
- "readonly": false,
- "nrequests_client_max": 5,
- "socks": [
- {
- "fd": 101,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- }
- ],
- "clients": [
- {
- "auth": 1,
- "readonly": true,
- "nrequests_max": 15,
- "sock": {
- "fd": 102,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- },
- {
- "auth": 2,
- "readonly": true,
- "nrequests_max": 66,
- "sock": {
- "fd": 103,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- }
- ]
-}
"keepaliveInterval": 120,
"keepaliveCount": 5,
"keepaliveRequired": true,
- "mdnsGroupName": "libvirtTest",
"services": [
{
"auth": 0,
+++ /dev/null
-{
- "servers": {
- "testServer0": {
- "min_workers": 10,
- "max_workers": 50,
- "priority_workers": 5,
- "max_clients": 100,
- "max_anonymous_clients": 100,
- "keepaliveInterval": 120,
- "keepaliveCount": 5,
- "next_client_id": 3,
- "services": [
- {
- "auth": 0,
- "readonly": true,
- "nrequests_client_max": 2,
- "socks": [
- {
- "fd": 100,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- },
- {
- "auth": 2,
- "readonly": false,
- "nrequests_client_max": 5,
- "socks": [
- {
- "fd": 101,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- }
- ],
- "clients": [
- {
- "id": 1,
- "auth": 1,
- "auth_pending": true,
- "readonly": true,
- "nrequests_max": 15,
- "sock": {
- "fd": 102,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- },
- {
- "id": 2,
- "auth": 2,
- "auth_pending": true,
- "readonly": true,
- "nrequests_max": 66,
- "sock": {
- "fd": 103,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- }
- ]
- },
- "testServer1": {
- "min_workers": 2,
- "max_workers": 50,
- "priority_workers": 5,
- "max_clients": 100,
- "max_anonymous_clients": 100,
- "keepaliveInterval": 120,
- "keepaliveCount": 5,
- "next_client_id": 3,
- "services": [
- {
- "auth": 0,
- "readonly": true,
- "nrequests_client_max": 2,
- "socks": [
- {
- "fd": 100,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- },
- {
- "auth": 2,
- "readonly": false,
- "nrequests_client_max": 5,
- "socks": [
- {
- "fd": 101,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- }
- ],
- "clients": [
- {
- "id": 1,
- "auth": 1,
- "auth_pending": true,
- "readonly": true,
- "nrequests_max": 15,
- "sock": {
- "fd": 102,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- },
- {
- "id": 2,
- "auth": 2,
- "auth_pending": true,
- "readonly": true,
- "nrequests_max": 66,
- "sock": {
- "fd": 103,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- }
- ]
- }
- }
-}
--- /dev/null
+{
+ "servers": {
+ "testServer0": {
+ "min_workers": 10,
+ "max_workers": 50,
+ "priority_workers": 5,
+ "max_clients": 100,
+ "max_anonymous_clients": 100,
+ "keepaliveInterval": 120,
+ "keepaliveCount": 5,
+ "next_client_id": 3,
+ "services": [
+ {
+ "auth": 0,
+ "readonly": true,
+ "nrequests_client_max": 2,
+ "socks": [
+ {
+ "fd": 100,
+ "errfd": -1,
+ "pid": 0,
+ "isClient": false
+ }
+ ]
+ },
+ {
+ "auth": 2,
+ "readonly": false,
+ "nrequests_client_max": 5,
+ "socks": [
+ {
+ "fd": 101,
+ "errfd": -1,
+ "pid": 0,
+ "isClient": false
+ }
+ ]
+ }
+ ],
+ "clients": [
+ {
+ "id": 1,
+ "auth": 1,
+ "auth_pending": true,
+ "readonly": true,
+ "nrequests_max": 15,
+ "sock": {
+ "fd": 102,
+ "errfd": -1,
+ "pid": -1,
+ "isClient": true
+ },
+ "privateData": 1729
+ },
+ {
+ "id": 2,
+ "auth": 2,
+ "auth_pending": true,
+ "readonly": true,
+ "nrequests_max": 66,
+ "sock": {
+ "fd": 103,
+ "errfd": -1,
+ "pid": -1,
+ "isClient": true
+ },
+ "privateData": 1729
+ }
+ ]
+ },
+ "testServer1": {
+ "min_workers": 2,
+ "max_workers": 50,
+ "priority_workers": 5,
+ "max_clients": 100,
+ "max_anonymous_clients": 100,
+ "keepaliveInterval": 120,
+ "keepaliveCount": 5,
+ "next_client_id": 3,
+ "services": [
+ {
+ "auth": 0,
+ "readonly": true,
+ "nrequests_client_max": 2,
+ "socks": [
+ {
+ "fd": 100,
+ "errfd": -1,
+ "pid": 0,
+ "isClient": false
+ }
+ ]
+ },
+ {
+ "auth": 2,
+ "readonly": false,
+ "nrequests_client_max": 5,
+ "socks": [
+ {
+ "fd": 101,
+ "errfd": -1,
+ "pid": 0,
+ "isClient": false
+ }
+ ]
+ }
+ ],
+ "clients": [
+ {
+ "id": 1,
+ "auth": 1,
+ "auth_pending": true,
+ "readonly": true,
+ "nrequests_max": 15,
+ "sock": {
+ "fd": 102,
+ "errfd": -1,
+ "pid": -1,
+ "isClient": true
+ },
+ "privateData": 1729
+ },
+ {
+ "id": 2,
+ "auth": 2,
+ "auth_pending": true,
+ "readonly": true,
+ "nrequests_max": 66,
+ "sock": {
+ "fd": 103,
+ "errfd": -1,
+ "pid": -1,
+ "isClient": true
+ },
+ "privateData": 1729
+ }
+ ]
+ }
+ }
+}
+++ /dev/null
-{
- "servers": {
- "testServer0": {
- "min_workers": 10,
- "max_workers": 50,
- "priority_workers": 5,
- "max_clients": 100,
- "max_anonymous_clients": 100,
- "keepaliveInterval": 120,
- "keepaliveCount": 5,
- "next_client_id": 3,
- "services": [
- {
- "auth": 0,
- "readonly": true,
- "nrequests_client_max": 2,
- "socks": [
- {
- "fd": 100,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- },
- {
- "auth": 2,
- "readonly": false,
- "nrequests_client_max": 5,
- "socks": [
- {
- "fd": 101,
- "errfd": -1,
- "pid": 0,
- "isClient": false
- }
- ]
- }
- ],
- "clients": [
- {
- "id": 1,
- "auth": 1,
- "auth_pending": true,
- "readonly": true,
- "nrequests_max": 15,
- "sock": {
- "fd": 102,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- },
- {
- "id": 2,
- "auth": 2,
- "auth_pending": true,
- "readonly": true,
- "nrequests_max": 66,
- "sock": {
- "fd": 103,
- "errfd": -1,
- "pid": -1,
- "isClient": true
- },
- "privateData": 1729
- }
- ]
- }
- }
-}
"keepaliveInterval": 120,
"keepaliveCount": 5,
"next_client_id": 3,
- "mdnsGroupName": "libvirtTest",
"services": [
{
"auth": 0,
virNetServerClientPtr cln1 = NULL, cln2 = NULL;
virNetSocketPtr sk1 = NULL, sk2 = NULL;
int fdclient[2];
- const char *mdns_entry = NULL;
- const char *mdns_group = NULL;
-
-# ifdef WITH_AVAHI
- mdns_entry = "libvirt-ro";
- mdns_group = "libvirtTest";
-# endif
if (socketpair(PF_UNIX, SOCK_STREAM, 0, fdclient) < 0) {
virReportSystemError(errno, "%s",
if (!(srv = virNetServerNew(server_name, 1,
10, 50, 5, 100, 10,
120, 5,
- mdns_group,
testClientNew,
testClientPreExec,
testClientFree,
5)))
goto error;
- if (virNetServerAddService(srv, svc1, mdns_entry) < 0)
+ if (virNetServerAddService(srv, svc1) < 0)
goto error;
- if (virNetServerAddService(srv, svc2, mdns_entry) < 0)
+ if (virNetServerAddService(srv, svc2) < 0)
goto error;
if (virNetSocketNewConnectSockFD(fdclient[0], &sk1) < 0)
# define EXEC_RESTART_TEST_FAIL(file, N) EXEC_RESTART_TEST_FULL(file, N, false)
-# ifdef WITH_AVAHI
EXEC_RESTART_TEST("initial", 1);
-# endif
- EXEC_RESTART_TEST("initial-nomdns", 1);
EXEC_RESTART_TEST("anon-clients", 1);
- EXEC_RESTART_TEST("admin-nomdns", 2);
+ EXEC_RESTART_TEST("admin", 2);
EXEC_RESTART_TEST("admin-server-names", 2);
EXEC_RESTART_TEST("no-keepalive-required", 2);
EXEC_RESTART_TEST("client-ids", 1);