}
}
- if (virNetlinkCommand(nl_msg, recvbuf, &recvbuflen, pid) < 0)
+ if (virNetlinkCommand(nl_msg, recvbuf, &recvbuflen, 0, pid) < 0)
goto cleanup;
if (recvbuflen < NLMSG_LENGTH(0) || *recvbuf == NULL)
}
}
- if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, pid) < 0)
+ if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0, pid) < 0)
goto cleanup;
if (recvbuflen < NLMSG_LENGTH(0) || recvbuf == NULL)
/*
- * Copyright (C) 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2010-2012 Red Hat, Inc.
* Copyright (C) 2010-2012 IBM Corporation
*
* This library is free software; you can redistribute it and/or
nla_nest_end(nl_msg, linkinfo);
- if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0) < 0) {
+ if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0, 0) < 0) {
goto cleanup;
}
if (nla_put(nl_msg, IFLA_IFNAME, strlen(ifname)+1, ifname) < 0)
goto buffer_too_small;
- if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0) < 0) {
+ if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0, 0) < 0) {
goto cleanup;
}
/*
- * Copyright (C) 2009-2011 Red Hat, Inc.
+ * Copyright (C) 2009-2012 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
goto cleanup;
}
- if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, pid) < 0)
+ if (virNetlinkCommand(nl_msg, &recvbuf, &recvbuflen, 0, pid) < 0)
goto cleanup;
if (recvbuflen < NLMSG_LENGTH(0) || recvbuf == NULL)
*/
int virNetlinkCommand(struct nl_msg *nl_msg,
unsigned char **respbuf, unsigned int *respbuflen,
- int nl_pid)
+ uint32_t src_pid, uint32_t dst_pid)
{
int rc = 0;
struct sockaddr_nl nladdr = {
.nl_family = AF_NETLINK,
- .nl_pid = nl_pid,
+ .nl_pid = dst_pid,
.nl_groups = 0,
};
ssize_t nbytes;
nlmsg_set_dst(nl_msg, &nladdr);
- nlmsg->nlmsg_pid = getpid();
+ nlmsg->nlmsg_pid = src_pid ? src_pid : getpid();
nbytes = nl_send_auto_complete(nlhandle, nl_msg);
if (nbytes < 0) {
}
int virNetlinkCommand(struct nl_msg *nl_msg ATTRIBUTE_UNUSED,
- unsigned char **respbuf ATTRIBUTE_UNUSED,
- unsigned int *respbuflen ATTRIBUTE_UNUSED,
- int nl_pid ATTRIBUTE_UNUSED)
+ unsigned char **respbuf ATTRIBUTE_UNUSED,
+ unsigned int *respbuflen ATTRIBUTE_UNUSED,
+ uint32_t src_pid ATTRIBUTE_UNUSED,
+ uint32_t dst_pid ATTRIBUTE_UNUSED)
{
netlinkError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
int virNetlinkCommand(struct nl_msg *nl_msg,
unsigned char **respbuf, unsigned int *respbuflen,
- int nl_pid);
+ uint32_t src_port, uint32_t dst_port);
typedef void (*virNetlinkEventHandleCallback)(unsigned char *msg, int length, struct sockaddr_nl *peer, bool *handled, void *opaque);