diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-01-19 21:07:14 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2019-01-19 21:07:14 +0000 |
commit | a98af63ef7dca1b46a2d062513e594e97610e471 (patch) | |
tree | 801e272900bdb735c48b52f80f6fecadb476d6ee /sbin/dhclient/dispatch.c | |
parent | fcba18051dd8ef5c79f9af51162ce69870443890 (diff) |
Since dhclient no longer tries to clean up when exiting, there is no
need to start a new copy when LLADDR or SSID changes. Just go back to
S_PREBOOT and get a new lease.
Fewer log messages, faster join'ing new networks, simpler code.
Diffstat (limited to 'sbin/dhclient/dispatch.c')
-rw-r--r-- | sbin/dhclient/dispatch.c | 36 |
1 files changed, 7 insertions, 29 deletions
diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c index 5fdeaeb7e79..cd63d0194fe 100644 --- a/sbin/dhclient/dispatch.c +++ b/sbin/dhclient/dispatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dispatch.c,v 1.162 2019/01/19 02:55:10 krw Exp $ */ +/* $OpenBSD: dispatch.c,v 1.163 2019/01/19 21:07:13 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -76,7 +76,6 @@ void bpffd_handler(struct interface_info *); void dhcp_packet_dispatch(struct interface_info *, struct sockaddr_in *, struct ether_addr *); void flush_unpriv_ibuf(void); -void sendrestart(void); /* * Loop waiting for packets, timeouts or routing messages. @@ -91,20 +90,12 @@ dispatch(struct interface_info *ifi, int routefd) while (quit == 0 || quit == RESTART) { if (quit == RESTART) { - /* Ignore any future packets, messages or timeouts. */ - if (ifi->bpffd != -1) { - close(ifi->bpffd); - ifi->bpffd = -1; - } - if (routefd != -1) { - close(routefd); - routefd = -1; - } - if (ifi->timeout_func != NULL) - cancel_timeout(ifi); - sendrestart(); - to_msec = 100; - } else if (ifi->timeout_func != NULL) { + quit = 0; + time(&ifi->startup_time); + ifi->state = S_PREBOOT; + state_preboot(ifi); + } + if (ifi->timeout_func != NULL) { time(&cur_time); if (ifi->timeout <= cur_time) { func = ifi->timeout_func; @@ -324,16 +315,3 @@ cancel_timeout(struct interface_info *ifi) ifi->timeout = 0; ifi->timeout_func = NULL; } - -/* - * Inform the [priv] process it needs to restart. - */ -void -sendrestart(void) -{ - int rslt; - - rslt = imsg_compose(unpriv_ibuf, IMSG_RESTART, 0, 0, -1, NULL, 0); - if (rslt == -1) - log_warn("%s: imsg_compose(IMSG_RESTART)", log_procname); -} |