summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2005-07-11 03:57:04 +0000
committerscottl <scottl@FreeBSD.org>2005-07-11 03:57:04 +0000
commitc3747a85fb453031cd429979e8e5b26765970c3f (patch)
treecabc5e56ada22e798453de6beb0f665b7445985d /usr.sbin/sysinstall
parent357fae9fdf73c79a5782f504a8f5a3cac82c0557 (diff)
downloadFreeBSD-src-c3747a85fb453031cd429979e8e5b26765970c3f.zip
FreeBSD-src-c3747a85fb453031cd429979e8e5b26765970c3f.tar.gz
Adapt sysinstall to the new dhclient. This includes explicitely telling
it about the lease file location and not invoking it with the (non-existant) '-r' option. Releasing leases works vastly different now, so this isn't needed. Submitted by: sam Approved by: re
Diffstat (limited to 'usr.sbin/sysinstall')
-rw-r--r--usr.sbin/sysinstall/tcpip.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/sysinstall/tcpip.c b/usr.sbin/sysinstall/tcpip.c
index 1d2534f..babe6ab 100644
--- a/usr.sbin/sysinstall/tcpip.c
+++ b/usr.sbin/sysinstall/tcpip.c
@@ -43,6 +43,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
+#include <paths.h>
/* The help file for the TCP/IP setup screen */
#define TCP_HELPFILE "tcp"
@@ -253,8 +254,12 @@ verifySettings(void)
static void
dhcpGetInfo(Device *devp)
{
+ char leasefile[PATH_MAX];
+
+ snprintf(leasefile, sizeof(leasefile), "%sdhclient.leases.%s",
+ _PATH_VARDB, devp->name);
/* If it fails, do it the old-fashioned way */
- if (dhcpParseLeases("/var/db/dhclient.leases", hostname, domainname,
+ if (dhcpParseLeases(leasefile, hostname, domainname,
nameserver, ipaddr, gateway, netmask) == -1) {
FILE *ifp;
char *cp, cmd[256], data[2048];
@@ -407,8 +412,9 @@ tcpOpenDialog(Device *devp)
Mkdir("/var/run");
Mkdir("/tmp");
msgNotify("Scanning for DHCP servers...");
- vsystem("dhclient -r %s", devp->name);
- if (0 == vsystem("dhclient -1 %s", devp->name)) {
+ /* XXX clear any existing lease */
+ /* XXX limit protocol to N tries */
+ if (0 == vsystem("dhclient %s", devp->name)) {
dhcpGetInfo(devp);
use_dhcp = TRUE;
}
OpenPOWER on IntegriCloud