From: Ted Lemon Date: Thu, 27 Jun 1996 19:09:51 +0000 (+0000) Subject: Don't throw away a lease because the requestor didn't give a UID and the lease has... X-Git-Tag: BETA_4_6~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efa253d0db026389f215adae0d8bee2f28a0eff1;p=thirdparty%2Fdhcp.git Don't throw away a lease because the requestor didn't give a UID and the lease has one iff the requestor's hardware address matches the lease's hardware address and the lease can be assigned to a Dynamic BOOTp host --- diff --git a/common/memory.c b/common/memory.c index 9e9ef6f94..507cd385c 100644 --- a/common/memory.c +++ b/common/memory.c @@ -385,9 +385,15 @@ int supersede_lease (comp, lease, commit) /* If the existing lease hasn't expired and has a different unique identifier or, if it doesn't have a unique identifier, a different hardware address, then the two - leases are in conflict. */ + leases are in conflict. If the existing lease has a uid + and the new one doesn't, but they both have the same + hardware address, and dynamic bootp is allowed on this + lease, then we allow that, in case a dynamic BOOTP lease is + requested *after* a DHCP lease has been assigned. */ + if (comp -> ends > cur_time && - ((comp -> uid && + ((comp -> uid && (lease -> uid || + !(lease -> flags & DYNAMIC_BOOTP_OK)) && (comp -> uid_len != lease -> uid_len || memcmp (comp -> uid, lease -> uid, comp -> uid_len))) || (!comp -> uid && diff --git a/memory.c b/memory.c index 9e9ef6f94..507cd385c 100644 --- a/memory.c +++ b/memory.c @@ -385,9 +385,15 @@ int supersede_lease (comp, lease, commit) /* If the existing lease hasn't expired and has a different unique identifier or, if it doesn't have a unique identifier, a different hardware address, then the two - leases are in conflict. */ + leases are in conflict. If the existing lease has a uid + and the new one doesn't, but they both have the same + hardware address, and dynamic bootp is allowed on this + lease, then we allow that, in case a dynamic BOOTP lease is + requested *after* a DHCP lease has been assigned. */ + if (comp -> ends > cur_time && - ((comp -> uid && + ((comp -> uid && (lease -> uid || + !(lease -> flags & DYNAMIC_BOOTP_OK)) && (comp -> uid_len != lease -> uid_len || memcmp (comp -> uid, lease -> uid, comp -> uid_len))) || (!comp -> uid &&