From 2824de20614b3124f99c1d1d7a24dbd68c41c6e3 Mon Sep 17 00:00:00 2001 From: Ted Lemon Date: Tue, 11 Jun 1996 08:13:00 +0000 Subject: [PATCH] Release DHCP lease before assigning it to BOOTP client, so as to avoid unnecessary lease conflict behaviour. --- bootp.c | 13 ++++++++++++- server/bootp.c | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/bootp.c b/bootp.c index c8115ab7..a1d34164 100644 --- a/bootp.c +++ b/bootp.c @@ -119,11 +119,22 @@ void bootp (packet) and it's still okay to use dynamic bootp on that lease, reassign it. */ if (lease) { - if (lease -> flags & DYNAMIC_BOOTP_OK) { + /* If this lease can be used for dynamic bootp, + do so. */ + if ((lease -> flags & DYNAMIC_BOOTP_OK)) { + + /* If it's not a DYNAMIC_BOOTP lease, + release it before reassigning it + so that we don't get a lease + conflict. */ + if (!(lease -> flags & BOOTP_LEASE)) + release_lease (lease); + lease -> host = host; ack_lease (packet, lease, 0, 0); return; } + /* If dynamic BOOTP is no longer allowed for this lease, set it free. */ release_lease (lease); diff --git a/server/bootp.c b/server/bootp.c index c8115ab7..a1d34164 100644 --- a/server/bootp.c +++ b/server/bootp.c @@ -119,11 +119,22 @@ void bootp (packet) and it's still okay to use dynamic bootp on that lease, reassign it. */ if (lease) { - if (lease -> flags & DYNAMIC_BOOTP_OK) { + /* If this lease can be used for dynamic bootp, + do so. */ + if ((lease -> flags & DYNAMIC_BOOTP_OK)) { + + /* If it's not a DYNAMIC_BOOTP lease, + release it before reassigning it + so that we don't get a lease + conflict. */ + if (!(lease -> flags & BOOTP_LEASE)) + release_lease (lease); + lease -> host = host; ack_lease (packet, lease, 0, 0); return; } + /* If dynamic BOOTP is no longer allowed for this lease, set it free. */ release_lease (lease);