summaryrefslogtreecommitdiffstats
path: root/sbin/dhclient
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2005-06-07 04:26:14 +0000
committerbrooks <brooks@FreeBSD.org>2005-06-07 04:26:14 +0000
commit26a535f1151a9d5d2f2f70c08cf33161f7fb15b5 (patch)
treee345191dc181c953d78aebb04f1078d762297a1e /sbin/dhclient
parent3379325ae78a0b3952f675214d07d8b7a3a74e3c (diff)
downloadFreeBSD-src-26a535f1151a9d5d2f2f70c08cf33161f7fb15b5.zip
FreeBSD-src-26a535f1151a9d5d2f2f70c08cf33161f7fb15b5.tar.gz
Define _PATH_VAREMPTY.
Add a -b option to background immediatly. Add support for 802.11 routing messages to "instantly" renegotiate at lease when we associate with a new network. Submitted by: sam
Diffstat (limited to 'sbin/dhclient')
-rw-r--r--sbin/dhclient/dhclient.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index ef353c4..c3f4aaa 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,5 @@
/* $OpenBSD: dhclient.c,v 1.63 2005/02/06 17:10:13 krw Exp $ */
+/* $FreeBSD$ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -56,6 +57,12 @@
#include "dhcpd.h"
#include "privsep.h"
+#include <net80211/ieee80211_freebsd.h>
+
+#ifndef _PATH_VAREMPTY
+#define _PATH_VAREMPTY "/var/empty"
+#endif
+
#define PERIOD 0x2e
#define hyphenchar(c) ((c) == 0x2d)
#define bslashchar(c) ((c) == 0x5c)
@@ -236,6 +243,30 @@ routehandler(struct protocol *p)
ifan->ifan_index == ifi->index)
goto die;
break;
+ case RTM_IEEE80211:
+ ifan = (struct if_announcemsghdr *)rtm;
+ if (ifan->ifan_index != ifi->index)
+ break;
+ switch (ifan->ifan_what) {
+ case RTM_IEEE80211_ASSOC:
+ state_reboot(ifi);
+ break;
+ case RTM_IEEE80211_DISASSOC:
+ /*
+ * Clear existing state; transition to the init
+ * state and then wait for either a link down
+ * notification or an associate event.
+ */
+ script_init("EXPIRE", NULL);
+ script_write_params("old_", ifi->client->active);
+ if (ifi->client->alias)
+ script_write_params("alias_",
+ ifi->client->alias);
+ script_go();
+ ifi->client->state = S_INIT;
+ break;
+ }
+ break;
default:
break;
}
@@ -255,14 +286,18 @@ main(int argc, char *argv[])
extern char *__progname;
int ch, fd, quiet = 0, i = 0;
int pipe_fd[2];
+ int immediate_daemon = 0;
struct passwd *pw;
/* Initially, log errors to stderr as well as to syslogd. */
openlog(__progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY);
setlogmask(LOG_UPTO(LOG_INFO));
- while ((ch = getopt(argc, argv, "c:dl:qu")) != -1)
+ while ((ch = getopt(argc, argv, "bc:dl:nqu")) != -1)
switch (ch) {
+ case 'b':
+ immediate_daemon = 1;
+ break;
case 'c':
path_dhclient_conf = optarg;
break;
@@ -375,6 +410,9 @@ main(int argc, char *argv[])
setproctitle("%s", ifi->name);
+ if (immediate_daemon)
+ go_daemon();
+
ifi->client->state = S_INIT;
state_reboot(ifi);
OpenPOWER on IntegriCloud