]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Allow unnamed host declarations.
authorTed Lemon <source@isc.org>
Tue, 17 Mar 1998 06:20:51 +0000 (06:20 +0000)
committerTed Lemon <source@isc.org>
Tue, 17 Mar 1998 06:20:51 +0000 (06:20 +0000)
server/bootp.c
server/confpars.c
server/dhcp.c

index 1b4b1e275a6b11e0f6b4cbea110e3c469521fccf..a3e17f0cebab54c0f552de94b1e4a63c5bf6f746 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: bootp.c,v 1.29 1998/02/06 01:05:39 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: bootp.c,v 1.30 1998/03/17 06:18:06 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -110,13 +110,21 @@ void bootp (packet)
 
                if (host && (!host -> group -> allow_booting)) {
                        note ("Ignoring excluded BOOTP client %s",
-                             host -> name);
+                             host -> name
+                             ? host -> name
+                             : print_hw_addr (packet -> raw -> htype,
+                                              packet -> raw -> hlen,
+                                              packet -> raw -> chaddr));
                        return;
                }
                        
                if (host && (!host -> group -> allow_bootp)) {
                        note ("Ignoring BOOTP request from client %s",
-                             host -> name);
+                             host -> name
+                             ? host -> name
+                             : print_hw_addr (packet -> raw -> htype,
+                                              packet -> raw -> hlen,
+                                              packet -> raw -> chaddr));
                        return;
                }
                        
index e9d3b3ba8ca1449a4040be15777f199648d18b57..ba635d466ddbd4807196e1981286a70a2bd47382 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: confpars.c,v 1.47 1998/03/16 06:17:37 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: confpars.c,v 1.48 1998/03/17 06:18:58 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -485,11 +485,17 @@ void parse_host_declaration (cfile, group)
        char *val;
        int token;
        struct host_decl *host;
-       char *name = parse_host_name (cfile);
+       char *name;
        int declaration = 0;
 
-       if (!name)
-               return;
+       token = peek_token (&val, cfile);
+       if (token != LBRACE) {
+               name = parse_host_name (cfile);
+               if (!name)
+                       return;
+       } else {
+               name = (char *)0;
+       }
 
        host = (struct host_decl *)dmalloc (sizeof (struct host_decl),
                                            "parse_host_declaration");
index f8a227cabe9dd3b75588e3ffaea14652c297900f..7a7d3e7f402f345da331d20215fd1d571aa9be19 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dhcp.c,v 1.59 1998/03/16 06:18:03 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dhcp.c,v 1.60 1998/03/17 06:20:51 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -153,7 +153,11 @@ void dhcpdiscover (packet)
        } else if (lease -> host &&
                    !lease -> host -> group -> allow_booting) {
                note ("Declining to boot client %s",
-                     lease -> host -> name);
+                     lease -> host -> name
+                     ? lease -> host -> name
+                     : print_hw_addr (packet -> raw -> htype,
+                                      packet -> raw -> hlen,
+                                      packet -> raw -> chaddr));
        } else
                ack_lease (packet, lease, DHCPOFFER, cur_time + 120);
 }
@@ -1280,11 +1284,12 @@ struct lease *find_lease (packet, share, ours)
                    ip_lease -> uid_len ==  packet -> options [i].len &&
                    !memcmp (packet -> options [i].data,
                             ip_lease -> uid, ip_lease -> uid_len)) {
-                       warn ("client %s has duplicate leases on %s",
-                             print_hw_addr (packet -> raw -> htype,
-                                            packet -> raw -> hlen,
-                                            packet -> raw -> chaddr),
-                             ip_lease -> shared_network -> name);
+                       if (uid_lease -> ends > cur_time)
+                               warn ("client %s has duplicate leases on %s",
+                                     print_hw_addr (packet -> raw -> htype,
+                                                    packet -> raw -> hlen,
+                                                    packet -> raw -> chaddr),
+                                     ip_lease -> shared_network -> name);
                        uid_lease = ip_lease;
                }
                ip_lease = (struct lease *)0;