#ifndef lint
static char copyright[] =
-"$Id: bootp.c,v 1.28 1997/09/16 18:17:55 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: bootp.c,v 1.28.2.1 1998/06/29 22:14:11 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
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;
}
memset (&raw, 0, sizeof raw);
outgoing.raw = &raw;
- /* Come up with a list of options that we want to send to this
- client. Start with the per-subnet options, and then override
- those with client-specific options. */
+ /* If we didn't get a known vendor magic number on the way in,
+ just copy the input options to the output. */
+ if (!packet -> options_valid) {
+ memcpy (outgoing.raw -> options,
+ packet -> raw -> options, DHCP_OPTION_LEN);
+ outgoing.packet_length = BOOTP_MIN_LEN;
+ } else {
+ /* Come up with a list of options that we want to send
+ to this client. Start with the per-subnet options,
+ and then override those with client-specific
+ options. */
- memcpy (options, subnet -> group -> options, sizeof options);
+ memcpy (options, subnet -> group -> options, sizeof options);
- for (i = 0; i < 256; i++) {
- if (hp -> group -> options [i])
- options [i] = hp -> group -> options [i];
- }
+ for (i = 0; i < 256; i++) {
+ if (hp -> group -> options [i])
+ options [i] = hp -> group -> options [i];
+ }
- /* Pack the options into the buffer. Unlike DHCP, we can't
- pack options into the filename and server name buffers. */
+ /* Pack the options into the buffer. Unlike DHCP, we
+ can't pack options into the filename and server
+ name buffers. */
- outgoing.packet_length =
- cons_options (packet, outgoing.raw, options, 0, 0, 1);
- if (outgoing.packet_length < BOOTP_MIN_LEN)
- outgoing.packet_length = BOOTP_MIN_LEN;
+ outgoing.packet_length =
+ cons_options (packet, outgoing.raw, options, 0, 0, 1);
+ if (outgoing.packet_length < BOOTP_MIN_LEN)
+ outgoing.packet_length = BOOTP_MIN_LEN;
+ }
/* Take the fields that we care about... */
raw.op = BOOTREPLY;
raw.htype = packet -> raw -> htype;
raw.hlen = packet -> raw -> hlen;
- memcpy (raw.chaddr, packet -> raw -> chaddr, raw.hlen);
- memset (&raw.chaddr [raw.hlen], 0,
- (sizeof raw.chaddr) - raw.hlen);
+ memcpy (raw.chaddr, packet -> raw -> chaddr, sizeof raw.chaddr);
raw.hops = packet -> raw -> hops;
raw.xid = packet -> raw -> xid;
raw.secs = packet -> raw -> secs;
strncpy (raw.file, hp -> group -> filename,
(sizeof raw.file) - 1);
raw.file [(sizeof raw.file) - 1] = 0;
- }
+ } else
+ memcpy (raw.file, packet -> raw -> file, sizeof raw.file);
/* Set up the hardware destination address... */
hto.htype = packet -> raw -> htype;