summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2004-01-28 14:42:47 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2004-01-28 14:42:47 +0000
commit3ab7d3b66bde9778c8c891fa12607e3dc78c35d7 (patch)
tree15d98bd6c7ce5b3ecedfa9f3402a25f2b78fb724
parent38e382e82bb1c62e0fd4ca666e6d2f0a15bd113e (diff)
downloaddrakx-backup-do-not-use-3ab7d3b66bde9778c8c891fa12607e3dc78c35d7.tar
drakx-backup-do-not-use-3ab7d3b66bde9778c8c891fa12607e3dc78c35d7.tar.gz
drakx-backup-do-not-use-3ab7d3b66bde9778c8c891fa12607e3dc78c35d7.tar.bz2
drakx-backup-do-not-use-3ab7d3b66bde9778c8c891fa12607e3dc78c35d7.tar.xz
drakx-backup-do-not-use-3ab7d3b66bde9778c8c891fa12607e3dc78c35d7.zip
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
-rw-r--r--mdk-stage1/dns.c13
-rw-r--r--mdk-stage1/network.c11
2 files changed, 22 insertions, 2 deletions
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);
diff --git a/mdk-stage1/network.c b/mdk-stage1/network.c
index 1eb786cc8..13085cfcc 100644
--- a/mdk-stage1/network.c
+++ b/mdk-stage1/network.c
@@ -348,8 +348,12 @@ static void static_ip_callback(char ** strings)
{
struct in_addr addr;
- if (!inet_aton(strings[0], &addr))
+ static int done = 0;
+ if (done)
+ return;
+ if (streq(strings[0], "") || !inet_aton(strings[0], &addr))
return;
+ done = 1;
if (!strcmp(strings[1], "")) {
char * ptr;
@@ -400,6 +404,11 @@ static enum return_type setup_network_interface(struct interface_info * intf)
dns_server.s_addr = 0; /* keep an understandable state */
}
+ if (streq(answers[0], answers[1])) {
+ log_message("IP and DNS are the same, guess you don't want a DNS, disabling it");
+ dns_server.s_addr = 0; /* keep an understandable state */
+ }
+
if (!inet_aton(answers[2], &gateway)) {
log_message("invalid gateway");
gateway.s_addr = 0; /* keep an understandable state */