]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Fix a couple of cases where the first host wouldn't be hashed.
authorTed Lemon <source@isc.org>
Fri, 30 Jun 2000 00:40:19 +0000 (00:40 +0000)
committerTed Lemon <source@isc.org>
Fri, 30 Jun 2000 00:40:19 +0000 (00:40 +0000)
server/mdb.c

index c102aa1758d0869d4b13f33e80d4fa87efda71b2..ab13830658eaf889e76ccef89defb520a4ce6dfd 100644 (file)
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: mdb.c,v 1.34 2000/06/07 00:15:53 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: mdb.c,v 1.35 2000/06/30 00:40:19 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -74,6 +74,9 @@ isc_result_t enter_host (hd, dynamicp, commit)
                                  (hash_dereference)host_dereference, 0);
                if (!host_name_hash)
                        log_fatal ("Can't allocate host name hash");
+               host_hash_add (host_name_hash,
+                              (unsigned char *)hd -> name,
+                              strlen (hd -> name), hd, MDL);
        } else {
                host_hash_lookup (&hp, host_name_hash,
                                  (unsigned char *)hd -> name,
@@ -173,6 +176,11 @@ isc_result_t enter_host (hd, dynamicp, commit)
                                          0);
                        if (!host_uid_hash)
                                log_fatal ("Can't allocate host/uid hash");
+
+                       host_hash_add (host_uid_hash,
+                                      hd -> client_identifier.data,
+                                      hd -> client_identifier.len,
+                                      hd, MDL);
                } else {
                        /* If there's already a host declaration for this
                           client identifier, add this one to the end of the
@@ -184,10 +192,13 @@ isc_result_t enter_host (hd, dynamicp, commit)
                                /* Don't link it in twice... */
                                if (!np) {
                                        for (np = hp; np -> n_ipaddr;
-                                            np = np -> n_ipaddr)
-                                               ;
-                                       host_reference (&np -> n_ipaddr,
-                                                       hd, MDL);
+                                            np = np -> n_ipaddr) {
+                                               if (hd == np)
+                                                   break;
+                                       }
+                                       if (hd != np)
+                                           host_reference (&np -> n_ipaddr,
+                                                           hd, MDL);
                                }
                                host_dereference (&hp, MDL);
                        } else {