1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-22 15:47:37 +00:00

Fiddle with DNS options so that queries are also controlled by

the MEDIA_TIMEOUT variable.  Just -current for now on this one as
I'm still wanting to play with this a bit and see what the ramifications
of doing this are.
Requested by:	pst
This commit is contained in:
Jordan K. Hubbard 1997-07-31 11:28:58 +00:00
parent b6aad04900
commit e5a117774b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=27801
2 changed files with 52 additions and 2 deletions

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: media.c,v 1.83 1997/03/19 10:09:19 jkh Exp $
* $Id: media.c,v 1.84 1997/06/05 09:47:59 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -46,6 +46,7 @@
#include <sys/wait.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <resolv.h>
static Boolean got_intr = FALSE;
@ -84,6 +85,28 @@ cdromHook(dialogMenuItem *self)
return genericHook(self, DEVICE_TYPE_CDROM);
}
static void
kickstart_dns(void)
{
static Boolean initted = FALSE;
int time;
char *cp;
cp = variable_get(VAR_MEDIA_TIMEOUT);
if (!cp)
time = MEDIA_TIMEOUT;
else
time = atoi(cp);
if (!time)
time = 100;
if (!initted) {
res_init();
_res.retry = 2; /* 2 times seems a reasonable number to me */
_res.retrans = time / 2; /* so spend half our alloted time on each try */
initted = TRUE;
}
}
char *
cpioVerbosity()
{
@ -362,6 +385,7 @@ mediaSetFTP(dialogMenuItem *self)
msgDebug("port # = `%d'\n", FtpPort);
}
if (variable_get(VAR_NAMESERVER)) {
kickstart_dns();
if ((inet_addr(hostname) == INADDR_NONE) && (gethostbyname(hostname) == NULL)) {
msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\n"
"name server, gateway and network interface are correctly configured?", hostname);
@ -456,6 +480,7 @@ mediaSetNFS(dialogMenuItem *self)
msgDebug("mediaSetNFS: Net device init failed\n");
}
if (variable_get(VAR_NAMESERVER)) {
kickstart_dns();
if ((inet_addr(hostname) == INADDR_NONE) && (gethostbyname(hostname) == NULL)) {
msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\n"
"name server, gateway and network interface are correctly configured?", hostname);

View File

@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
* $Id: media.c,v 1.83 1997/03/19 10:09:19 jkh Exp $
* $Id: media.c,v 1.84 1997/06/05 09:47:59 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -46,6 +46,7 @@
#include <sys/wait.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <resolv.h>
static Boolean got_intr = FALSE;
@ -84,6 +85,28 @@ cdromHook(dialogMenuItem *self)
return genericHook(self, DEVICE_TYPE_CDROM);
}
static void
kickstart_dns(void)
{
static Boolean initted = FALSE;
int time;
char *cp;
cp = variable_get(VAR_MEDIA_TIMEOUT);
if (!cp)
time = MEDIA_TIMEOUT;
else
time = atoi(cp);
if (!time)
time = 100;
if (!initted) {
res_init();
_res.retry = 2; /* 2 times seems a reasonable number to me */
_res.retrans = time / 2; /* so spend half our alloted time on each try */
initted = TRUE;
}
}
char *
cpioVerbosity()
{
@ -362,6 +385,7 @@ mediaSetFTP(dialogMenuItem *self)
msgDebug("port # = `%d'\n", FtpPort);
}
if (variable_get(VAR_NAMESERVER)) {
kickstart_dns();
if ((inet_addr(hostname) == INADDR_NONE) && (gethostbyname(hostname) == NULL)) {
msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\n"
"name server, gateway and network interface are correctly configured?", hostname);
@ -456,6 +480,7 @@ mediaSetNFS(dialogMenuItem *self)
msgDebug("mediaSetNFS: Net device init failed\n");
}
if (variable_get(VAR_NAMESERVER)) {
kickstart_dns();
if ((inet_addr(hostname) == INADDR_NONE) && (gethostbyname(hostname) == NULL)) {
msgConfirm("Cannot resolve hostname `%s'! Are you sure that your\n"
"name server, gateway and network interface are correctly configured?", hostname);