diff mbox series

slirp: Allow non-local DNS address when restrict is off

Message ID 20190929181303.19960-1-samuel.thibault@ens-lyon.org (mailing list archive)
State New, archived
Headers show
Series slirp: Allow non-local DNS address when restrict is off | expand

Commit Message

Samuel Thibault Sept. 29, 2019, 6:13 p.m. UTC
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.

This fixes LP 1010484.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 net/slirp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Marc-André Lureau Sept. 29, 2019, 6:26 p.m. UTC | #1
On Sun, Sep 29, 2019 at 10:13 PM Samuel Thibault
<samuel.thibault@ens-lyon.org> wrote:
>
> 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.
>
> This fixes LP 1010484.
>
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  net/slirp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/slirp.c b/net/slirp.c
> index f42f496641..4d158b0542 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;
>      }
> --
> 2.23.0
>
>
Philippe Mathieu-Daudé Oct. 1, 2019, 9:04 a.m. UTC | #2
Hi Samuel,

On 9/29/19 8:13 PM, Samuel Thibault wrote:
> 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.
> 
> This fixes LP 1010484.

Wow, 7 years old...

Can you use this format, easier to understand for newcomers:

Fixes: https://bugs.launchpad.net/qemu/+bug/1010484

> 
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> ---
>   net/slirp.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/slirp.c b/net/slirp.c
> index f42f496641..4d158b0542 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;
>       }
> 

What about the IPv6 DNS?

Regards,

Phil.
Thomas Huth Oct. 1, 2019, 9:31 a.m. UTC | #3
On 01/10/2019 11.04, Philippe Mathieu-Daudé wrote:
> Hi Samuel,
> 
> On 9/29/19 8:13 PM, Samuel Thibault wrote:
>> 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.
>>
>> This fixes LP 1010484.
> 
> Wow, 7 years old...
> 
> Can you use this format, easier to understand for newcomers:
> 
> Fixes: https://bugs.launchpad.net/qemu/+bug/1010484

That should be "Buglink:" instead. "Fixes:" is for referencing previous
commits. See our submit-a-patch page for more information:
https://wiki.qemu.org/Contribute/SubmitAPatch#Write_a_meaningful_commit_message

 Thomas
diff mbox series

Patch

diff --git a/net/slirp.c b/net/slirp.c
index f42f496641..4d158b0542 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;
     }