Revert "qapi: net: Add query-netdev command"
Several issues has been reported for query-netdev series. Consider
it's late in the rc, this reverts commit
d32ad10a14
.
Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
parent
22317309df
commit
f9bb0c1f98
@ -5,8 +5,6 @@
|
|||||||
#include "qapi/qapi-types-net.h"
|
#include "qapi/qapi-types-net.h"
|
||||||
#include "net/queue.h"
|
#include "net/queue.h"
|
||||||
#include "hw/qdev-properties-system.h"
|
#include "hw/qdev-properties-system.h"
|
||||||
#include "qapi/clone-visitor.h"
|
|
||||||
#include "qapi/qapi-visit-net.h"
|
|
||||||
|
|
||||||
#define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X"
|
#define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X"
|
||||||
#define MAC_ARG(x) ((uint8_t *)(x))[0], ((uint8_t *)(x))[1], \
|
#define MAC_ARG(x) ((uint8_t *)(x))[0], ((uint8_t *)(x))[1], \
|
||||||
@ -95,7 +93,6 @@ struct NetClientState {
|
|||||||
char *model;
|
char *model;
|
||||||
char *name;
|
char *name;
|
||||||
char info_str[256];
|
char info_str[256];
|
||||||
NetdevInfo *stored_config;
|
|
||||||
unsigned receive_disabled : 1;
|
unsigned receive_disabled : 1;
|
||||||
NetClientDestructor *destructor;
|
NetClientDestructor *destructor;
|
||||||
unsigned int queue_index;
|
unsigned int queue_index;
|
||||||
|
@ -723,13 +723,6 @@ int net_init_l2tpv3(const Netdev *netdev,
|
|||||||
|
|
||||||
l2tpv3_read_poll(s, true);
|
l2tpv3_read_poll(s, true);
|
||||||
|
|
||||||
/* Store startup parameters */
|
|
||||||
nc->stored_config = g_new0(NetdevInfo, 1);
|
|
||||||
nc->stored_config->type = NET_BACKEND_L2TPV3;
|
|
||||||
|
|
||||||
QAPI_CLONE_MEMBERS(NetdevL2TPv3Options,
|
|
||||||
&nc->stored_config->u.l2tpv3, l2tpv3);
|
|
||||||
|
|
||||||
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
||||||
"l2tpv3: connected");
|
"l2tpv3: connected");
|
||||||
return 0;
|
return 0;
|
||||||
|
30
net/net.c
30
net/net.c
@ -36,6 +36,7 @@
|
|||||||
#include "monitor/monitor.h"
|
#include "monitor/monitor.h"
|
||||||
#include "qemu/help_option.h"
|
#include "qemu/help_option.h"
|
||||||
#include "qapi/qapi-commands-net.h"
|
#include "qapi/qapi-commands-net.h"
|
||||||
|
#include "qapi/qapi-visit-net.h"
|
||||||
#include "qapi/qmp/qdict.h"
|
#include "qapi/qmp/qdict.h"
|
||||||
#include "qapi/qmp/qerror.h"
|
#include "qapi/qmp/qerror.h"
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
@ -352,7 +353,6 @@ static void qemu_free_net_client(NetClientState *nc)
|
|||||||
}
|
}
|
||||||
g_free(nc->name);
|
g_free(nc->name);
|
||||||
g_free(nc->model);
|
g_free(nc->model);
|
||||||
qapi_free_NetdevInfo(nc->stored_config);
|
|
||||||
if (nc->destructor) {
|
if (nc->destructor) {
|
||||||
nc->destructor(nc);
|
nc->destructor(nc);
|
||||||
}
|
}
|
||||||
@ -1289,34 +1289,6 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name,
|
|||||||
return filter_list;
|
return filter_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetdevInfoList *qmp_query_netdev(Error **errp)
|
|
||||||
{
|
|
||||||
NetdevInfoList *list = NULL;
|
|
||||||
NetClientState *nc;
|
|
||||||
|
|
||||||
QTAILQ_FOREACH(nc, &net_clients, next) {
|
|
||||||
/*
|
|
||||||
* Only look at netdevs (backend network devices), not for each queue
|
|
||||||
* or NIC / hubport
|
|
||||||
*/
|
|
||||||
if (nc->stored_config) {
|
|
||||||
NetdevInfo *element = QAPI_CLONE(NetdevInfo, nc->stored_config);
|
|
||||||
|
|
||||||
g_free(element->id); /* Need to dealloc empty id after clone */
|
|
||||||
element->id = g_strdup(nc->name);
|
|
||||||
|
|
||||||
element->has_peer_id = nc->peer != NULL;
|
|
||||||
if (element->has_peer_id) {
|
|
||||||
element->peer_id = g_strdup(nc->peer->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
QAPI_LIST_PREPEND(list, element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
void hmp_info_network(Monitor *mon, const QDict *qdict)
|
void hmp_info_network(Monitor *mon, const QDict *qdict)
|
||||||
{
|
{
|
||||||
NetClientState *nc, *peer;
|
NetClientState *nc, *peer;
|
||||||
|
@ -427,13 +427,6 @@ int net_init_netmap(const Netdev *netdev,
|
|||||||
pstrcpy(s->ifname, sizeof(s->ifname), netmap_opts->ifname);
|
pstrcpy(s->ifname, sizeof(s->ifname), netmap_opts->ifname);
|
||||||
netmap_read_poll(s, true); /* Initially only poll for reads. */
|
netmap_read_poll(s, true); /* Initially only poll for reads. */
|
||||||
|
|
||||||
/* Store startup parameters */
|
|
||||||
nc->stored_config = g_new0(NetdevInfo, 1);
|
|
||||||
nc->stored_config->type = NET_BACKEND_NETMAP;
|
|
||||||
|
|
||||||
QAPI_CLONE_MEMBERS(NetdevNetmapOptions,
|
|
||||||
&nc->stored_config->u.netmap, netmap_opts);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
122
net/slirp.c
122
net/slirp.c
@ -387,9 +387,6 @@ static int net_slirp_init(NetClientState *peer, const char *model,
|
|||||||
int shift;
|
int shift;
|
||||||
char *end;
|
char *end;
|
||||||
struct slirp_config_str *config;
|
struct slirp_config_str *config;
|
||||||
NetdevUserOptions *stored;
|
|
||||||
StringList **stored_hostfwd;
|
|
||||||
StringList **stored_guestfwd;
|
|
||||||
|
|
||||||
if (!ipv4 && (vnetwork || vhost || vnameserver)) {
|
if (!ipv4 && (vnetwork || vhost || vnameserver)) {
|
||||||
error_setg(errp, "IPv4 disabled but netmask/host/dns provided");
|
error_setg(errp, "IPv4 disabled but netmask/host/dns provided");
|
||||||
@ -565,115 +562,6 @@ static int net_slirp_init(NetClientState *peer, const char *model,
|
|||||||
|
|
||||||
nc = qemu_new_net_client(&net_slirp_info, peer, model, name);
|
nc = qemu_new_net_client(&net_slirp_info, peer, model, name);
|
||||||
|
|
||||||
/* Store startup parameters */
|
|
||||||
nc->stored_config = g_new0(NetdevInfo, 1);
|
|
||||||
nc->stored_config->type = NET_BACKEND_USER;
|
|
||||||
stored = &nc->stored_config->u.user;
|
|
||||||
|
|
||||||
if (vhostname) {
|
|
||||||
stored->has_hostname = true;
|
|
||||||
stored->hostname = g_strdup(vhostname);
|
|
||||||
}
|
|
||||||
|
|
||||||
stored->has_q_restrict = true;
|
|
||||||
stored->q_restrict = restricted;
|
|
||||||
|
|
||||||
stored->has_ipv4 = true;
|
|
||||||
stored->ipv4 = ipv4;
|
|
||||||
|
|
||||||
stored->has_ipv6 = true;
|
|
||||||
stored->ipv6 = ipv6;
|
|
||||||
|
|
||||||
if (ipv4) {
|
|
||||||
uint8_t *net_bytes = (uint8_t *)&net;
|
|
||||||
uint8_t *mask_bytes = (uint8_t *)&mask;
|
|
||||||
|
|
||||||
stored->has_net = true;
|
|
||||||
stored->net = g_strdup_printf("%d.%d.%d.%d/%d.%d.%d.%d",
|
|
||||||
net_bytes[0], net_bytes[1],
|
|
||||||
net_bytes[2], net_bytes[3],
|
|
||||||
mask_bytes[0], mask_bytes[1],
|
|
||||||
mask_bytes[2], mask_bytes[3]);
|
|
||||||
|
|
||||||
stored->has_host = true;
|
|
||||||
stored->host = g_strdup(inet_ntoa(host));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tftp_export) {
|
|
||||||
stored->has_tftp = true;
|
|
||||||
stored->tftp = g_strdup(tftp_export);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bootfile) {
|
|
||||||
stored->has_bootfile = true;
|
|
||||||
stored->bootfile = g_strdup(bootfile);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vdhcp_start) {
|
|
||||||
stored->has_dhcpstart = true;
|
|
||||||
stored->dhcpstart = g_strdup(vdhcp_start);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ipv4) {
|
|
||||||
stored->has_dns = true;
|
|
||||||
stored->dns = g_strdup(inet_ntoa(dns));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dnssearch) {
|
|
||||||
stored->has_dnssearch = true;
|
|
||||||
StringList **stored_list = &stored->dnssearch;
|
|
||||||
|
|
||||||
for (int i = 0; dnssearch[i]; i++) {
|
|
||||||
String *element = g_new0(String, 1);
|
|
||||||
|
|
||||||
element->str = g_strdup(dnssearch[i]);
|
|
||||||
QAPI_LIST_APPEND(stored_list, element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vdomainname) {
|
|
||||||
stored->has_domainname = true;
|
|
||||||
stored->domainname = g_strdup(vdomainname);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ipv6) {
|
|
||||||
char addrstr[INET6_ADDRSTRLEN];
|
|
||||||
const char *res;
|
|
||||||
|
|
||||||
stored->has_ipv6_prefix = true;
|
|
||||||
stored->ipv6_prefix = g_strdup(vprefix6);
|
|
||||||
|
|
||||||
stored->has_ipv6_prefixlen = true;
|
|
||||||
stored->ipv6_prefixlen = vprefix6_len;
|
|
||||||
|
|
||||||
res = inet_ntop(AF_INET6, &ip6_host,
|
|
||||||
addrstr, sizeof(addrstr));
|
|
||||||
|
|
||||||
stored->has_ipv6_host = true;
|
|
||||||
stored->ipv6_host = g_strdup(res);
|
|
||||||
|
|
||||||
res = inet_ntop(AF_INET6, &ip6_dns,
|
|
||||||
addrstr, sizeof(addrstr));
|
|
||||||
|
|
||||||
stored->has_ipv6_dns = true;
|
|
||||||
stored->ipv6_dns = g_strdup(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (smb_export) {
|
|
||||||
stored->has_smb = true;
|
|
||||||
stored->smb = g_strdup(smb_export);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vsmbserver) {
|
|
||||||
stored->has_smbserver = true;
|
|
||||||
stored->smbserver = g_strdup(vsmbserver);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tftp_server_name) {
|
|
||||||
stored->has_tftp_server_name = true;
|
|
||||||
stored->tftp_server_name = g_strdup(tftp_server_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(nc->info_str, sizeof(nc->info_str),
|
snprintf(nc->info_str, sizeof(nc->info_str),
|
||||||
"net=%s,restrict=%s", inet_ntoa(net),
|
"net=%s,restrict=%s", inet_ntoa(net),
|
||||||
restricted ? "on" : "off");
|
restricted ? "on" : "off");
|
||||||
@ -703,25 +591,15 @@ static int net_slirp_init(NetClientState *peer, const char *model,
|
|||||||
s->poll_notifier.notify = net_slirp_poll_notify;
|
s->poll_notifier.notify = net_slirp_poll_notify;
|
||||||
main_loop_poll_add_notifier(&s->poll_notifier);
|
main_loop_poll_add_notifier(&s->poll_notifier);
|
||||||
|
|
||||||
stored_hostfwd = &stored->hostfwd;
|
|
||||||
stored_guestfwd = &stored->guestfwd;
|
|
||||||
|
|
||||||
for (config = slirp_configs; config; config = config->next) {
|
for (config = slirp_configs; config; config = config->next) {
|
||||||
String *element = g_new0(String, 1);
|
|
||||||
|
|
||||||
element->str = g_strdup(config->str);
|
|
||||||
if (config->flags & SLIRP_CFG_HOSTFWD) {
|
if (config->flags & SLIRP_CFG_HOSTFWD) {
|
||||||
if (slirp_hostfwd(s, config->str, errp) < 0) {
|
if (slirp_hostfwd(s, config->str, errp) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
stored->has_hostfwd = true;
|
|
||||||
QAPI_LIST_APPEND(stored_hostfwd, element);
|
|
||||||
} else {
|
} else {
|
||||||
if (slirp_guestfwd(s, config->str, errp) < 0) {
|
if (slirp_guestfwd(s, config->str, errp) < 0) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
stored->has_guestfwd = true;
|
|
||||||
QAPI_LIST_APPEND(stored_guestfwd, element);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
71
net/socket.c
71
net/socket.c
@ -342,7 +342,6 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
|
|||||||
NetSocketState *s;
|
NetSocketState *s;
|
||||||
SocketAddress *sa;
|
SocketAddress *sa;
|
||||||
SocketAddressType sa_type;
|
SocketAddressType sa_type;
|
||||||
NetdevSocketOptions *stored;
|
|
||||||
|
|
||||||
sa = socket_local_address(fd, errp);
|
sa = socket_local_address(fd, errp);
|
||||||
if (!sa) {
|
if (!sa) {
|
||||||
@ -386,19 +385,8 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
|
|||||||
net_socket_rs_init(&s->rs, net_socket_rs_finalize, false);
|
net_socket_rs_init(&s->rs, net_socket_rs_finalize, false);
|
||||||
net_socket_read_poll(s, true);
|
net_socket_read_poll(s, true);
|
||||||
|
|
||||||
/* Store startup parameters */
|
|
||||||
nc->stored_config = g_new0(NetdevInfo, 1);
|
|
||||||
nc->stored_config->type = NET_BACKEND_SOCKET;
|
|
||||||
stored = &nc->stored_config->u.socket;
|
|
||||||
|
|
||||||
stored->has_fd = true;
|
|
||||||
stored->fd = g_strdup_printf("%d", fd);
|
|
||||||
|
|
||||||
/* mcast: save bound address as dst */
|
/* mcast: save bound address as dst */
|
||||||
if (is_connected && mcast != NULL) {
|
if (is_connected && mcast != NULL) {
|
||||||
stored->has_mcast = true;
|
|
||||||
stored->mcast = g_strdup(mcast);
|
|
||||||
|
|
||||||
s->dgram_dst = saddr;
|
s->dgram_dst = saddr;
|
||||||
snprintf(nc->info_str, sizeof(nc->info_str),
|
snprintf(nc->info_str, sizeof(nc->info_str),
|
||||||
"socket: fd=%d (cloned mcast=%s:%d)",
|
"socket: fd=%d (cloned mcast=%s:%d)",
|
||||||
@ -440,7 +428,6 @@ static NetSocketState *net_socket_fd_init_stream(NetClientState *peer,
|
|||||||
{
|
{
|
||||||
NetClientState *nc;
|
NetClientState *nc;
|
||||||
NetSocketState *s;
|
NetSocketState *s;
|
||||||
NetdevSocketOptions *stored;
|
|
||||||
|
|
||||||
nc = qemu_new_net_client(&net_socket_info, peer, model, name);
|
nc = qemu_new_net_client(&net_socket_info, peer, model, name);
|
||||||
|
|
||||||
@ -460,15 +447,6 @@ static NetSocketState *net_socket_fd_init_stream(NetClientState *peer,
|
|||||||
} else {
|
} else {
|
||||||
qemu_set_fd_handler(s->fd, NULL, net_socket_connect, s);
|
qemu_set_fd_handler(s->fd, NULL, net_socket_connect, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store startup parameters */
|
|
||||||
nc->stored_config = g_new0(NetdevInfo, 1);
|
|
||||||
nc->stored_config->type = NET_BACKEND_SOCKET;
|
|
||||||
stored = &nc->stored_config->u.socket;
|
|
||||||
|
|
||||||
stored->has_fd = true;
|
|
||||||
stored->fd = g_strdup_printf("%d", fd);
|
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,7 +483,6 @@ static void net_socket_accept(void *opaque)
|
|||||||
struct sockaddr_in saddr;
|
struct sockaddr_in saddr;
|
||||||
socklen_t len;
|
socklen_t len;
|
||||||
int fd;
|
int fd;
|
||||||
NetdevSocketOptions *stored;
|
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
len = sizeof(saddr);
|
len = sizeof(saddr);
|
||||||
@ -521,13 +498,6 @@ static void net_socket_accept(void *opaque)
|
|||||||
s->fd = fd;
|
s->fd = fd;
|
||||||
s->nc.link_down = false;
|
s->nc.link_down = false;
|
||||||
net_socket_connect(s);
|
net_socket_connect(s);
|
||||||
|
|
||||||
/* Store additional startup parameters (extend net_socket_listen_init) */
|
|
||||||
stored = &s->nc.stored_config->u.socket;
|
|
||||||
|
|
||||||
stored->has_fd = true;
|
|
||||||
stored->fd = g_strdup_printf("%d", fd);
|
|
||||||
|
|
||||||
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
||||||
"socket: connection from %s:%d",
|
"socket: connection from %s:%d",
|
||||||
inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
||||||
@ -543,7 +513,6 @@ static int net_socket_listen_init(NetClientState *peer,
|
|||||||
NetSocketState *s;
|
NetSocketState *s;
|
||||||
struct sockaddr_in saddr;
|
struct sockaddr_in saddr;
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
NetdevSocketOptions *stored;
|
|
||||||
|
|
||||||
if (parse_host_port(&saddr, host_str, errp) < 0) {
|
if (parse_host_port(&saddr, host_str, errp) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -580,15 +549,6 @@ static int net_socket_listen_init(NetClientState *peer,
|
|||||||
net_socket_rs_init(&s->rs, net_socket_rs_finalize, false);
|
net_socket_rs_init(&s->rs, net_socket_rs_finalize, false);
|
||||||
|
|
||||||
qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s);
|
qemu_set_fd_handler(s->listen_fd, net_socket_accept, NULL, s);
|
||||||
|
|
||||||
/* Store startup parameters */
|
|
||||||
nc->stored_config = g_new0(NetdevInfo, 1);
|
|
||||||
nc->stored_config->type = NET_BACKEND_SOCKET;
|
|
||||||
stored = &nc->stored_config->u.socket;
|
|
||||||
|
|
||||||
stored->has_listen = true;
|
|
||||||
stored->listen = g_strdup(host_str);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -601,7 +561,6 @@ static int net_socket_connect_init(NetClientState *peer,
|
|||||||
NetSocketState *s;
|
NetSocketState *s;
|
||||||
int fd, connected, ret;
|
int fd, connected, ret;
|
||||||
struct sockaddr_in saddr;
|
struct sockaddr_in saddr;
|
||||||
NetdevSocketOptions *stored;
|
|
||||||
|
|
||||||
if (parse_host_port(&saddr, host_str, errp) < 0) {
|
if (parse_host_port(&saddr, host_str, errp) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -639,12 +598,6 @@ static int net_socket_connect_init(NetClientState *peer,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store additional startup parameters (extend net_socket_fd_init) */
|
|
||||||
stored = &s->nc.stored_config->u.socket;
|
|
||||||
|
|
||||||
stored->has_connect = true;
|
|
||||||
stored->connect = g_strdup(host_str);
|
|
||||||
|
|
||||||
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
||||||
"socket: connect to %s:%d",
|
"socket: connect to %s:%d",
|
||||||
inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
||||||
@ -662,7 +615,6 @@ static int net_socket_mcast_init(NetClientState *peer,
|
|||||||
int fd;
|
int fd;
|
||||||
struct sockaddr_in saddr;
|
struct sockaddr_in saddr;
|
||||||
struct in_addr localaddr, *param_localaddr;
|
struct in_addr localaddr, *param_localaddr;
|
||||||
NetdevSocketOptions *stored;
|
|
||||||
|
|
||||||
if (parse_host_port(&saddr, host_str, errp) < 0) {
|
if (parse_host_port(&saddr, host_str, errp) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -691,19 +643,6 @@ static int net_socket_mcast_init(NetClientState *peer,
|
|||||||
|
|
||||||
s->dgram_dst = saddr;
|
s->dgram_dst = saddr;
|
||||||
|
|
||||||
/* Store additional startup parameters (extend net_socket_fd_init) */
|
|
||||||
stored = &s->nc.stored_config->u.socket;
|
|
||||||
|
|
||||||
if (!stored->has_mcast) {
|
|
||||||
stored->has_mcast = true;
|
|
||||||
stored->mcast = g_strdup(host_str);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (localaddr_str) {
|
|
||||||
stored->has_localaddr = true;
|
|
||||||
stored->localaddr = g_strdup(localaddr_str);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
||||||
"socket: mcast=%s:%d",
|
"socket: mcast=%s:%d",
|
||||||
inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
||||||
@ -721,7 +660,6 @@ static int net_socket_udp_init(NetClientState *peer,
|
|||||||
NetSocketState *s;
|
NetSocketState *s;
|
||||||
int fd, ret;
|
int fd, ret;
|
||||||
struct sockaddr_in laddr, raddr;
|
struct sockaddr_in laddr, raddr;
|
||||||
NetdevSocketOptions *stored;
|
|
||||||
|
|
||||||
if (parse_host_port(&laddr, lhost, errp) < 0) {
|
if (parse_host_port(&laddr, lhost, errp) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -760,15 +698,6 @@ static int net_socket_udp_init(NetClientState *peer,
|
|||||||
|
|
||||||
s->dgram_dst = raddr;
|
s->dgram_dst = raddr;
|
||||||
|
|
||||||
/* Store additional startup parameters (extend net_socket_fd_init) */
|
|
||||||
stored = &s->nc.stored_config->u.socket;
|
|
||||||
|
|
||||||
stored->has_localaddr = true;
|
|
||||||
stored->localaddr = g_strdup(lhost);
|
|
||||||
|
|
||||||
stored->has_udp = true;
|
|
||||||
stored->udp = g_strdup(rhost);
|
|
||||||
|
|
||||||
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
||||||
"socket: udp=%s:%d",
|
"socket: udp=%s:%d",
|
||||||
inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port));
|
inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port));
|
||||||
|
@ -778,7 +778,6 @@ static int tap_win32_init(NetClientState *peer, const char *model,
|
|||||||
NetClientState *nc;
|
NetClientState *nc;
|
||||||
TAPState *s;
|
TAPState *s;
|
||||||
tap_win32_overlapped_t *handle;
|
tap_win32_overlapped_t *handle;
|
||||||
NetdevTapOptions *stored;
|
|
||||||
|
|
||||||
if (tap_win32_open(&handle, ifname) < 0) {
|
if (tap_win32_open(&handle, ifname) < 0) {
|
||||||
printf("tap: Could not open '%s'\n", ifname);
|
printf("tap: Could not open '%s'\n", ifname);
|
||||||
@ -789,14 +788,6 @@ static int tap_win32_init(NetClientState *peer, const char *model,
|
|||||||
|
|
||||||
s = DO_UPCAST(TAPState, nc, nc);
|
s = DO_UPCAST(TAPState, nc, nc);
|
||||||
|
|
||||||
/* Store startup parameters */
|
|
||||||
nc->stored_config = g_new0(NetdevInfo, 1);
|
|
||||||
nc->stored_config->type = NET_BACKEND_TAP;
|
|
||||||
stored = &nc->stored_config->u.tap;
|
|
||||||
|
|
||||||
stored->has_ifname = true;
|
|
||||||
stored->ifname = g_strdup(ifname);
|
|
||||||
|
|
||||||
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
||||||
"tap: ifname=%s", ifname);
|
"tap: ifname=%s", ifname);
|
||||||
|
|
||||||
|
103
net/tap.c
103
net/tap.c
@ -600,7 +600,6 @@ int net_init_bridge(const Netdev *netdev, const char *name,
|
|||||||
const char *helper, *br;
|
const char *helper, *br;
|
||||||
TAPState *s;
|
TAPState *s;
|
||||||
int fd, vnet_hdr;
|
int fd, vnet_hdr;
|
||||||
NetdevBridgeOptions *stored;
|
|
||||||
|
|
||||||
assert(netdev->type == NET_CLIENT_DRIVER_BRIDGE);
|
assert(netdev->type == NET_CLIENT_DRIVER_BRIDGE);
|
||||||
bridge = &netdev->u.bridge;
|
bridge = &netdev->u.bridge;
|
||||||
@ -620,21 +619,6 @@ int net_init_bridge(const Netdev *netdev, const char *name,
|
|||||||
}
|
}
|
||||||
s = net_tap_fd_init(peer, "bridge", name, fd, vnet_hdr);
|
s = net_tap_fd_init(peer, "bridge", name, fd, vnet_hdr);
|
||||||
|
|
||||||
/* Store startup parameters */
|
|
||||||
s->nc.stored_config = g_new0(NetdevInfo, 1);
|
|
||||||
s->nc.stored_config->type = NET_BACKEND_BRIDGE;
|
|
||||||
stored = &s->nc.stored_config->u.bridge;
|
|
||||||
|
|
||||||
if (br) {
|
|
||||||
stored->has_br = true;
|
|
||||||
stored->br = g_strdup(br);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (helper) {
|
|
||||||
stored->has_helper = true;
|
|
||||||
stored->helper = g_strdup(helper);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s,br=%s", helper,
|
snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s,br=%s", helper,
|
||||||
br);
|
br);
|
||||||
|
|
||||||
@ -682,13 +666,11 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
|
|||||||
const char *model, const char *name,
|
const char *model, const char *name,
|
||||||
const char *ifname, const char *script,
|
const char *ifname, const char *script,
|
||||||
const char *downscript, const char *vhostfdname,
|
const char *downscript, const char *vhostfdname,
|
||||||
int vnet_hdr, int fd, NetdevInfo **common_stored,
|
int vnet_hdr, int fd, Error **errp)
|
||||||
Error **errp)
|
|
||||||
{
|
{
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
TAPState *s = net_tap_fd_init(peer, model, name, fd, vnet_hdr);
|
TAPState *s = net_tap_fd_init(peer, model, name, fd, vnet_hdr);
|
||||||
int vhostfd;
|
int vhostfd;
|
||||||
NetdevTapOptions *stored;
|
|
||||||
|
|
||||||
tap_set_sndbuf(s->fd, tap, &err);
|
tap_set_sndbuf(s->fd, tap, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -696,65 +678,12 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store startup parameters */
|
|
||||||
if (!*common_stored) {
|
|
||||||
*common_stored = g_new0(NetdevInfo, 1);
|
|
||||||
(*common_stored)->type = NET_BACKEND_TAP;
|
|
||||||
s->nc.stored_config = *common_stored;
|
|
||||||
}
|
|
||||||
stored = &(*common_stored)->u.tap;
|
|
||||||
|
|
||||||
if (tap->has_sndbuf && !stored->has_sndbuf) {
|
|
||||||
stored->has_sndbuf = true;
|
|
||||||
stored->sndbuf = tap->sndbuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vnet_hdr && !stored->has_vnet_hdr) {
|
|
||||||
stored->has_vnet_hdr = true;
|
|
||||||
stored->vnet_hdr = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tap->has_fd || tap->has_fds) {
|
if (tap->has_fd || tap->has_fds) {
|
||||||
if (!stored->has_fds) {
|
|
||||||
stored->has_fds = true;
|
|
||||||
stored->fds = g_strdup_printf("%d", fd);
|
|
||||||
} else {
|
|
||||||
char *tmp_s = stored->fds;
|
|
||||||
stored->fds = g_strdup_printf("%s:%d", stored->fds, fd);
|
|
||||||
g_free(tmp_s);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(s->nc.info_str, sizeof(s->nc.info_str), "fd=%d", fd);
|
snprintf(s->nc.info_str, sizeof(s->nc.info_str), "fd=%d", fd);
|
||||||
} else if (tap->has_helper) {
|
} else if (tap->has_helper) {
|
||||||
if (!stored->has_helper) {
|
|
||||||
stored->has_helper = true;
|
|
||||||
stored->helper = g_strdup(tap->helper);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!stored->has_br) {
|
|
||||||
stored->has_br = true;
|
|
||||||
stored->br = tap->has_br ? g_strdup(tap->br) :
|
|
||||||
g_strdup(DEFAULT_BRIDGE_INTERFACE);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s",
|
snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s",
|
||||||
tap->helper);
|
tap->helper);
|
||||||
} else {
|
} else {
|
||||||
if (ifname && !stored->has_ifname) {
|
|
||||||
stored->has_ifname = true;
|
|
||||||
stored->ifname = g_strdup(ifname);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (script && !stored->has_script) {
|
|
||||||
stored->has_script = true;
|
|
||||||
stored->script = g_strdup(script);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (downscript && !stored->has_downscript) {
|
|
||||||
stored->has_downscript = true;
|
|
||||||
stored->downscript = g_strdup(downscript);
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
||||||
"ifname=%s,script=%s,downscript=%s", ifname, script,
|
"ifname=%s,script=%s,downscript=%s", ifname, script,
|
||||||
downscript);
|
downscript);
|
||||||
@ -770,20 +699,9 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
|
|||||||
vhostfdname || (tap->has_vhostforce && tap->vhostforce)) {
|
vhostfdname || (tap->has_vhostforce && tap->vhostforce)) {
|
||||||
VhostNetOptions options;
|
VhostNetOptions options;
|
||||||
|
|
||||||
stored->has_vhost = true;
|
|
||||||
stored->vhost = true;
|
|
||||||
|
|
||||||
if (tap->has_vhostforce && tap->vhostforce) {
|
|
||||||
stored->has_vhostforce = true;
|
|
||||||
stored->vhostforce = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
options.backend_type = VHOST_BACKEND_TYPE_KERNEL;
|
options.backend_type = VHOST_BACKEND_TYPE_KERNEL;
|
||||||
options.net_backend = &s->nc;
|
options.net_backend = &s->nc;
|
||||||
if (tap->has_poll_us) {
|
if (tap->has_poll_us) {
|
||||||
stored->has_poll_us = true;
|
|
||||||
stored->poll_us = tap->poll_us;
|
|
||||||
|
|
||||||
options.busyloop_timeout = tap->poll_us;
|
options.busyloop_timeout = tap->poll_us;
|
||||||
} else {
|
} else {
|
||||||
options.busyloop_timeout = 0;
|
options.busyloop_timeout = 0;
|
||||||
@ -823,15 +741,6 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
|
|||||||
}
|
}
|
||||||
options.opaque = (void *)(uintptr_t)vhostfd;
|
options.opaque = (void *)(uintptr_t)vhostfd;
|
||||||
|
|
||||||
if (!stored->has_vhostfds) {
|
|
||||||
stored->has_vhostfds = true;
|
|
||||||
stored->vhostfds = g_strdup_printf("%d", vhostfd);
|
|
||||||
} else {
|
|
||||||
char *tmp_s = stored->vhostfds;
|
|
||||||
stored->vhostfds = g_strdup_printf("%s:%d", stored->fds, vhostfd);
|
|
||||||
g_free(tmp_s);
|
|
||||||
}
|
|
||||||
|
|
||||||
s->vhost_net = vhost_net_init(&options);
|
s->vhost_net = vhost_net_init(&options);
|
||||||
if (!s->vhost_net) {
|
if (!s->vhost_net) {
|
||||||
if (tap->has_vhostforce && tap->vhostforce) {
|
if (tap->has_vhostforce && tap->vhostforce) {
|
||||||
@ -884,7 +793,6 @@ int net_init_tap(const Netdev *netdev, const char *name,
|
|||||||
const char *vhostfdname;
|
const char *vhostfdname;
|
||||||
char ifname[128];
|
char ifname[128];
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
NetdevInfo *common_stored = NULL; /* will store configuration */
|
|
||||||
|
|
||||||
assert(netdev->type == NET_CLIENT_DRIVER_TAP);
|
assert(netdev->type == NET_CLIENT_DRIVER_TAP);
|
||||||
tap = &netdev->u.tap;
|
tap = &netdev->u.tap;
|
||||||
@ -931,7 +839,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
|
|||||||
|
|
||||||
net_init_tap_one(tap, peer, "tap", name, NULL,
|
net_init_tap_one(tap, peer, "tap", name, NULL,
|
||||||
script, downscript,
|
script, downscript,
|
||||||
vhostfdname, vnet_hdr, fd, &common_stored, &err);
|
vhostfdname, vnet_hdr, fd, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
error_propagate(errp, err);
|
error_propagate(errp, err);
|
||||||
close(fd);
|
close(fd);
|
||||||
@ -994,7 +902,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
|
|||||||
net_init_tap_one(tap, peer, "tap", name, ifname,
|
net_init_tap_one(tap, peer, "tap", name, ifname,
|
||||||
script, downscript,
|
script, downscript,
|
||||||
tap->has_vhostfds ? vhost_fds[i] : NULL,
|
tap->has_vhostfds ? vhost_fds[i] : NULL,
|
||||||
vnet_hdr, fd, &common_stored, &err);
|
vnet_hdr, fd, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
error_propagate(errp, err);
|
error_propagate(errp, err);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -1037,7 +945,7 @@ free_fail:
|
|||||||
|
|
||||||
net_init_tap_one(tap, peer, "bridge", name, ifname,
|
net_init_tap_one(tap, peer, "bridge", name, ifname,
|
||||||
script, downscript, vhostfdname,
|
script, downscript, vhostfdname,
|
||||||
vnet_hdr, fd, &common_stored, &err);
|
vnet_hdr, fd, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
error_propagate(errp, err);
|
error_propagate(errp, err);
|
||||||
close(fd);
|
close(fd);
|
||||||
@ -1083,8 +991,7 @@ free_fail:
|
|||||||
net_init_tap_one(tap, peer, "tap", name, ifname,
|
net_init_tap_one(tap, peer, "tap", name, ifname,
|
||||||
i >= 1 ? "no" : script,
|
i >= 1 ? "no" : script,
|
||||||
i >= 1 ? "no" : downscript,
|
i >= 1 ? "no" : downscript,
|
||||||
vhostfdname, vnet_hdr, fd,
|
vhostfdname, vnet_hdr, fd, &err);
|
||||||
&common_stored, &err);
|
|
||||||
if (err) {
|
if (err) {
|
||||||
error_propagate(errp, err);
|
error_propagate(errp, err);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
22
net/vde.c
22
net/vde.c
@ -84,7 +84,6 @@ static int net_vde_init(NetClientState *peer, const char *model,
|
|||||||
VDECONN *vde;
|
VDECONN *vde;
|
||||||
char *init_group = (char *)group;
|
char *init_group = (char *)group;
|
||||||
char *init_sock = (char *)sock;
|
char *init_sock = (char *)sock;
|
||||||
NetdevVdeOptions *stored;
|
|
||||||
|
|
||||||
struct vde_open_args args = {
|
struct vde_open_args args = {
|
||||||
.port = port,
|
.port = port,
|
||||||
@ -109,27 +108,6 @@ static int net_vde_init(NetClientState *peer, const char *model,
|
|||||||
|
|
||||||
qemu_set_fd_handler(vde_datafd(s->vde), vde_to_qemu, NULL, s);
|
qemu_set_fd_handler(vde_datafd(s->vde), vde_to_qemu, NULL, s);
|
||||||
|
|
||||||
/* Store startup parameters */
|
|
||||||
nc->stored_config = g_new0(NetdevInfo, 1);
|
|
||||||
nc->stored_config->type = NET_BACKEND_VDE;
|
|
||||||
stored = &nc->stored_config->u.vde;
|
|
||||||
|
|
||||||
if (sock) {
|
|
||||||
stored->has_sock = true;
|
|
||||||
stored->sock = g_strdup(sock);
|
|
||||||
}
|
|
||||||
|
|
||||||
stored->has_port = true;
|
|
||||||
stored->port = port;
|
|
||||||
|
|
||||||
if (group) {
|
|
||||||
stored->has_group = true;
|
|
||||||
stored->group = g_strdup(group);
|
|
||||||
}
|
|
||||||
|
|
||||||
stored->has_mode = true;
|
|
||||||
stored->mode = mode;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,15 +311,14 @@ static void net_vhost_user_event(void *opaque, QEMUChrEvent event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int net_vhost_user_init(NetClientState *peer, const char *device,
|
static int net_vhost_user_init(NetClientState *peer, const char *device,
|
||||||
const char *name, const char *chardev,
|
const char *name, Chardev *chr,
|
||||||
Chardev *chr, int queues)
|
int queues)
|
||||||
{
|
{
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
NetClientState *nc, *nc0 = NULL;
|
NetClientState *nc, *nc0 = NULL;
|
||||||
NetVhostUserState *s = NULL;
|
NetVhostUserState *s = NULL;
|
||||||
VhostUserState *user;
|
VhostUserState *user;
|
||||||
int i;
|
int i;
|
||||||
NetdevVhostUserOptions *stored;
|
|
||||||
|
|
||||||
assert(name);
|
assert(name);
|
||||||
assert(queues > 0);
|
assert(queues > 0);
|
||||||
@ -356,16 +355,6 @@ static int net_vhost_user_init(NetClientState *peer, const char *device,
|
|||||||
|
|
||||||
assert(s->vhost_net);
|
assert(s->vhost_net);
|
||||||
|
|
||||||
/* Store startup parameters */
|
|
||||||
nc0->stored_config = g_new0(NetdevInfo, 1);
|
|
||||||
nc0->stored_config->type = NET_BACKEND_VHOST_USER;
|
|
||||||
stored = &nc0->stored_config->u.vhost_user;
|
|
||||||
|
|
||||||
stored->chardev = g_strdup(chardev);
|
|
||||||
|
|
||||||
stored->has_queues = true;
|
|
||||||
stored->queues = queues;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
@ -457,6 +446,5 @@ int net_init_vhost_user(const Netdev *netdev, const char *name,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return net_vhost_user_init(peer, "vhost_user", name,
|
return net_vhost_user_init(peer, "vhost_user", name, chr, queues);
|
||||||
vhost_user_opts->chardev, chr, queues);
|
|
||||||
}
|
}
|
||||||
|
@ -184,22 +184,8 @@ static int net_vhost_vdpa_init(NetClientState *peer, const char *device,
|
|||||||
VhostVDPAState *s;
|
VhostVDPAState *s;
|
||||||
int vdpa_device_fd = -1;
|
int vdpa_device_fd = -1;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
NetdevVhostVDPAOptions *stored;
|
|
||||||
|
|
||||||
assert(name);
|
assert(name);
|
||||||
nc = qemu_new_net_client(&net_vhost_vdpa_info, peer, device, name);
|
nc = qemu_new_net_client(&net_vhost_vdpa_info, peer, device, name);
|
||||||
|
|
||||||
/* Store startup parameters */
|
|
||||||
nc->stored_config = g_new0(NetdevInfo, 1);
|
|
||||||
nc->stored_config->type = NET_BACKEND_VHOST_VDPA;
|
|
||||||
stored = &nc->stored_config->u.vhost_vdpa;
|
|
||||||
|
|
||||||
stored->has_vhostdev = true;
|
|
||||||
stored->vhostdev = g_strdup(vhostdev);
|
|
||||||
|
|
||||||
stored->has_queues = true;
|
|
||||||
stored->queues = 1; /* TODO: change when support multiqueue */
|
|
||||||
|
|
||||||
snprintf(nc->info_str, sizeof(nc->info_str), TYPE_VHOST_VDPA);
|
snprintf(nc->info_str, sizeof(nc->info_str), TYPE_VHOST_VDPA);
|
||||||
nc->queue_index = 0;
|
nc->queue_index = 0;
|
||||||
s = DO_UPCAST(VhostVDPAState, nc, nc);
|
s = DO_UPCAST(VhostVDPAState, nc, nc);
|
||||||
|
@ -694,83 +694,3 @@
|
|||||||
##
|
##
|
||||||
{ 'event': 'FAILOVER_NEGOTIATED',
|
{ 'event': 'FAILOVER_NEGOTIATED',
|
||||||
'data': {'device-id': 'str'} }
|
'data': {'device-id': 'str'} }
|
||||||
|
|
||||||
##
|
|
||||||
# @NetBackend:
|
|
||||||
#
|
|
||||||
# Available netdev backend drivers.
|
|
||||||
#
|
|
||||||
# Since: 6.0
|
|
||||||
##
|
|
||||||
{ 'enum': 'NetBackend',
|
|
||||||
'data': [ 'bridge', 'l2tpv3', 'netmap', 'socket', 'tap', 'user', 'vde',
|
|
||||||
'vhost-user', 'vhost-vdpa' ] }
|
|
||||||
|
|
||||||
##
|
|
||||||
# @NetdevInfo:
|
|
||||||
#
|
|
||||||
# Configuration of a network backend device (netdev).
|
|
||||||
#
|
|
||||||
# @id: Device identifier.
|
|
||||||
#
|
|
||||||
# @type: Specify the driver used for interpreting remaining arguments.
|
|
||||||
#
|
|
||||||
# @peer-id: The connected frontend network device name (absent if no frontend
|
|
||||||
# is connected).
|
|
||||||
#
|
|
||||||
# Since: 6.0
|
|
||||||
##
|
|
||||||
{ 'union': 'NetdevInfo',
|
|
||||||
'base': { 'id': 'str',
|
|
||||||
'type': 'NetBackend',
|
|
||||||
'*peer-id': 'str' },
|
|
||||||
'discriminator': 'type',
|
|
||||||
'data': {
|
|
||||||
'bridge': 'NetdevBridgeOptions',
|
|
||||||
'l2tpv3': 'NetdevL2TPv3Options',
|
|
||||||
'netmap': 'NetdevNetmapOptions',
|
|
||||||
'socket': 'NetdevSocketOptions',
|
|
||||||
'tap': 'NetdevTapOptions',
|
|
||||||
'user': 'NetdevUserOptions',
|
|
||||||
'vde': 'NetdevVdeOptions',
|
|
||||||
'vhost-user': 'NetdevVhostUserOptions',
|
|
||||||
'vhost-vdpa': 'NetdevVhostVDPAOptions' } }
|
|
||||||
|
|
||||||
##
|
|
||||||
# @query-netdev:
|
|
||||||
#
|
|
||||||
# Get a list of @NetdevInfo for all virtual network backend devices (netdevs).
|
|
||||||
#
|
|
||||||
# Returns: a list of @NetdevInfo describing each netdev.
|
|
||||||
#
|
|
||||||
# Since: 6.0
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
#
|
|
||||||
# -> { "execute": "query-netdev" }
|
|
||||||
# <- { "return": [
|
|
||||||
# {
|
|
||||||
# "ipv6": true,
|
|
||||||
# "ipv4": true,
|
|
||||||
# "host": "10.0.2.2",
|
|
||||||
# "ipv6-dns": "fec0::3",
|
|
||||||
# "ipv6-prefix": "fec0::",
|
|
||||||
# "net": "10.0.2.0/255.255.255.0",
|
|
||||||
# "ipv6-host": "fec0::2",
|
|
||||||
# "type": "user",
|
|
||||||
# "peer-id": "net0",
|
|
||||||
# "dns": "10.0.2.3",
|
|
||||||
# "hostfwd": [
|
|
||||||
# {
|
|
||||||
# "str": "tcp::20004-:22"
|
|
||||||
# }
|
|
||||||
# ],
|
|
||||||
# "ipv6-prefixlen": 64,
|
|
||||||
# "id": "netdev0",
|
|
||||||
# "restrict": false
|
|
||||||
# }
|
|
||||||
# ]
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
##
|
|
||||||
{ 'command': 'query-netdev', 'returns': ['NetdevInfo'] }
|
|
||||||
|
Loading…
Reference in New Issue
Block a user