提交 84007e81 编写于 作者: H Hani Benhabiles 提交者: Luiz Capitulino

net: Export valid host network devices list

Signed-off-by: NHani Benhabiles <hani@linux.com>
Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
上级 c68a0409
...@@ -177,6 +177,7 @@ struct NICInfo { ...@@ -177,6 +177,7 @@ struct NICInfo {
extern int nb_nics; extern int nb_nics;
extern NICInfo nd_table[MAX_NICS]; extern NICInfo nd_table[MAX_NICS];
extern int default_net; extern int default_net;
extern const char *host_net_devices[];
/* from net.c */ /* from net.c */
extern const char *legacy_tftp_prefix; extern const char *legacy_tftp_prefix;
......
...@@ -49,6 +49,22 @@ ...@@ -49,6 +49,22 @@
static QTAILQ_HEAD(, NetClientState) net_clients; static QTAILQ_HEAD(, NetClientState) net_clients;
const char *host_net_devices[] = {
"tap",
"socket",
"dump",
#ifdef CONFIG_NET_BRIDGE
"bridge",
#endif
#ifdef CONFIG_SLIRP
"user",
#endif
#ifdef CONFIG_VDE
"vde",
#endif
NULL,
};
int default_net = 1; int default_net = 1;
/***********************************************************/ /***********************************************************/
...@@ -897,21 +913,11 @@ int net_client_init(QemuOpts *opts, int is_netdev, Error **errp) ...@@ -897,21 +913,11 @@ int net_client_init(QemuOpts *opts, int is_netdev, Error **errp)
static int net_host_check_device(const char *device) static int net_host_check_device(const char *device)
{ {
int i; int i;
const char *valid_param_list[] = { "tap", "socket", "dump" for (i = 0; host_net_devices[i]; i++) {
#ifdef CONFIG_NET_BRIDGE if (!strncmp(host_net_devices[i], device,
, "bridge" strlen(host_net_devices[i]))) {
#endif
#ifdef CONFIG_SLIRP
,"user"
#endif
#ifdef CONFIG_VDE
,"vde"
#endif
};
for (i = 0; i < ARRAY_SIZE(valid_param_list); i++) {
if (!strncmp(valid_param_list[i], device,
strlen(valid_param_list[i])))
return 1; return 1;
}
} }
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册