2011-06-22 18:17:36 +00:00
|
|
|
/*
|
2012-05-03 16:10:50 +00:00
|
|
|
* Copyright (C) 2010-2012 Red Hat, Inc.
|
2012-02-03 14:13:19 +00:00
|
|
|
* Copyright (C) 2010-2012 IBM Corporation
|
2011-06-22 18:17:36 +00:00
|
|
|
*
|
|
|
|
* 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
|
2012-09-20 22:30:55 +00:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 10:06:23 +00:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2011-06-22 18:17:36 +00:00
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Stefan Berger <stefanb@us.ibm.com>
|
2012-02-03 14:13:19 +00:00
|
|
|
* Dirk Herrendoerfer <herrend[at]de[dot]ibm[dot]com>
|
2011-06-22 18:17:36 +00:00
|
|
|
*
|
|
|
|
* Notes:
|
|
|
|
* netlink: http://lovezutto.googlepages.com/netlink.pdf
|
|
|
|
* iproute2 package
|
|
|
|
*
|
2012-02-03 14:13:19 +00:00
|
|
|
* 2012/02: Renamed from netlink.[ch] to virnetlink.[ch]
|
|
|
|
*
|
2011-06-22 18:17:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
2012-08-22 04:10:23 +00:00
|
|
|
#include <sys/socket.h>
|
2011-06-22 18:17:36 +00:00
|
|
|
|
2012-02-03 14:13:19 +00:00
|
|
|
#include "virnetlink.h"
|
2012-02-22 13:17:13 +00:00
|
|
|
#include "logging.h"
|
2011-06-22 18:17:36 +00:00
|
|
|
#include "memory.h"
|
2012-02-22 13:17:13 +00:00
|
|
|
#include "threads.h"
|
|
|
|
#include "virmacaddr.h"
|
2011-06-22 18:17:36 +00:00
|
|
|
#include "virterror_internal.h"
|
|
|
|
|
2012-08-22 04:10:23 +00:00
|
|
|
#ifndef SOL_NETLINK
|
|
|
|
# define SOL_NETLINK 270
|
|
|
|
#endif
|
|
|
|
|
2011-06-22 18:17:36 +00:00
|
|
|
#define VIR_FROM_THIS VIR_FROM_NET
|
|
|
|
|
|
|
|
#define NETLINK_ACK_TIMEOUT_S 2
|
|
|
|
|
2012-02-22 13:17:13 +00:00
|
|
|
#if defined(__linux__) && defined(HAVE_LIBNL)
|
|
|
|
/* State for a single netlink event handle */
|
|
|
|
struct virNetlinkEventHandle {
|
|
|
|
int watch;
|
|
|
|
virNetlinkEventHandleCallback handleCB;
|
|
|
|
virNetlinkEventRemoveCallback removeCB;
|
|
|
|
void *opaque;
|
2012-07-17 12:07:59 +00:00
|
|
|
virMacAddr macaddr;
|
2012-02-22 13:17:13 +00:00
|
|
|
int deleted;
|
|
|
|
};
|
|
|
|
|
2012-05-03 16:10:50 +00:00
|
|
|
# ifdef HAVE_LIBNL1
|
|
|
|
# define virNetlinkAlloc nl_handle_alloc
|
|
|
|
# define virNetlinkFree nl_handle_destroy
|
|
|
|
typedef struct nl_handle virNetlinkHandle;
|
|
|
|
# else
|
|
|
|
# define virNetlinkAlloc nl_socket_alloc
|
|
|
|
# define virNetlinkFree nl_socket_free
|
|
|
|
typedef struct nl_sock virNetlinkHandle;
|
|
|
|
# endif
|
|
|
|
|
2012-02-22 13:17:13 +00:00
|
|
|
typedef struct _virNetlinkEventSrvPrivate virNetlinkEventSrvPrivate;
|
|
|
|
typedef virNetlinkEventSrvPrivate *virNetlinkEventSrvPrivatePtr;
|
|
|
|
struct _virNetlinkEventSrvPrivate {
|
|
|
|
/*Server*/
|
|
|
|
virMutex lock;
|
|
|
|
int eventwatch;
|
|
|
|
int netlinkfd;
|
2012-05-03 16:10:50 +00:00
|
|
|
virNetlinkHandle *netlinknh;
|
2012-02-22 13:17:13 +00:00
|
|
|
/*Events*/
|
|
|
|
int handled;
|
|
|
|
size_t handlesCount;
|
|
|
|
size_t handlesAlloc;
|
|
|
|
struct virNetlinkEventHandle *handles;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum virNetlinkDeleteMode {
|
|
|
|
VIR_NETLINK_HANDLE_VALID,
|
|
|
|
VIR_NETLINK_HANDLE_DELETED,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Unique ID for the next netlink watch to be registered */
|
|
|
|
static int nextWatch = 1;
|
|
|
|
|
|
|
|
/* Allocate extra slots for virEventPollHandle/virEventPollTimeout
|
|
|
|
records in this multiple */
|
|
|
|
# define NETLINK_EVENT_ALLOC_EXTENT 10
|
|
|
|
|
2012-08-22 04:10:23 +00:00
|
|
|
/* Linux kernel supports up to MAX_LINKS (32 at the time) individual
|
|
|
|
* netlink protocols. */
|
|
|
|
static virNetlinkEventSrvPrivatePtr server[MAX_LINKS] = {NULL};
|
2012-05-09 09:57:44 +00:00
|
|
|
static virNetlinkHandle *placeholder_nlhandle = NULL;
|
2012-02-22 13:17:13 +00:00
|
|
|
|
|
|
|
/* Function definitions */
|
|
|
|
|
2012-05-03 14:39:04 +00:00
|
|
|
/**
|
|
|
|
* virNetlinkStartup:
|
|
|
|
*
|
|
|
|
* Perform any initialization that needs to take place before the
|
|
|
|
* program starts up worker threads. This is currently used to assure
|
|
|
|
* that an nl_handle is allocated prior to any attempts to bind a
|
|
|
|
* netlink socket. For a discussion of why this is necessary, please
|
|
|
|
* see the following email message:
|
|
|
|
*
|
|
|
|
* https://www.redhat.com/archives/libvir-list/2012-May/msg00202.html
|
|
|
|
*
|
|
|
|
* The short version is that, without this placeholder allocation of
|
|
|
|
* an nl_handle that is never used, it is possible for nl_connect() in
|
|
|
|
* one thread to collide with a direct bind() of a netlink socket in
|
|
|
|
* another thread, leading to failure of the operation (which could
|
|
|
|
* lead to failure of libvirtd to start). Since getaddrinfo() (used by
|
|
|
|
* libvirtd in virSocketAddrParse, which is called quite frequently
|
|
|
|
* during startup) directly calls bind() on a netlink socket, this is
|
|
|
|
* actually a very common occurrence (15-20% failure rate on some
|
|
|
|
* hardware).
|
|
|
|
*
|
|
|
|
* Returns 0 on success, -1 on failure.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
virNetlinkStartup(void)
|
|
|
|
{
|
|
|
|
if (placeholder_nlhandle)
|
|
|
|
return 0;
|
2012-06-15 12:48:34 +00:00
|
|
|
VIR_DEBUG("Running global netlink initialization");
|
2012-05-09 09:57:44 +00:00
|
|
|
placeholder_nlhandle = virNetlinkAlloc();
|
2012-05-03 14:39:04 +00:00
|
|
|
if (!placeholder_nlhandle) {
|
|
|
|
virReportSystemError(errno, "%s",
|
|
|
|
_("cannot allocate placeholder nlhandle for netlink"));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virNetlinkShutdown:
|
|
|
|
*
|
|
|
|
* Undo any initialization done by virNetlinkStartup. This currently
|
|
|
|
* destroys the placeholder nl_handle.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
virNetlinkShutdown(void)
|
|
|
|
{
|
|
|
|
if (placeholder_nlhandle) {
|
2012-05-09 09:57:44 +00:00
|
|
|
virNetlinkFree(placeholder_nlhandle);
|
2012-05-03 14:39:04 +00:00
|
|
|
placeholder_nlhandle = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-22 18:17:36 +00:00
|
|
|
/**
|
2012-02-03 14:13:19 +00:00
|
|
|
* virNetlinkCommand:
|
2011-06-22 18:17:36 +00:00
|
|
|
* @nlmsg: pointer to netlink message
|
|
|
|
* @respbuf: pointer to pointer where response buffer will be allocated
|
|
|
|
* @respbuflen: pointer to integer holding the size of the response buffer
|
|
|
|
* on return of the function.
|
2012-08-22 04:10:23 +00:00
|
|
|
* @src_pid: the pid of the process to send a message
|
|
|
|
* @dst_pid: the pid of the process to talk to, i.e., pid = 0 for kernel
|
|
|
|
* @protocol: netlink protocol
|
|
|
|
* @groups: the group identifier
|
2011-06-22 18:17:36 +00:00
|
|
|
*
|
|
|
|
* Send the given message to the netlink layer and receive response.
|
|
|
|
* Returns 0 on success, -1 on error. In case of error, no response
|
|
|
|
* buffer will be returned.
|
|
|
|
*/
|
2012-02-03 14:13:19 +00:00
|
|
|
int virNetlinkCommand(struct nl_msg *nl_msg,
|
|
|
|
unsigned char **respbuf, unsigned int *respbuflen,
|
2012-08-22 04:10:23 +00:00
|
|
|
uint32_t src_pid, uint32_t dst_pid,
|
|
|
|
unsigned int protocol, unsigned int groups)
|
2011-06-22 18:17:36 +00:00
|
|
|
{
|
|
|
|
int rc = 0;
|
|
|
|
struct sockaddr_nl nladdr = {
|
|
|
|
.nl_family = AF_NETLINK,
|
2012-05-04 16:58:36 +00:00
|
|
|
.nl_pid = dst_pid,
|
2011-06-22 18:17:36 +00:00
|
|
|
.nl_groups = 0,
|
|
|
|
};
|
|
|
|
ssize_t nbytes;
|
|
|
|
struct timeval tv = {
|
|
|
|
.tv_sec = NETLINK_ACK_TIMEOUT_S,
|
|
|
|
};
|
|
|
|
fd_set readfds;
|
|
|
|
int fd;
|
|
|
|
int n;
|
|
|
|
struct nlmsghdr *nlmsg = nlmsg_hdr(nl_msg);
|
2012-08-22 04:10:23 +00:00
|
|
|
virNetlinkHandle *nlhandle = NULL;
|
|
|
|
|
|
|
|
if (protocol >= MAX_LINKS) {
|
|
|
|
virReportSystemError(EINVAL,
|
|
|
|
_("invalid protocol argument: %d"), protocol);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2011-06-22 18:17:36 +00:00
|
|
|
|
2012-08-22 04:10:23 +00:00
|
|
|
nlhandle = virNetlinkAlloc();
|
2011-06-22 18:17:36 +00:00
|
|
|
if (!nlhandle) {
|
|
|
|
virReportSystemError(errno,
|
|
|
|
"%s", _("cannot allocate nlhandle for netlink"));
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-08-22 04:10:23 +00:00
|
|
|
if (nl_connect(nlhandle, protocol) < 0) {
|
|
|
|
virReportSystemError(errno,
|
|
|
|
_("cannot connect to netlink socket with protocol %d"),
|
|
|
|
protocol);
|
|
|
|
rc = -1;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
fd = nl_socket_get_fd(nlhandle);
|
|
|
|
if (fd < 0) {
|
|
|
|
virReportSystemError(errno,
|
|
|
|
"%s", _("cannot get netlink socket fd"));
|
|
|
|
rc = -1;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (groups && nl_socket_add_membership(nlhandle, groups) < 0) {
|
2011-06-22 18:17:36 +00:00
|
|
|
virReportSystemError(errno,
|
2012-08-22 04:10:23 +00:00
|
|
|
"%s", _("cannot add netlink membership"));
|
2011-06-22 18:17:36 +00:00
|
|
|
rc = -1;
|
2012-02-22 13:17:13 +00:00
|
|
|
goto error;
|
2011-06-22 18:17:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nlmsg_set_dst(nl_msg, &nladdr);
|
|
|
|
|
2012-05-04 16:58:36 +00:00
|
|
|
nlmsg->nlmsg_pid = src_pid ? src_pid : getpid();
|
2011-06-22 18:17:36 +00:00
|
|
|
|
|
|
|
nbytes = nl_send_auto_complete(nlhandle, nl_msg);
|
|
|
|
if (nbytes < 0) {
|
|
|
|
virReportSystemError(errno,
|
|
|
|
"%s", _("cannot send to netlink socket"));
|
|
|
|
rc = -1;
|
2012-02-22 13:17:13 +00:00
|
|
|
goto error;
|
2011-06-22 18:17:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FD_ZERO(&readfds);
|
|
|
|
FD_SET(fd, &readfds);
|
|
|
|
|
|
|
|
n = select(fd + 1, &readfds, NULL, NULL, &tv);
|
|
|
|
if (n <= 0) {
|
|
|
|
if (n < 0)
|
|
|
|
virReportSystemError(errno, "%s",
|
|
|
|
_("error in select call"));
|
|
|
|
if (n == 0)
|
|
|
|
virReportSystemError(ETIMEDOUT, "%s",
|
|
|
|
_("no valid netlink response was received"));
|
|
|
|
rc = -1;
|
2012-02-22 13:17:13 +00:00
|
|
|
goto error;
|
2011-06-22 18:17:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
*respbuflen = nl_recv(nlhandle, &nladdr, respbuf, NULL);
|
|
|
|
if (*respbuflen <= 0) {
|
|
|
|
virReportSystemError(errno,
|
|
|
|
"%s", _("nl_recv failed"));
|
|
|
|
rc = -1;
|
|
|
|
}
|
2012-02-22 13:17:13 +00:00
|
|
|
error:
|
2011-06-22 18:17:36 +00:00
|
|
|
if (rc == -1) {
|
|
|
|
VIR_FREE(*respbuf);
|
|
|
|
*respbuf = NULL;
|
|
|
|
*respbuflen = 0;
|
|
|
|
}
|
|
|
|
|
2012-05-03 16:10:50 +00:00
|
|
|
virNetlinkFree(nlhandle);
|
2011-06-22 18:17:36 +00:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2012-02-22 13:17:13 +00:00
|
|
|
static void
|
|
|
|
virNetlinkEventServerLock(virNetlinkEventSrvPrivatePtr driver)
|
|
|
|
{
|
|
|
|
virMutexLock(&driver->lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
virNetlinkEventServerUnlock(virNetlinkEventSrvPrivatePtr driver)
|
|
|
|
{
|
|
|
|
virMutexUnlock(&driver->lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virNetlinkEventRemoveClientPrimitive:
|
|
|
|
*
|
|
|
|
* @i: index of the client to remove from the table
|
2012-08-22 04:10:23 +00:00
|
|
|
* @protocol: netlink protocol
|
2012-02-22 13:17:13 +00:00
|
|
|
*
|
|
|
|
* This static function does the low level removal of a client from
|
|
|
|
* the table once its index is known, including calling the remove
|
|
|
|
* callback (which usually will free resources required by the
|
|
|
|
* handler). The event server lock *must* be locked before calling
|
|
|
|
* this function.
|
|
|
|
*
|
|
|
|
* assumes success, returns nothing.
|
|
|
|
*/
|
2012-08-22 04:10:23 +00:00
|
|
|
static int
|
|
|
|
virNetlinkEventRemoveClientPrimitive(size_t i, unsigned int protocol)
|
2012-02-22 13:17:13 +00:00
|
|
|
{
|
2012-08-22 04:10:23 +00:00
|
|
|
if (protocol >= MAX_LINKS)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
virNetlinkEventRemoveCallback removeCB = server[protocol]->handles[i].removeCB;
|
2012-02-22 13:17:13 +00:00
|
|
|
|
|
|
|
if (removeCB) {
|
2012-08-22 04:10:23 +00:00
|
|
|
(removeCB)(server[protocol]->handles[i].watch,
|
|
|
|
&server[protocol]->handles[i].macaddr,
|
|
|
|
server[protocol]->handles[i].opaque);
|
2012-02-22 13:17:13 +00:00
|
|
|
}
|
2012-08-22 04:10:23 +00:00
|
|
|
server[protocol]->handles[i].deleted = VIR_NETLINK_HANDLE_DELETED;
|
|
|
|
return 0;
|
2012-02-22 13:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
virNetlinkEventCallback(int watch,
|
|
|
|
int fd ATTRIBUTE_UNUSED,
|
|
|
|
int events ATTRIBUTE_UNUSED,
|
|
|
|
void *opaque)
|
|
|
|
{
|
|
|
|
virNetlinkEventSrvPrivatePtr srv = opaque;
|
|
|
|
unsigned char *msg;
|
|
|
|
struct sockaddr_nl peer;
|
|
|
|
struct ucred *creds = NULL;
|
|
|
|
int i, length;
|
|
|
|
bool handled = false;
|
|
|
|
|
|
|
|
length = nl_recv(srv->netlinknh, &peer, &msg, &creds);
|
|
|
|
|
|
|
|
if (length == 0)
|
|
|
|
return;
|
|
|
|
if (length < 0) {
|
2012-04-26 18:35:26 +00:00
|
|
|
virReportSystemError(errno,
|
|
|
|
"%s", _("nl_recv returned with error"));
|
2012-02-22 13:17:13 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
virNetlinkEventServerLock(srv);
|
|
|
|
|
|
|
|
VIR_DEBUG("dispatching to max %d clients, called from event watch %d",
|
|
|
|
(int)srv->handlesCount, watch);
|
|
|
|
|
|
|
|
for (i = 0; i < srv->handlesCount; i++) {
|
|
|
|
if (srv->handles[i].deleted != VIR_NETLINK_HANDLE_VALID)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
VIR_DEBUG("dispatching client %d.", i);
|
|
|
|
|
|
|
|
(srv->handles[i].handleCB)(msg, length, &peer, &handled,
|
|
|
|
srv->handles[i].opaque);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!handled)
|
|
|
|
VIR_DEBUG("event not handled.");
|
|
|
|
VIR_FREE(msg);
|
|
|
|
virNetlinkEventServerUnlock(srv);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virNetlinkEventServiceStop:
|
|
|
|
*
|
|
|
|
* stop the monitor to receive netlink messages for libvirtd.
|
|
|
|
* This removes the netlink socket fd from the event handler.
|
|
|
|
*
|
2012-08-22 04:10:23 +00:00
|
|
|
* @protocol: netlink protocol
|
|
|
|
*
|
2012-02-29 20:21:27 +00:00
|
|
|
* Returns -1 if the monitor cannot be unregistered, 0 upon success
|
2012-02-22 13:17:13 +00:00
|
|
|
*/
|
|
|
|
int
|
2012-08-22 04:10:23 +00:00
|
|
|
virNetlinkEventServiceStop(unsigned int protocol)
|
2012-02-22 13:17:13 +00:00
|
|
|
{
|
2012-08-22 04:10:23 +00:00
|
|
|
if (protocol >= MAX_LINKS)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
virNetlinkEventSrvPrivatePtr srv = server[protocol];
|
2012-02-22 13:17:13 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
VIR_INFO("stopping netlink event service");
|
|
|
|
|
2012-08-22 04:10:23 +00:00
|
|
|
if (!server[protocol])
|
2012-02-22 13:17:13 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
virNetlinkEventServerLock(srv);
|
|
|
|
nl_close(srv->netlinknh);
|
2012-05-03 16:10:50 +00:00
|
|
|
virNetlinkFree(srv->netlinknh);
|
2012-02-22 13:17:13 +00:00
|
|
|
virEventRemoveHandle(srv->eventwatch);
|
|
|
|
|
|
|
|
/* free any remaining clients on the list */
|
|
|
|
for (i = 0; i < srv->handlesCount; i++) {
|
|
|
|
if (srv->handles[i].deleted == VIR_NETLINK_HANDLE_VALID)
|
2012-08-22 04:10:23 +00:00
|
|
|
virNetlinkEventRemoveClientPrimitive(i, protocol);
|
2012-02-22 13:17:13 +00:00
|
|
|
}
|
|
|
|
|
2012-08-22 04:10:23 +00:00
|
|
|
server[protocol] = NULL;
|
2012-02-22 13:17:13 +00:00
|
|
|
virNetlinkEventServerUnlock(srv);
|
|
|
|
|
|
|
|
virMutexDestroy(&srv->lock);
|
|
|
|
VIR_FREE(srv);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-08-22 04:10:24 +00:00
|
|
|
/**
|
|
|
|
* virNetlinkEventServiceStopAll:
|
|
|
|
*
|
|
|
|
* Stop all the monitors to receive netlink messages for libvirtd.
|
|
|
|
*
|
|
|
|
* Returns -1 if any monitor cannot be unregistered, 0 upon success
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
virNetlinkEventServiceStopAll(void)
|
|
|
|
{
|
|
|
|
unsigned int i, j;
|
|
|
|
virNetlinkEventSrvPrivatePtr srv = NULL;
|
|
|
|
|
|
|
|
VIR_INFO("stopping all netlink event services");
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_LINKS; i++) {
|
|
|
|
srv = server[i];
|
|
|
|
if (!srv)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
virNetlinkEventServerLock(srv);
|
|
|
|
nl_close(srv->netlinknh);
|
|
|
|
virNetlinkFree(srv->netlinknh);
|
|
|
|
virEventRemoveHandle(srv->eventwatch);
|
|
|
|
|
|
|
|
for (j = 0; j < srv->handlesCount; j++) {
|
|
|
|
if (srv->handles[j].deleted == VIR_NETLINK_HANDLE_VALID)
|
|
|
|
virNetlinkEventRemoveClientPrimitive(j, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
server[i] = NULL;
|
|
|
|
virNetlinkEventServerUnlock(srv);
|
|
|
|
|
|
|
|
virMutexDestroy(&srv->lock);
|
|
|
|
VIR_FREE(srv);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-02-22 13:17:13 +00:00
|
|
|
/**
|
|
|
|
* virNetlinkEventServiceIsRunning:
|
|
|
|
*
|
2012-02-29 20:21:27 +00:00
|
|
|
* Returns if the netlink event service is running.
|
2012-02-22 13:17:13 +00:00
|
|
|
*
|
2012-08-22 04:10:23 +00:00
|
|
|
* @protocol: netlink protocol
|
|
|
|
*
|
2012-02-29 20:21:27 +00:00
|
|
|
* Returns 'true' if the service is running, 'false' if stopped.
|
2012-02-22 13:17:13 +00:00
|
|
|
*/
|
|
|
|
bool
|
2012-08-22 04:10:23 +00:00
|
|
|
virNetlinkEventServiceIsRunning(unsigned int protocol)
|
2012-02-22 13:17:13 +00:00
|
|
|
{
|
2012-08-22 04:10:23 +00:00
|
|
|
if (protocol >= MAX_LINKS) {
|
|
|
|
virReportSystemError(EINVAL,
|
|
|
|
_("invalid protocol argument: %d"), protocol);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return server[protocol] != NULL;
|
2012-02-22 13:17:13 +00:00
|
|
|
}
|
|
|
|
|
2012-05-04 17:19:51 +00:00
|
|
|
/**
|
|
|
|
* virNetlinkEventServiceLocalPid:
|
|
|
|
*
|
2012-08-22 04:10:23 +00:00
|
|
|
* @protocol: netlink protocol
|
|
|
|
*
|
2012-05-04 17:19:51 +00:00
|
|
|
* Returns the nl_pid value that was used to bind() the netlink socket
|
|
|
|
* used by the netlink event service, or -1 on error (netlink
|
|
|
|
* guarantees that this value will always be > 0).
|
|
|
|
*/
|
2012-08-22 04:10:23 +00:00
|
|
|
int virNetlinkEventServiceLocalPid(unsigned int protocol)
|
2012-05-04 17:19:51 +00:00
|
|
|
{
|
2012-08-22 04:10:23 +00:00
|
|
|
if (protocol >= MAX_LINKS)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (!(server[protocol] && server[protocol]->netlinknh)) {
|
2012-07-18 10:26:24 +00:00
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
|
_("netlink event service not running"));
|
2012-05-04 17:19:51 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2012-08-22 04:10:23 +00:00
|
|
|
return (int)nl_socket_get_local_port(server[protocol]->netlinknh);
|
2012-05-04 17:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-22 13:17:13 +00:00
|
|
|
/**
|
|
|
|
* virNetlinkEventServiceStart:
|
|
|
|
*
|
|
|
|
* start a monitor to receive netlink messages for libvirtd.
|
|
|
|
* This registers a netlink socket with the event interface.
|
|
|
|
*
|
2012-08-22 04:10:23 +00:00
|
|
|
* @protocol: netlink protocol
|
|
|
|
* @groups: broadcast groups to join in
|
2012-02-29 20:21:27 +00:00
|
|
|
* Returns -1 if the monitor cannot be registered, 0 upon success
|
2012-02-22 13:17:13 +00:00
|
|
|
*/
|
|
|
|
int
|
2012-08-22 04:10:23 +00:00
|
|
|
virNetlinkEventServiceStart(unsigned int protocol, unsigned int groups)
|
2012-02-22 13:17:13 +00:00
|
|
|
{
|
|
|
|
virNetlinkEventSrvPrivatePtr srv;
|
|
|
|
int fd;
|
|
|
|
int ret = -1;
|
|
|
|
|
2012-08-22 04:10:23 +00:00
|
|
|
if (protocol >= MAX_LINKS) {
|
|
|
|
virReportSystemError(EINVAL,
|
|
|
|
_("invalid protocol argument: %d"), protocol);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (server[protocol])
|
2012-02-22 13:17:13 +00:00
|
|
|
return 0;
|
|
|
|
|
2012-08-22 04:10:23 +00:00
|
|
|
VIR_INFO("starting netlink event service with protocol %d", protocol);
|
2012-02-22 13:17:13 +00:00
|
|
|
|
|
|
|
if (VIR_ALLOC(srv) < 0) {
|
|
|
|
virReportOOMError();
|
2012-05-02 14:51:38 +00:00
|
|
|
return -1;
|
2012-02-22 13:17:13 +00:00
|
|
|
}
|
|
|
|
|
2012-05-02 14:51:38 +00:00
|
|
|
if (virMutexInit(&srv->lock) < 0) {
|
|
|
|
VIR_FREE(srv);
|
|
|
|
return -1;
|
|
|
|
}
|
2012-02-22 13:17:13 +00:00
|
|
|
|
|
|
|
virNetlinkEventServerLock(srv);
|
|
|
|
|
|
|
|
/* Allocate a new socket and get fd */
|
2012-05-03 16:10:50 +00:00
|
|
|
srv->netlinknh = virNetlinkAlloc();
|
2012-02-22 13:17:13 +00:00
|
|
|
|
|
|
|
if (!srv->netlinknh) {
|
2012-04-26 18:35:26 +00:00
|
|
|
virReportSystemError(errno,
|
|
|
|
"%s", _("cannot allocate nlhandle for virNetlinkEvent server"));
|
2012-02-22 13:17:13 +00:00
|
|
|
goto error_locked;
|
|
|
|
}
|
|
|
|
|
2012-08-22 04:10:23 +00:00
|
|
|
if (nl_connect(srv->netlinknh, protocol) < 0) {
|
2012-04-26 18:35:26 +00:00
|
|
|
virReportSystemError(errno,
|
2012-08-22 04:10:23 +00:00
|
|
|
_("cannot connect to netlink socket with protocol %d"), protocol);
|
2012-02-22 13:17:13 +00:00
|
|
|
goto error_server;
|
|
|
|
}
|
|
|
|
|
|
|
|
fd = nl_socket_get_fd(srv->netlinknh);
|
|
|
|
if (fd < 0) {
|
2012-04-26 18:35:26 +00:00
|
|
|
virReportSystemError(errno,
|
|
|
|
"%s", _("cannot get netlink socket fd"));
|
2012-02-22 13:17:13 +00:00
|
|
|
goto error_server;
|
|
|
|
}
|
|
|
|
|
2012-08-22 04:10:23 +00:00
|
|
|
if (groups && nl_socket_add_membership(srv->netlinknh, groups) < 0) {
|
|
|
|
virReportSystemError(errno,
|
|
|
|
"%s", _("cannot add netlink membership"));
|
|
|
|
goto error_server;
|
|
|
|
}
|
|
|
|
|
2012-02-22 13:17:13 +00:00
|
|
|
if (nl_socket_set_nonblocking(srv->netlinknh)) {
|
2012-04-26 18:35:26 +00:00
|
|
|
virReportSystemError(errno, "%s",
|
|
|
|
_("cannot set netlink socket nonblocking"));
|
2012-02-22 13:17:13 +00:00
|
|
|
goto error_server;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((srv->eventwatch = virEventAddHandle(fd,
|
|
|
|
VIR_EVENT_HANDLE_READABLE,
|
|
|
|
virNetlinkEventCallback,
|
|
|
|
srv, NULL)) < 0) {
|
2012-07-18 10:26:24 +00:00
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
|
_("Failed to add netlink event handle watch"));
|
2012-02-22 13:17:13 +00:00
|
|
|
goto error_server;
|
|
|
|
}
|
|
|
|
|
|
|
|
srv->netlinkfd = fd;
|
|
|
|
VIR_DEBUG("netlink event listener on fd: %i running", fd);
|
|
|
|
|
|
|
|
ret = 0;
|
2012-08-22 04:10:23 +00:00
|
|
|
server[protocol] = srv;
|
2012-02-22 13:17:13 +00:00
|
|
|
|
|
|
|
error_server:
|
|
|
|
if (ret < 0) {
|
|
|
|
nl_close(srv->netlinknh);
|
2012-05-03 16:10:50 +00:00
|
|
|
virNetlinkFree(srv->netlinknh);
|
2012-02-22 13:17:13 +00:00
|
|
|
}
|
|
|
|
error_locked:
|
|
|
|
virNetlinkEventServerUnlock(srv);
|
|
|
|
if (ret < 0) {
|
|
|
|
virMutexDestroy(&srv->lock);
|
|
|
|
VIR_FREE(srv);
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virNetlinkEventAddClient:
|
|
|
|
*
|
|
|
|
* @handleCB: callback to invoke when an event occurs
|
|
|
|
* @removeCB: callback to invoke when removing a client
|
|
|
|
* @opaque: user data to pass to callback
|
2012-02-29 20:21:27 +00:00
|
|
|
* @macaddr: macaddr to store with the data. Used to identify callers.
|
|
|
|
* May be null.
|
2012-08-22 04:10:23 +00:00
|
|
|
* @protocol: netlink protocol
|
2012-02-22 13:17:13 +00:00
|
|
|
*
|
|
|
|
* register a callback for handling of netlink messages. The
|
|
|
|
* registered function receives the entire netlink message and
|
|
|
|
* may choose to act upon it.
|
|
|
|
*
|
2012-02-29 20:21:27 +00:00
|
|
|
* Returns -1 if the file handle cannot be registered, number of
|
|
|
|
* monitor upon success.
|
2012-02-22 13:17:13 +00:00
|
|
|
*/
|
|
|
|
int
|
|
|
|
virNetlinkEventAddClient(virNetlinkEventHandleCallback handleCB,
|
|
|
|
virNetlinkEventRemoveCallback removeCB,
|
2012-08-22 04:10:23 +00:00
|
|
|
void *opaque, const virMacAddrPtr macaddr,
|
|
|
|
unsigned int protocol)
|
2012-02-22 13:17:13 +00:00
|
|
|
{
|
|
|
|
int i, r, ret = -1;
|
2012-08-22 04:10:23 +00:00
|
|
|
virNetlinkEventSrvPrivatePtr srv = NULL;
|
|
|
|
|
|
|
|
if (protocol >= MAX_LINKS)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
srv = server[protocol];
|
2012-02-22 13:17:13 +00:00
|
|
|
|
2012-03-27 12:38:33 +00:00
|
|
|
if (handleCB == NULL) {
|
2012-07-18 10:26:24 +00:00
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
|
_("Invalid NULL callback provided"));
|
2012-02-22 13:17:13 +00:00
|
|
|
return -1;
|
2012-03-27 12:38:33 +00:00
|
|
|
}
|
2012-02-22 13:17:13 +00:00
|
|
|
|
|
|
|
virNetlinkEventServerLock(srv);
|
|
|
|
|
|
|
|
VIR_DEBUG("adding client: %d.", nextWatch);
|
|
|
|
|
|
|
|
r = 0;
|
|
|
|
/* first try to re-use deleted free slots */
|
|
|
|
for (i = 0; i < srv->handlesCount; i++) {
|
|
|
|
if (srv->handles[i].deleted == VIR_NETLINK_HANDLE_DELETED) {
|
|
|
|
r = i;
|
|
|
|
goto addentry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Resize the eventLoop array if needed */
|
|
|
|
if (srv->handlesCount == srv->handlesAlloc) {
|
|
|
|
VIR_DEBUG("Used %zu handle slots, adding at least %d more",
|
|
|
|
srv->handlesAlloc, NETLINK_EVENT_ALLOC_EXTENT);
|
|
|
|
if (VIR_RESIZE_N(srv->handles, srv->handlesAlloc,
|
|
|
|
srv->handlesCount, NETLINK_EVENT_ALLOC_EXTENT) < 0) {
|
2012-03-27 12:38:33 +00:00
|
|
|
virReportOOMError();
|
2012-02-22 13:17:13 +00:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
r = srv->handlesCount++;
|
|
|
|
|
|
|
|
addentry:
|
|
|
|
srv->handles[r].watch = nextWatch;
|
|
|
|
srv->handles[r].handleCB = handleCB;
|
|
|
|
srv->handles[r].removeCB = removeCB;
|
|
|
|
srv->handles[r].opaque = opaque;
|
|
|
|
srv->handles[r].deleted = VIR_NETLINK_HANDLE_VALID;
|
|
|
|
if (macaddr)
|
2012-07-17 12:07:59 +00:00
|
|
|
virMacAddrSet(&srv->handles[r].macaddr, macaddr);
|
2012-02-22 13:17:13 +00:00
|
|
|
else
|
2012-07-17 12:07:59 +00:00
|
|
|
virMacAddrSetRaw(&srv->handles[r].macaddr,
|
|
|
|
(unsigned char[VIR_MAC_BUFLEN]){0,0,0,0,0,0});
|
2012-02-22 13:17:13 +00:00
|
|
|
|
|
|
|
VIR_DEBUG("added client to loop slot: %d. with macaddr ptr=%p", r, macaddr);
|
|
|
|
|
|
|
|
ret = nextWatch++;
|
|
|
|
error:
|
|
|
|
virNetlinkEventServerUnlock(srv);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virNetlinkEventRemoveClient:
|
|
|
|
*
|
|
|
|
* @watch: watch whose handle to remove
|
|
|
|
* @macaddr: macaddr whose handle to remove
|
2012-08-22 04:10:23 +00:00
|
|
|
* @protocol: netlink protocol
|
2012-02-22 13:17:13 +00:00
|
|
|
*
|
|
|
|
* Unregister a callback from a netlink monitor.
|
|
|
|
* The handler function referenced will no longer receive netlink messages.
|
|
|
|
* Either watch or macaddr may be used, the other should be null.
|
|
|
|
*
|
2012-02-29 20:21:27 +00:00
|
|
|
* Returns -1 if the file handle was not registered, 0 upon success
|
2012-02-22 13:17:13 +00:00
|
|
|
*/
|
|
|
|
int
|
2012-08-22 04:10:23 +00:00
|
|
|
virNetlinkEventRemoveClient(int watch, const virMacAddrPtr macaddr,
|
|
|
|
unsigned int protocol)
|
2012-02-22 13:17:13 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int ret = -1;
|
2012-08-22 04:10:23 +00:00
|
|
|
virNetlinkEventSrvPrivatePtr srv = NULL;
|
|
|
|
|
|
|
|
if (protocol >= MAX_LINKS)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
srv = server[protocol];
|
2012-02-22 13:17:13 +00:00
|
|
|
|
|
|
|
VIR_DEBUG("removing client watch=%d, mac=%p.", watch, macaddr);
|
|
|
|
|
|
|
|
if (watch <= 0 && !macaddr) {
|
|
|
|
VIR_WARN("Ignoring invalid netlink client id: %d", watch);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
virNetlinkEventServerLock(srv);
|
|
|
|
|
|
|
|
for (i = 0; i < srv->handlesCount; i++) {
|
|
|
|
if (srv->handles[i].deleted != VIR_NETLINK_HANDLE_VALID)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((watch && srv->handles[i].watch == watch) ||
|
|
|
|
(!watch &&
|
2012-07-17 12:07:59 +00:00
|
|
|
virMacAddrCmp(macaddr, &srv->handles[i].macaddr) == 0)) {
|
2012-02-22 13:17:13 +00:00
|
|
|
|
|
|
|
VIR_DEBUG("removed client: %d by %s.",
|
|
|
|
srv->handles[i].watch, watch ? "index" : "mac");
|
2012-08-22 04:10:23 +00:00
|
|
|
virNetlinkEventRemoveClientPrimitive(i, protocol);
|
2012-02-22 13:17:13 +00:00
|
|
|
ret = 0;
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
VIR_DEBUG("no client found to remove.");
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
virNetlinkEventServerUnlock(srv);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-06-22 18:17:36 +00:00
|
|
|
#else
|
|
|
|
|
2012-03-06 17:21:21 +00:00
|
|
|
# if defined(__linux)
|
|
|
|
static const char *unsupported = N_("libnl was not available at build time");
|
|
|
|
# else
|
|
|
|
static const char *unsupported = N_("not supported on non-linux platforms");
|
|
|
|
# endif
|
|
|
|
|
2012-05-03 14:39:04 +00:00
|
|
|
int
|
|
|
|
virNetlinkStartup(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
virNetlinkShutdown(void)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-02-03 14:13:19 +00:00
|
|
|
int virNetlinkCommand(struct nl_msg *nl_msg ATTRIBUTE_UNUSED,
|
2012-05-04 16:58:36 +00:00
|
|
|
unsigned char **respbuf ATTRIBUTE_UNUSED,
|
|
|
|
unsigned int *respbuflen ATTRIBUTE_UNUSED,
|
|
|
|
uint32_t src_pid ATTRIBUTE_UNUSED,
|
2012-08-22 04:10:23 +00:00
|
|
|
uint32_t dst_pid ATTRIBUTE_UNUSED,
|
|
|
|
unsigned int protocol ATTRIBUTE_UNUSED,
|
|
|
|
unsigned int groups ATTRIBUTE_UNUSED)
|
2011-06-22 18:17:36 +00:00
|
|
|
{
|
2012-07-18 10:26:24 +00:00
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
|
2011-06-22 18:17:36 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-02-22 13:17:13 +00:00
|
|
|
/**
|
2012-02-29 20:21:27 +00:00
|
|
|
* stopNetlinkEventServer: stop the monitor to receive netlink
|
|
|
|
* messages for libvirtd
|
2012-02-22 13:17:13 +00:00
|
|
|
*/
|
2012-08-22 04:10:23 +00:00
|
|
|
int virNetlinkEventServiceStop(unsigned int protocol ATTRIBUTE_UNUSED)
|
2012-02-22 13:17:13 +00:00
|
|
|
{
|
2012-05-03 15:52:17 +00:00
|
|
|
VIR_DEBUG("%s", _(unsupported));
|
2012-02-22 13:17:13 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-08-22 04:10:24 +00:00
|
|
|
/**
|
|
|
|
* stopNetlinkEventServerAll: stop all the monitors to receive netlink
|
|
|
|
* messages for libvirtd
|
|
|
|
*/
|
|
|
|
int virNetlinkEventServiceStopAll(void)
|
|
|
|
{
|
|
|
|
VIR_DEBUG("%s", _(unsupported));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-02-22 13:17:13 +00:00
|
|
|
/**
|
2012-02-29 20:21:27 +00:00
|
|
|
* startNetlinkEventServer: start a monitor to receive netlink
|
|
|
|
* messages for libvirtd
|
2012-02-22 13:17:13 +00:00
|
|
|
*/
|
2012-08-22 04:10:23 +00:00
|
|
|
int virNetlinkEventServiceStart(unsigned int protocol ATTRIBUTE_UNUSED,
|
|
|
|
unsigned int groups ATTRIBUTE_UNUSED)
|
2012-02-22 13:17:13 +00:00
|
|
|
{
|
2012-05-03 15:52:17 +00:00
|
|
|
VIR_DEBUG("%s", _(unsupported));
|
2012-02-22 13:17:13 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2012-02-29 20:21:27 +00:00
|
|
|
* virNetlinkEventServiceIsRunning: returns if the netlink event
|
|
|
|
* service is running.
|
2012-02-22 13:17:13 +00:00
|
|
|
*/
|
2012-08-22 04:10:23 +00:00
|
|
|
bool virNetlinkEventServiceIsRunning(unsigned int protocol ATTRIBUTE_UNUSED)
|
2012-02-22 13:17:13 +00:00
|
|
|
{
|
2012-07-18 10:26:24 +00:00
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
|
2012-02-22 13:17:13 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-08-22 04:10:23 +00:00
|
|
|
int virNetlinkEventServiceLocalPid(unsigned int protocol ATTRIBUTE_UNUSED)
|
2012-05-24 12:14:57 +00:00
|
|
|
{
|
2012-07-18 10:26:24 +00:00
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
|
2012-05-24 12:14:57 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-02-22 13:17:13 +00:00
|
|
|
/**
|
2012-02-29 20:21:27 +00:00
|
|
|
* virNetlinkEventAddClient: register a callback for handling of
|
|
|
|
* netlink messages
|
2012-02-22 13:17:13 +00:00
|
|
|
*/
|
2012-03-05 19:08:54 +00:00
|
|
|
int virNetlinkEventAddClient(virNetlinkEventHandleCallback handleCB ATTRIBUTE_UNUSED,
|
|
|
|
virNetlinkEventRemoveCallback removeCB ATTRIBUTE_UNUSED,
|
|
|
|
void *opaque ATTRIBUTE_UNUSED,
|
2012-08-22 15:09:17 +00:00
|
|
|
const virMacAddrPtr macaddr ATTRIBUTE_UNUSED,
|
2012-08-22 04:10:23 +00:00
|
|
|
unsigned int protocol ATTRIBUTE_UNUSED)
|
2012-02-22 13:17:13 +00:00
|
|
|
{
|
2012-07-18 10:26:24 +00:00
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
|
2012-02-22 13:17:13 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virNetlinkEventRemoveClient: unregister a callback from a netlink monitor
|
|
|
|
*/
|
2012-03-05 19:08:54 +00:00
|
|
|
int virNetlinkEventRemoveClient(int watch ATTRIBUTE_UNUSED,
|
2012-08-22 15:09:17 +00:00
|
|
|
const virMacAddrPtr macaddr ATTRIBUTE_UNUSED,
|
2012-08-22 04:10:23 +00:00
|
|
|
unsigned int protocol ATTRIBUTE_UNUSED)
|
2012-02-22 13:17:13 +00:00
|
|
|
{
|
2012-07-18 10:26:24 +00:00
|
|
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
|
2012-02-22 13:17:13 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-06-22 18:17:36 +00:00
|
|
|
#endif /* __linux__ */
|