From: Ted Lemon Date: Tue, 17 Mar 1998 06:20:51 +0000 (+0000) Subject: Allow unnamed host declarations. X-Git-Tag: carrel-2~150 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f3c3d67454942b9eb6c5ff5ed9cbc8f8a1bc7b87;p=thirdparty%2Fdhcp.git Allow unnamed host declarations. --- diff --git a/server/bootp.c b/server/bootp.c index 1b4b1e275..a3e17f0ce 100644 --- a/server/bootp.c +++ b/server/bootp.c @@ -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; } diff --git a/server/confpars.c b/server/confpars.c index e9d3b3ba8..ba635d466 100644 --- a/server/confpars.c +++ b/server/confpars.c @@ -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"); diff --git a/server/dhcp.c b/server/dhcp.c index f8a227cab..7a7d3e7f4 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -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;