From: Ted Lemon Date: Sun, 9 Jul 2000 07:00:06 +0000 (+0000) Subject: - Fix a bug where the first host declaration with a hardware address X-Git-Tag: V3-BETA-2-PATCH-1~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1af245e1790c4a2815c8798bb3013f65350dde0;p=thirdparty%2Fdhcp.git - Fix a bug where the first host declaration with a hardware address wasn't being entered into the database. --- diff --git a/server/mdb.c b/server/mdb.c index 4c51b00da..a6d2e4281 100644 --- a/server/mdb.c +++ b/server/mdb.c @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: mdb.c,v 1.39 2000/07/06 22:40:27 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n"; +"$Id: mdb.c,v 1.40 2000/07/09 07:00:06 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -124,25 +124,22 @@ isc_result_t enter_host (hd, dynamicp, commit) } else { /* If there isn't already a host decl matching this address, add it to the hash table. */ - if (!host_hash_lookup (&hp, host_hw_addr_hash, - hd -> interface.hbuf, - hd -> interface.hlen, MDL)) { - host_hash_add (host_hw_addr_hash, - hd -> interface.hbuf, - hd -> interface.hlen, - hd, MDL); - } + host_hash_lookup (&hp, host_hw_addr_hash, + hd -> interface.hbuf, + hd -> interface.hlen, MDL); + } + if (!hp) + host_hash_add (host_hw_addr_hash, hd -> interface.hbuf, + hd -> interface.hlen, hd, MDL); + else { + /* If there was already a host declaration for + this hardware address, add this one to the + end of the list. */ + for (np = hp; np -> n_ipaddr; np = np -> n_ipaddr) + ; + host_reference (&np -> n_ipaddr, hd, MDL); + host_dereference (&hp, MDL); } - } - - /* If there was already a host declaration for this hardware - address, add this one to the end of the list. */ - - if (hp) { - for (np = hp; np -> n_ipaddr; np = np -> n_ipaddr) - ; - host_reference (&np -> n_ipaddr, hd, MDL); - host_dereference (&hp, MDL); } /* See if there's a statement that sets the client identifier.