diff options
author | Hani Benhabiles <kroosec@gmail.com> | 2014-05-27 23:39:33 +0100 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2014-06-11 10:10:29 -0400 |
commit | 84007e81814bd1b523eb36b027ef8a84d7f00206 (patch) | |
tree | 8d0168d8d25f3d0adbf4efd23e28a6734d50633a /net | |
parent | c68a0409b388c30c7f4ee8be44081c143f280279 (diff) | |
download | qemu-84007e81814bd1b523eb36b027ef8a84d7f00206.tar.gz qemu-84007e81814bd1b523eb36b027ef8a84d7f00206.tar.bz2 qemu-84007e81814bd1b523eb36b027ef8a84d7f00206.zip |
net: Export valid host network devices list
Signed-off-by: Hani Benhabiles <hani@linux.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/net.c | 34 |
1 files changed, 20 insertions, 14 deletions
@@ -49,6 +49,22 @@ 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; /***********************************************************/ @@ -897,21 +913,11 @@ int net_client_init(QemuOpts *opts, int is_netdev, Error **errp) static int net_host_check_device(const char *device) { int i; - const char *valid_param_list[] = { "tap", "socket", "dump" -#ifdef CONFIG_NET_BRIDGE - , "bridge" -#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]))) + for (i = 0; host_net_devices[i]; i++) { + if (!strncmp(host_net_devices[i], device, + strlen(host_net_devices[i]))) { return 1; + } } return 0; |