提交 120b721f 编写于 作者: S Samuel Thibault

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/1010484Signed-off-by: NSamuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: NPhilippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: NThomas Huth <thuth@redhat.com>
上级 860d9048
...@@ -456,7 +456,7 @@ static int net_slirp_init(NetClientState *peer, const char *model, ...@@ -456,7 +456,7 @@ static int net_slirp_init(NetClientState *peer, const char *model,
error_setg(errp, "Failed to parse DNS"); error_setg(errp, "Failed to parse DNS");
return -1; 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"); error_setg(errp, "DNS doesn't belong to network");
return -1; return -1;
} }
...@@ -522,7 +522,7 @@ static int net_slirp_init(NetClientState *peer, const char *model, ...@@ -522,7 +522,7 @@ static int net_slirp_init(NetClientState *peer, const char *model,
error_setg(errp, "Failed to parse IPv6 DNS"); error_setg(errp, "Failed to parse IPv6 DNS");
return -1; 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"); error_setg(errp, "IPv6 DNS doesn't belong to network");
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册