summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1999-07-18 10:18:06 +0000
committerjkh <jkh@FreeBSD.org>1999-07-18 10:18:06 +0000
commitd51b32f103a73f7cbbbb134928dcbae4cba0509d (patch)
tree5fa63d79c862dcb5bf6217590120450cba7b516d /usr.sbin
parent47d2323c99837c81fd710aee064533a6e0e88baf (diff)
downloadFreeBSD-src-d51b32f103a73f7cbbbb134928dcbae4cba0509d.zip
FreeBSD-src-d51b32f103a73f7cbbbb134928dcbae4cba0509d.tar.gz
Some additional optimizations for using DHCP.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/sade/install.c4
-rw-r--r--usr.sbin/sade/sade.h3
-rw-r--r--usr.sbin/sysinstall/install.c4
-rw-r--r--usr.sbin/sysinstall/network.c5
-rw-r--r--usr.sbin/sysinstall/sysinstall.h3
-rw-r--r--usr.sbin/sysinstall/tcpip.c14
6 files changed, 21 insertions, 12 deletions
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index 17ff049..aba70fd 100644
--- a/usr.sbin/sade/install.c
+++ b/usr.sbin/sade/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.240 1999/07/06 09:19:35 jkh Exp $
+ * $Id: install.c,v 1.241 1999/07/16 11:13:09 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -533,7 +533,7 @@ nodisks:
dialog_clear_norefresh();
tmp = tcpDeviceSelect();
dialog_clear_norefresh();
- if (tmp && !msgYesNo("Would you like to bring the %s interface up right now?", tmp->name))
+ if (tmp && !((DevInfo *)tmp->private)->use_dhcp && !msgYesNo("Would you like to bring the %s interface up right now?", tmp->name))
if (!tmp->init(tmp))
msgConfirm("Initialization of %s device failed.", tmp->name);
}
diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h
index 02e44dd..f10927d 100644
--- a/usr.sbin/sade/sade.h
+++ b/usr.sbin/sade/sade.h
@@ -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: sysinstall.h,v 1.168 1999/07/06 08:45:40 jkh Exp $
+ * $Id: sysinstall.h,v 1.169 1999/07/16 11:13:09 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -316,6 +316,7 @@ typedef int (*commandFunc)(char *key, void *data);
/* This is the structure that Network devices carry around in their private, erm, structures */
typedef struct _devPriv {
+ int use_dhcp;
char ipaddr[IPADDR_FIELD_LEN];
char netmask[IPADDR_FIELD_LEN];
char extras[EXTRAS_FIELD_LEN];
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index 17ff049..aba70fd 100644
--- a/usr.sbin/sysinstall/install.c
+++ b/usr.sbin/sysinstall/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.240 1999/07/06 09:19:35 jkh Exp $
+ * $Id: install.c,v 1.241 1999/07/16 11:13:09 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -533,7 +533,7 @@ nodisks:
dialog_clear_norefresh();
tmp = tcpDeviceSelect();
dialog_clear_norefresh();
- if (tmp && !msgYesNo("Would you like to bring the %s interface up right now?", tmp->name))
+ if (tmp && !((DevInfo *)tmp->private)->use_dhcp && !msgYesNo("Would you like to bring the %s interface up right now?", tmp->name))
if (!tmp->init(tmp))
msgConfirm("Initialization of %s device failed.", tmp->name);
}
diff --git a/usr.sbin/sysinstall/network.c b/usr.sbin/sysinstall/network.c
index 9be3117..c71f76b 100644
--- a/usr.sbin/sysinstall/network.c
+++ b/usr.sbin/sysinstall/network.c
@@ -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: network.c,v 1.35 1999/03/11 18:22:23 brian Exp $
+ * $Id: network.c,v 1.36 1999/05/19 10:49:43 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -123,6 +123,8 @@ mediaInitNetwork(Device *dev)
"in the Networking configuration menu before proceeding.", dev->name);
return FALSE;
}
+ else if (!strcmp(cp, "DHCP"))
+ goto bail;
msgNotify("ifconfig %s %s", dev->name, cp);
i = vsystem("ifconfig %s %s", dev->name, cp);
if (i) {
@@ -140,6 +142,7 @@ mediaInitNetwork(Device *dev)
msgNotify("Adding default route to %s.", rp);
vsystem("route -n add default %s", rp);
}
+bail:
if (isDebug())
msgDebug("Network initialized successfully.\n");
networkInitialized = TRUE;
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index 02e44dd..f10927d 100644
--- a/usr.sbin/sysinstall/sysinstall.h
+++ b/usr.sbin/sysinstall/sysinstall.h
@@ -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: sysinstall.h,v 1.168 1999/07/06 08:45:40 jkh Exp $
+ * $Id: sysinstall.h,v 1.169 1999/07/16 11:13:09 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -316,6 +316,7 @@ typedef int (*commandFunc)(char *key, void *data);
/* This is the structure that Network devices carry around in their private, erm, structures */
typedef struct _devPriv {
+ int use_dhcp;
char ipaddr[IPADDR_FIELD_LEN];
char netmask[IPADDR_FIELD_LEN];
char extras[EXTRAS_FIELD_LEN];
diff --git a/usr.sbin/sysinstall/tcpip.c b/usr.sbin/sysinstall/tcpip.c
index c4ba358..67205b6 100644
--- a/usr.sbin/sysinstall/tcpip.c
+++ b/usr.sbin/sysinstall/tcpip.c
@@ -1,5 +1,5 @@
/*
- * $Id: tcpip.c,v 1.80 1999/07/16 11:13:09 jkh Exp $
+ * $Id: tcpip.c,v 1.81 1999/07/18 02:20:56 jkh Exp $
*
* Copyright (c) 1995
* Gary J Palmer. All rights reserved.
@@ -39,6 +39,7 @@
#include "sysinstall.h"
#include <sys/param.h>
+#include <netdb.h>
/* The help file for the TCP/IP setup screen */
#define TCP_HELPFILE "tcp"
@@ -164,23 +165,23 @@ tcpOpenDialog(Device *devp)
SAFE_STRCPY(ipaddr, di->ipaddr);
SAFE_STRCPY(netmask, di->netmask);
SAFE_STRCPY(extras, di->extras);
+ use_dhcp = di->use_dhcp;
}
else { /* See if there are any defaults */
char *cp;
/* First try a DHCP scan if such behavior is desired */
- if (!variable_cmp(VAR_TRY_DHCP, "YES")) {
+ if (!variable_cmp(VAR_TRY_DHCP, "YES") || !msgYesNo("Do you want to try DHCP configuration of the interface?")) {
Mkdir("/var/db");
Mkdir("/var/run");
Mkdir("/tmp");
msgNotify("Scanning for DHCP servers...");
- vsystem("ifconfig %s inet 0.0.0.0 netmask 0.0.0.0 broadcast 255.255.255.255 up", devp->name);
if (!vsystem("dhclient %s", devp->name)) {
FILE *ifp;
char cmd[256];
if (isDebug())
- msgConfirm("Successful return from dhclient");
+ msgDebug("Successful return from dhclient");
snprintf(cmd, sizeof cmd, "ifconfig %s", devp->name);
ifp = popen(cmd, "r");
if (ifp) {
@@ -223,6 +224,8 @@ tcpOpenDialog(Device *devp)
use_dhcp = FALSE;
}
}
+ else
+ use_dhcp = FALSE;
/* Get old IP address from variable space, if available */
if (!ipaddr[0]) {
@@ -365,6 +368,7 @@ netconfig:
SAFE_STRCPY(di->ipaddr, ipaddr);
SAFE_STRCPY(di->netmask, netmask);
SAFE_STRCPY(di->extras, extras);
+ di->use_dhcp = use_dhcp;
sprintf(ifn, "%s%s", VAR_IFCONFIG, devp->name);
if (use_dhcp)
@@ -461,7 +465,7 @@ tcpMenuSelect(dialogMenuItem *self)
Device *tmp;
tmp = tcpDeviceSelect();
- if (tmp && !msgYesNo("Would you like to bring the %s interface up right now?", tmp->name))
+ if (tmp && !((DevInfo *)tmp->private)->use_dhcp && !msgYesNo("Would you like to bring the %s interface up right now?", tmp->name))
if (!tmp->init(tmp))
msgConfirm("Initialization of %s device failed.", tmp->name);
return DITEM_SUCCESS | DITEM_RESTORE;
OpenPOWER on IntegriCloud