This is primarily for interaction with 3rd party link management, such as PPP.
More work on #159.
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd March 19, 2009
+.Dd March 20, 2009
.Dt DHCPCD 8 SMM
.Os
.Sh NAME
.Nd an RFC 2131 compliant DHCP client
.Sh SYNOPSIS
.Nm
-.Op Fl bdknpqABDEGKLTV
+.Op Fl bdeknpqABDEGKLTV
.Op Fl c , -script Ar script
.Op Fl f , -config Ar file
.Op Fl h , -hostname Ar hostname
Subsequent debug options stop
.Nm
from daemonising.
+.It Fl e , -reconfigure
+.Nm
+will re-apply IP address, routing and run
+.Xr dhcpcd-run-hooks 8
+for each interface.
+This is useful so that a 3rd party such as PPP or VPN can change the routing
+table and / or DNS, etc and then instruct dhcpcd to put things back afterwards.
.It Fl f , -config Ar file
Specify a config to load instead of
.Pa @SYSCONFDIR@/dhcpcd.conf .
static void
usage(void)
{
- printf("usage: "PACKAGE" [-dknpqxyADEGHKLOTV] [-c script] [-f file ]"
+ printf("usage: "PACKAGE" [-deknpqxyADEGHKLOTV] [-c script] [-f file ]"
" [-h hostname]\n"
" [-i classID ] [-l leasetime] [-m metric]"
" [-o option] [-r ipaddr]\n"
syslog(LOG_INFO, "received SIGHUP, releasing lease");
do_release = 1;
break;
+ case SIGUSR1:
+ syslog(LOG_INFO, "received SIGUSR, reconfiguring");
+ for (iface = ifaces; iface; iface = iface->next)
+ if (iface->state->new)
+ configure(iface);
+ break;
case SIGPIPE:
syslog(LOG_WARNING, "received SIGPIPE");
return;
handle_args(struct fd_list *fd, int argc, char **argv)
{
struct interface *ifs, *ifp, *ifl, *ifn, *ift;
- int do_exit = 0, do_release = 0, do_reboot = 0, opt, oi = 0;
+ int do_exit = 0, do_release = 0, do_reboot = 0, do_reconf = 0;
+ int opt, oi = 0;
ssize_t len;
size_t l;
struct iovec iov[2];
while ((opt = getopt_long(argc, argv, IF_OPTS, cf_options, &oi)) != -1)
{
switch (opt) {
+ case 'e':
+ do_reconf = 1;
+ break;
case 'k':
do_release = 1;
break;
if (ifn) {
if (do_reboot)
reconf_reboot(ifn, argc, argv);
+ else if (do_reconf && ifn->state->new)
+ configure(ifn);
free_interface(ifp);
} else {
ifp->next = NULL;
while ((opt = getopt_long(argc, argv, IF_OPTS, cf_options, &oi)) != -1)
{
switch (opt) {
+ case 'e':
+ sig = SIGUSR1;
+ break;
case 'f':
cffile = optarg;
break;
{"background", no_argument, NULL, 'b'},
{"script", required_argument, NULL, 'c'},
{"debug", no_argument, NULL, 'd'},
+ {"reconfigure", no_argument, NULL, 'e'},
{"config", required_argument, NULL, 'f'},
{"hostname", optional_argument, NULL, 'h'},
{"vendorclassid", optional_argument, NULL, 'i'},
struct rt *rt;
switch(opt) {
+ case 'e': /* FALLTHROUGH */
case 'n': /* FALLTHROUGH */
case 'x': /* FALLTHROUGH */
case 'T': /* We need to handle non interface options */
/* Don't set any optional arguments here so we retain POSIX
* compatibility with getopt */
-#define IF_OPTS "bc:df:h:i:kl:m:no:pqr:s:t:u:v:xy:z:ABC:DEF:GI:KLO:Q:TVX:Z:"
+#define IF_OPTS "bc:def:h:i:kl:m:no:pqr:s:t:u:v:xy:z:ABC:DEF:GI:KLN:O:Q:TVX:Z:"
#define DEFAULT_TIMEOUT 30
#define DEFAULT_REBOOT 10