#ifndef lint
static char copyright[] =
-"$Id: dhcp.c,v 1.50 1997/06/08 04:10:41 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: dhcp.c,v 1.51 1997/09/16 18:20:30 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
/* Set up the option buffer... */
outgoing.packet_length =
- cons_options (packet, outgoing.raw, options, 0, 0);
+ cons_options (packet, outgoing.raw, options, 0, 0, 0);
/* memset (&raw.ciaddr, 0, sizeof raw.ciaddr);*/
raw.siaddr = packet -> interface -> primary_address;
return;
}
- /* Allocate a lease state structure... */
- state = new_lease_state ("ack_lease");
- if (!state)
- error ("unable to allocate lease state!");
- memset (state, 0, sizeof *state);
-
if (packet -> options [DHO_DHCP_CLASS_IDENTIFIER].len) {
vendor_class =
find_class (0,
user_class = (struct class *)0;
}
+ /*
+ * If there is not a specific host entry, and either the
+ * vendor class or user class (if they exist) deny booting,
+ * then bug out.
+ */
+ if (!lease -> host) {
+ if (vendor_class && !vendor_class -> group -> allow_booting) {
+ debug ("Booting denied by vendor class");
+ return;
+ }
+
+ if (user_class && !user_class -> group -> allow_booting) {
+ debug ("Booting denied by user class");
+ return;
+ }
+ }
+
+ /* Allocate a lease state structure... */
+ state = new_lease_state ("ack_lease");
+ if (!state)
+ error ("unable to allocate lease state!");
+ memset (state, 0, sizeof *state);
+
/* Replace the old lease hostname with the new one, if it's changed. */
if (packet -> options [DHO_HOST_NAME].len &&
lease -> client_hostname &&
int result;
int i;
struct lease_state *state = lease -> state;
+ int nulltp, bootpp;
if (!state)
error ("dhcp_reply was supplied lease with no state!");
/* See if this is a Microsoft client that NUL-terminates its
strings and expects us to do likewise... */
if (lease -> flags & MS_NULL_TERMINATION)
- packet_length = cons_options ((struct packet *)0,
- &raw, state -> options, bufs, 1);
+ nulltp = 1;
else
- packet_length = cons_options ((struct packet *)0,
- &raw, state -> options, bufs, 0);
+ nulltp = 0;
+
+ /* See if this is a bootp client... */
+ if (state -> offer)
+ bootpp = 0;
+ else
+ bootpp = 1;
+
+ /* Insert such options as will fit into the buffer. */
+ packet_length = cons_options ((struct packet *)0, &raw,
+ state -> options, bufs, nulltp, bootpp);
/* Having done the cons_options(), we can release the tree_cache
entries. */
a uid) we let the client get away with it. */
if (hw_lease &&
hw_lease -> ends >= cur_time &&
- hw_lease -> uid && hw_lease != uid_lease &&
- (packet -> packet_type != 0 ||
- !(hw_lease -> flags & DYNAMIC_BOOTP_OK)))
+ hw_lease -> uid &&
+ packet -> options [DHO_DHCP_CLIENT_IDENTIFIER].len &&
+ hw_lease != uid_lease)
hw_lease = (struct lease *)0;
/* Toss extra pointers to the same lease... */