From 3ab7d3b66bde9778c8c891fa12607e3dc78c35d7 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Wed, 28 Jan 2004 14:42:47 +0000 Subject: allow having no DNS by only using the ip callback once, see DNS == IP as a special case, don't do DNS calls when no DNS is configured to avoid timeouts --- mdk-stage1/dns.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'mdk-stage1/dns.c') diff --git a/mdk-stage1/dns.c b/mdk-stage1/dns.c index 5ba55486a..0ed98ad44 100644 --- a/mdk-stage1/dns.c +++ b/mdk-stage1/dns.c @@ -38,7 +38,13 @@ int mygethostbyname(char * name, struct in_addr * addr) { - struct hostent * h = gethostbyname(name); + struct hostent * h; + + /* prevent from timeouts */ + if (dns_server.s_addr == 0) + return -1; + + h = gethostbyname(name); if (!h) { if (domain) { // gethostbyname from dietlibc doesn't support domain handling @@ -65,6 +71,11 @@ char * mygethostbyaddr(char * ipnum) { struct in_addr in; struct hostent * host; + + /* prevent from timeouts */ + if (dns_server.s_addr == 0) + return NULL; + if (!inet_aton(ipnum, &in)) return NULL; host = gethostbyaddr(&(in.s_addr), sizeof(in.s_addr) /* INADDRSZ */, AF_INET); -- cgit v1.2.1