aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2022-04-11 10:16:36 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2022-05-12 12:29:44 +0200
commitbce63ded2066a21cc1f5922d0bf667123123d6f6 (patch)
treef1a64e8d8c84cc036468c3f0262bffe00eb4ccfa
parentad2e5b87d7d070cb4c0a3ba1c20a4ec5e6429301 (diff)
downloadqemu-bce63ded2066a21cc1f5922d0bf667123123d6f6.zip
qemu-bce63ded2066a21cc1f5922d0bf667123123d6f6.tar.gz
qemu-bce63ded2066a21cc1f5922d0bf667123123d6f6.tar.bz2
net: slirp: switch to slirp_new
Replace slirp_init with slirp_new, so that a more recent cfg.version can be specified. The function appeared in version 4.1.0. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--meson.build2
-rw-r--r--net/slirp.c27
2 files changed, 22 insertions, 7 deletions
diff --git a/meson.build b/meson.build
index 03f63e9..ea72ba7 100644
--- a/meson.build
+++ b/meson.build
@@ -2638,7 +2638,7 @@ if have_system
if slirp_opt in ['enabled', 'auto', 'system']
have_internal = fs.exists(meson.current_source_dir() / 'slirp/meson.build')
slirp = dependency('slirp', kwargs: static_kwargs,
- method: 'pkg-config',
+ method: 'pkg-config', version: '>=4.1.0',
required: slirp_opt == 'system' or
slirp_opt == 'enabled' and not have_internal)
if slirp.found()
diff --git a/net/slirp.c b/net/slirp.c
index f1e25d7..b7464be 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -389,6 +389,7 @@ static int net_slirp_init(NetClientState *peer, const char *model,
#if defined(CONFIG_SMBD_COMMAND)
struct in_addr smbsrv = { .s_addr = 0 };
#endif
+ SlirpConfig cfg = { 0 };
NetClientState *nc;
SlirpState *s;
char buf[20];
@@ -577,12 +578,26 @@ static int net_slirp_init(NetClientState *peer, const char *model,
s = DO_UPCAST(SlirpState, nc, nc);
- s->slirp = slirp_init(restricted, ipv4, net, mask, host,
- ipv6, ip6_prefix, vprefix6_len, ip6_host,
- vhostname, tftp_server_name,
- tftp_export, bootfile, dhcp,
- dns, ip6_dns, dnssearch, vdomainname,
- &slirp_cb, s);
+ cfg.version = 1;
+ cfg.restricted = restricted;
+ cfg.in_enabled = ipv4;
+ cfg.vnetwork = net;
+ cfg.vnetmask = mask;
+ cfg.vhost = host;
+ cfg.in6_enabled = ipv6;
+ cfg.vprefix_addr6 = ip6_prefix;
+ cfg.vprefix_len = vprefix6_len;
+ cfg.vhost6 = ip6_host;
+ cfg.vhostname = vhostname;
+ cfg.tftp_server_name = tftp_server_name;
+ cfg.tftp_path = tftp_export;
+ cfg.bootfile = bootfile;
+ cfg.vdhcp_start = dhcp;
+ cfg.vnameserver = dns;
+ cfg.vnameserver6 = ip6_dns;
+ cfg.vdnssearch = dnssearch;
+ cfg.vdomainname = vdomainname;
+ s->slirp = slirp_new(&cfg, &slirp_cb, s);
QTAILQ_INSERT_TAIL(&slirp_stacks, s, entry);
/*