summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSamuel Thibault2019-09-29 20:08:20 +0200
committerSamuel Thibault2019-10-01 19:03:08 +0200
commit120b721f5b590393971673a315f02969ec89cccb (patch)
treeeffb500d79924985c998c536fd7cb87e6e8b24f1 /net
parentMerge remote-tracking branch 'remotes/kraxel/tags/audio-20190924-pull-request... (diff)
downloadqemu-120b721f5b590393971673a315f02969ec89cccb.tar.gz
qemu-120b721f5b590393971673a315f02969ec89cccb.tar.xz
qemu-120b721f5b590393971673a315f02969ec89cccb.zip
slirp: Allow non-local DNS address when restrict is off
This can be used to set a DNS server to be used by the guest which is different from the one configured on the host. Buglink: https://bugs.launchpad.net/qemu/+bug/1010484 Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/slirp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/slirp.c b/net/slirp.c
index f42f496641..c4334ee876 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -456,7 +456,7 @@ static int net_slirp_init(NetClientState *peer, const char *model,
error_setg(errp, "Failed to parse DNS");
return -1;
}
- if ((dns.s_addr & mask.s_addr) != net.s_addr) {
+ if (restricted && (dns.s_addr & mask.s_addr) != net.s_addr) {
error_setg(errp, "DNS doesn't belong to network");
return -1;
}
@@ -522,7 +522,7 @@ static int net_slirp_init(NetClientState *peer, const char *model,
error_setg(errp, "Failed to parse IPv6 DNS");
return -1;
}
- if (!in6_equal_net(&ip6_prefix, &ip6_dns, vprefix6_len)) {
+ if (restricted && !in6_equal_net(&ip6_prefix, &ip6_dns, vprefix6_len)) {
error_setg(errp, "IPv6 DNS doesn't belong to network");
return -1;
}