Skip to contentSkip to conversation

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

PATCH In review Samuel Thibault 4 participants 4 messages Sep 29, 2019 – Oct 1, 2019 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

This fixes LP 1010484.

---
 net/slirp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/slirp.c +1 -1
index f42f496641..4d158b0542 100644
@@ -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;
     }
Signature · 1 line
2.23.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Samuel Thibault

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.

Quoted 21 lines
---
 net/slirp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/slirp.c +1 -2
index f42f496641..4d158b0542 100644
@@ -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

Signature · 1 line
Marc-André Lureau
#2 lore raw
In reply to Samuel Thibault

Hi Samuel,

Quoted 4 lines · Samuel Thibault

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:

Quoted 12 lines
---
  net/slirp.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
net/slirp.c +0 -0
index f42f496641..4d158b0542 100644

net/slirp.c static int net_slirp_init(NetClientState *peer, const char *model, · line 462

Quoted 8 lines
net/slirp.c +1 -1
@@ -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.

#3 lore raw
Quoted 6 lines · Philippe Mathieu-Daudé

Hi Samuel,

Quoted 3 lines · Samuel Thibault

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.

Quoted 7 lines
Quoted 1 line

This fixes LP 1010484.

Wow, 7 years old...

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

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