-.\" $OpenBSD: dhclient.8,v 1.29 2017/02/15 19:36:24 krw Exp $
+.\" $OpenBSD: dhclient.8,v 1.30 2017/06/28 14:35:43 krw Exp $
.\"
.\" Copyright (c) 1997 The Internet Software Consortium.
.\" All rights reserved.
.\" Enterprises. To learn more about the Internet Software Consortium,
.\" see ``http://www.isc.org/isc''. To learn more about Vixie
.\" Enterprises, see ``http://www.vix.com''.
-.Dd $Mdocdate: February 15 2017 $
+.Dd $Mdocdate: June 28 2017 $
.Dt DHCLIENT 8
.Os
.Sh NAME
will be the lease offered by the DHCP server;
.Dq effective
will be the modified lease bound to the interface.
-.Ar file
-will be truncated when a lease is no longer bound to the interface or the
-link goes down.
.It Fl l Ar file
Specify an alternate location to
.Pa /var/db/dhclient.leases. Ns Aq Ar IFNAME
database, so that the host can boot quickly on that network rather
than cycling through the list of old leases.
.Sh SIGNALS
-While running,
-.Nm
-reacts to a few different signals:
-.Bl -tag -width "USR1, USR2XXX"
+.Bl -tag -width "HUP"
.It Dv HUP
On receiving
.Dv HUP
will restart itself, reading
.Xr dhclient.conf 5
and obtaining a new lease.
-.It Dv INT
-On receiving
-.Dv INT
-.Nm
-will exit after attempting to remove any routes, interface addresses
-or temporary files it created.
-.It Dv QUIT
-On receiving
-.Dv QUIT
-.Nm
-will dump core and exit without attempting to remove any routes, interface
-addresses or temporary files it created.
-.It Dv TERM
-On receiving
-.Dv TERM
-.Nm
-will exit without attempting to remove any routes, interface addresses
-or temporary files it created.
-.It Dv USR1, USR2
-On receiving either
-.Dv USR1
-or
-.Dv USR2 ,
-.Nm
-will exit after attempting to remove any routes, interface addresses
-or temporary files it created.
-.El
.Sh FILES
.Bl -tag -width "/var/db/dhclient.leases.<IFNAME>XXX" -compact
.It Pa /etc/dhclient.conf
-/* $OpenBSD: dhclient.c,v 1.450 2017/06/28 12:53:46 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.451 2017/06/28 14:35:43 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
state_reboot(ifi);
}
} else {
- /* Let monitoring programs see link loss. */
- if (optionDB) {
- rewind(optionDB);
- ftruncate(fileno(optionDB), 0);
- }
/* No need to wait for anything but link. */
cancel_timeout(ifi);
}
close(fd);
if (strlen(path_option_db) != 0) {
- if ((optionDB = fopen(path_option_db, "w")) == NULL)
+ if ((optionDB = fopen(path_option_db, "a")) == NULL)
fatal("can't open %s", path_option_db);
}
if (rdaemon(nullfd) == -1)
fatal("Cannot daemonize");
- /* Catch stuff that might be trying to terminate the program. */
signal(SIGHUP, sighdlr);
- signal(SIGINT, sighdlr);
- signal(SIGTERM, sighdlr);
- signal(SIGUSR1, sighdlr);
- signal(SIGUSR2, sighdlr);
-
signal(SIGPIPE, SIG_IGN);
}
struct pollfd pfd[1];
struct imsgbuf *priv_ibuf;
ssize_t n;
- int nfds, rslt, got_imsg_hup = 0;
+ int nfds, got_imsg_hup = 0;
switch (fork()) {
case -1:
imsg_clear(priv_ibuf);
close(fd);
- if (strlen(path_option_db)) {
- /* Truncate the file so monitoring process see exit. */
- rslt = truncate(path_option_db, 0);
- if (rslt == -1)
- log_warn("Unable to truncate '%s'", path_option_db);
- }
-
- /*
- * SIGTERM is used by system at shut down. Be nice and don't cleanup
- * routes, possibly preventing NFS from properly shutting down.
- */
- if (quit != SIGTERM) {
- priv_cleanup(ifi);
- }
-
if (quit == SIGHUP) {
if (!got_imsg_hup)
log_warnx("%s; restarting.", strsignal(quit));
-/* $OpenBSD: dhcpd.h,v 1.196 2017/06/27 13:24:49 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.197 2017/06/28 14:35:43 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
extern volatile sig_atomic_t quit;
extern struct in_addr deleting;
extern struct in_addr adding;
-extern struct in_addr active_addr;
/* options.c */
int cons_options(struct interface_info *, struct option_data *);
-/* $OpenBSD: kroute.c,v 1.95 2017/06/28 11:53:08 krw Exp $ */
+/* $OpenBSD: kroute.c,v 1.96 2017/06/28 14:35:43 krw Exp $ */
/*
* Copyright 2012 Kenneth R Westerback <krw@openbsd.org>
}
}
-struct in_addr active_addr;
struct in_addr deleting;
struct in_addr adding;
void
flush_routes(void)
{
- struct imsg_flush_routes imsg;
int rslt;
- imsg.zapzombies = 1;
-
- rslt = imsg_compose(unpriv_ibuf, IMSG_FLUSH_ROUTES, 0, 0, -1,
- &imsg, sizeof(imsg));
+ rslt = imsg_compose(unpriv_ibuf, IMSG_FLUSH_ROUTES, 0, 0, -1, NULL, 0);
if (rslt == -1)
log_warn("flush_routes: imsg_compose");
}
void
-priv_flush_routes(struct interface_info *ifi, struct imsg_flush_routes *imsg)
+priv_flush_routes(struct interface_info *ifi)
{
char ifname[IF_NAMESIZE];
struct sockaddr *rti_info[RTAX_MAX];
delete_route(ifi, s, rtm);
break;
case ROUTE_LABEL_DHCLIENT_DEAD:
- if (imsg->zapzombies)
- delete_route(ifi, s, rtm);
+ delete_route(ifi, s, rtm);
break;
case ROUTE_LABEL_DHCLIENT_LIVE:
case ROUTE_LABEL_DHCLIENT_UNKNOWN:
log_warn("SIOCAIFADDR failed (%s)", inet_ntoa(imsg->addr));
close(s);
-
- active_addr = imsg->addr;
-}
-
-/*
- * priv_cleanup removes dhclient installed routes and address.
- */
-void
-priv_cleanup(struct interface_info *ifi)
-{
- struct imsg_flush_routes fimsg;
- struct imsg_delete_address dimsg;
-
- fimsg.zapzombies = 0; /* Only zapzombies when binding a lease. */
- priv_flush_routes(ifi, &fimsg);
-
- if (active_addr.s_addr == INADDR_ANY)
- return;
-
- dimsg.addr = active_addr;
- priv_delete_address(ifi, &dimsg);
}
/*
-/* $OpenBSD: privsep.c,v 1.50 2017/06/24 23:32:57 krw Exp $ */
+/* $OpenBSD: privsep.c,v 1.51 2017/06/28 14:35:43 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
break;
case IMSG_FLUSH_ROUTES:
- if (imsg.hdr.len != IMSG_HEADER_SIZE +
- sizeof(struct imsg_flush_routes))
+ if (imsg.hdr.len != IMSG_HEADER_SIZE)
log_warnx("bad IMSG_FLUSH_ROUTES");
else
- priv_flush_routes(ifi, imsg.data);
+ priv_flush_routes(ifi);
break;
case IMSG_ADD_ROUTE:
-/* $OpenBSD: privsep.h,v 1.38 2017/06/24 23:32:57 krw Exp $ */
+/* $OpenBSD: privsep.h,v 1.39 2017/06/28 14:35:43 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
struct in_addr mask;
};
-struct imsg_flush_routes {
- int zapzombies;
-};
-
struct imsg_add_route {
struct in_addr dest;
struct in_addr netmask;
void add_static_routes(struct option_data *, struct in_addr);
void add_classless_static_routes(struct option_data *, struct in_addr);
void priv_add_route(struct interface_info *, struct imsg_add_route *);
-void priv_flush_routes(struct interface_info *, struct imsg_flush_routes *);
+void priv_flush_routes(struct interface_info *);
char *resolv_conf_contents(struct interface_info *ifi, struct option_data *,
struct option_data *, struct option_data *);
void priv_set_interface_mtu(struct interface_info *,
struct imsg_set_interface_mtu *);
-
-void priv_cleanup(struct interface_info *);