slirp: use a callback structure to interface with qemu

This will bring slirp a bit forward to the state of an independent
project.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
Marc-André Lureau
2018-11-14 16:36:07 +04:00
committed by Samuel Thibault
parent cf2b315265
commit d846b927a6
5 changed files with 23 additions and 10 deletions

View File

@ -140,6 +140,10 @@ static NetClientInfo net_slirp_info = {
.cleanup = net_slirp_cleanup,
};
static const SlirpCb slirp_cb = {
.output = net_slirp_output,
};
static int net_slirp_init(NetClientState *peer, const char *model,
const char *name, int restricted,
bool ipv4, const char *vnetwork, const char *vhost,
@ -379,7 +383,7 @@ static int net_slirp_init(NetClientState *peer, const char *model,
vhostname, tftp_server_name,
tftp_export, bootfile, dhcp,
dns, ip6_dns, dnssearch, vdomainname,
net_slirp_output, s);
&slirp_cb, s);
QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry);
for (config = slirp_configs; config; config = config->next) {