summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2005-01-31 22:21:45 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2005-01-31 22:21:45 +0000
commit72378996c9de7c7b15adcb73922d5d9b8825d98e (patch)
tree6da4a98a0932c8c3e0bd5e5e1649f029e0630428 /usr.sbin
parentd3bd0af858d3c49891e90c22bdf2ccf006d8ab55 (diff)
Be a bit more paranoid about leases that are currently acked. There is a
small window where it is possible that a lease is acked and simultaniously removed and so the state is not removed. This may be a cause for the "already acking" issue. OK millert@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/dhcpd/dhcp.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.sbin/dhcpd/dhcp.c b/usr.sbin/dhcpd/dhcp.c
index 3946fd80686..a453cc270b4 100644
--- a/usr.sbin/dhcpd/dhcp.c
+++ b/usr.sbin/dhcpd/dhcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhcp.c,v 1.18 2005/01/31 21:23:08 claudio Exp $ */
+/* $OpenBSD: dhcp.c,v 1.19 2005/01/31 22:21:44 claudio Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998, 1999
@@ -400,6 +400,13 @@ dhcprelease(struct packet *packet)
packet->interface->name,
lease ? "" : "not ");
+ /* If we're already acking this lease, don't do it again. */
+ if (lease && lease->state) {
+ note("DHCPRELEASE already acking lease %s",
+ piaddr(lease->ip_addr));
+ return;
+ }
+
/* If we found a lease, release it. */
if (lease && lease->ends > cur_time) {
/*
@@ -463,6 +470,13 @@ dhcpdecline(struct packet *packet)
packet->raw->giaddr.s_addr ? inet_ntoa(packet->raw->giaddr) :
packet->interface->name);
+ /* If we're already acking this lease, don't do it again. */
+ if (lease && lease->state) {
+ note("DHCPDECLINE already acking lease %s",
+ piaddr(lease->ip_addr));
+ return;
+ }
+
/* If we found a lease, mark it as unusable and complain. */
if (lease)
abandon_lease(lease, "declined.");