* [Qemu-trivial] [PATCH] slirp: Warn about failing to parse /etc/resolv.conf
@ 2013-03-08 12:24 Guillaume Subiron
2013-03-22 12:14 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Guillaume Subiron @ 2013-03-08 12:24 UTC (permalink / raw)
To: qemu-trivial; +Cc: jan.kiszka, ped, Guillaume Subiron
Some users may have only a link-local IPv6 in their resolv.conf. In slirp mode, DNS resolution fails with timeout.
This adds two messages to alert the user that no DNS have been found instead of just exiting without explanation.
They are kept printed until the user fixes the issue in /etc/resolv.conf.
Signed-off-by: Guillaume Subiron <maethor@subiron.org>
---
slirp/slirp.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/slirp/slirp.c b/slirp/slirp.c
index 0e6e232..1683639 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -135,8 +135,10 @@ int get_dns_addr(struct in_addr *pdns_addr)
}
f = fopen("/etc/resolv.conf", "r");
- if (!f)
+ if (!f) {
+ fprintf(stderr, "Unable to open /etc/resolv.conf\n");
return -1;
+ }
#ifdef DEBUG
lprint("IP address of your DNS(s): ");
@@ -168,8 +170,10 @@ int get_dns_addr(struct in_addr *pdns_addr)
}
}
fclose(f);
- if (!found)
+ if (!found) {
+ fprintf(stderr, "No IPv4 found in /etc/resolv.conf\n");
return -1;
+ }
return 0;
}
--
Guillaume
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-trivial] [PATCH] slirp: Warn about failing to parse /etc/resolv.conf
2013-03-08 12:24 [Qemu-trivial] [PATCH] slirp: Warn about failing to parse /etc/resolv.conf Guillaume Subiron
@ 2013-03-22 12:14 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2013-03-22 12:14 UTC (permalink / raw)
To: Guillaume Subiron; +Cc: qemu-trivial, jan.kiszka, ped
On Fri, Mar 08, 2013 at 01:24:20PM +0100, Guillaume Subiron wrote:
> Some users may have only a link-local IPv6 in their resolv.conf. In slirp mode, DNS resolution fails with timeout.
>
> This adds two messages to alert the user that no DNS have been found instead of just exiting without explanation.
> They are kept printed until the user fixes the issue in /etc/resolv.conf.
>
> Signed-off-by: Guillaume Subiron <maethor@subiron.org>
> ---
> slirp/slirp.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/slirp/slirp.c b/slirp/slirp.c
> index 0e6e232..1683639 100644
> --- a/slirp/slirp.c
> +++ b/slirp/slirp.c
> @@ -135,8 +135,10 @@ int get_dns_addr(struct in_addr *pdns_addr)
> }
>
> f = fopen("/etc/resolv.conf", "r");
> - if (!f)
> + if (!f) {
> + fprintf(stderr, "Unable to open /etc/resolv.conf\n");
> return -1;
> + }
>
> #ifdef DEBUG
> lprint("IP address of your DNS(s): ");
> @@ -168,8 +170,10 @@ int get_dns_addr(struct in_addr *pdns_addr)
> }
> }
> fclose(f);
> - if (!found)
> + if (!found) {
> + fprintf(stderr, "No IPv4 found in /etc/resolv.conf\n");
> return -1;
> + }
> return 0;
> }
Please use error_report() like other net backends. You can drop the
newline for error_report().
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-22 12:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-08 12:24 [Qemu-trivial] [PATCH] slirp: Warn about failing to parse /etc/resolv.conf Guillaume Subiron
2013-03-22 12:14 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).