dns: fix recursive loop
resolv() uses getenv_ip() which in turn calls resolv(). Fix this inifinite loop by not using getenv_ip directly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
89eb305e49
commit
611719282d
11
net/dns.c
11
net/dns.c
|
@ -197,6 +197,7 @@ static void dns_handler(void *ctx, char *packet, unsigned len)
|
||||||
IPaddr_t resolv(char *host)
|
IPaddr_t resolv(char *host)
|
||||||
{
|
{
|
||||||
IPaddr_t ip;
|
IPaddr_t ip;
|
||||||
|
const char *ns;
|
||||||
|
|
||||||
if (!string_to_ip(host, &ip))
|
if (!string_to_ip(host, &ip))
|
||||||
return ip;
|
return ip;
|
||||||
|
@ -205,8 +206,14 @@ IPaddr_t resolv(char *host)
|
||||||
|
|
||||||
dns_state = STATE_INIT;
|
dns_state = STATE_INIT;
|
||||||
|
|
||||||
ip = getenv_ip("net.nameserver");
|
ns = getenv("net.nameserver");
|
||||||
if (!ip)
|
if (!ns || !*ns) {
|
||||||
|
printk("%s: no nameserver specified in $net.nameserver\n",
|
||||||
|
__func__);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string_to_ip(ns, &ip))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
debug("resolving host %s via nameserver %s\n", host, ip_to_string(ip));
|
debug("resolving host %s via nameserver %s\n", host, ip_to_string(ip));
|
||||||
|
|
Loading…
Reference in New Issue