summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2012-06-20 21:53:52 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2012-06-20 21:53:52 +0000
commit40e33f8efc4fdc48e50490a8c4d9f55f6b27aaa6 (patch)
tree4c3a5aba952044c4877ace4d37979168bb776a3b
parent8ce933fb38a4573d4f157e13289c76d71a8a256d (diff)
Cancel all timeouts in state_reboot(), since we can get there from any state
if a link state change happens. Fixes a problem where we'd continue to send (corrupted) discover packets after binding. ok krw@
-rw-r--r--sbin/dhclient/dhclient.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index ce3a9fc1f2e..b494467efe0 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.142 2011/12/10 15:55:43 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.143 2012/06/20 21:53:51 kettenis Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -468,6 +468,14 @@ usage(void)
void
state_reboot(void)
{
+ /* Cancel all timeouts, since a link state change gets us here
+ and can happen anytime. */
+ cancel_timeout(state_init);
+ cancel_timeout(state_selecting);
+ cancel_timeout(state_bound);
+ cancel_timeout(send_discover);
+ cancel_timeout(send_request);
+
/* If we don't remember an active lease, go straight to INIT. */
if (!client->active || client->active->is_bootp) {
state_init();