2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-01 23:05:29 +00:00

Copy the entire chaddr field, even if the length is shorter than the total. This works around a bug in certain Microsoft clients. If the options aren't valid, just copy the option buffer from the incoming packet into the outgoing packet. This lets NeXT boxes boot. Adjust calling conventions for cons_options.

This commit is contained in:
Ted Lemon
1998-02-06 01:05:39 +00:00
parent 36f5cb7ca4
commit d8ae14c614

View File

@@ -42,7 +42,7 @@
#ifndef lint #ifndef lint
static char copyright[] = 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.29 1998/02/06 01:05:39 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -222,9 +222,17 @@ void bootp (packet)
memset (&raw, 0, sizeof raw); memset (&raw, 0, sizeof raw);
outgoing.raw = &raw; outgoing.raw = &raw;
/* Come up with a list of options that we want to send to this /* If we didn't get a known vendor magic number on the way in,
client. Start with the per-subnet options, and then override just copy the input options to the output. */
those with client-specific options. */ 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);
@@ -233,21 +241,22 @@ void bootp (packet)
options [i] = hp -> group -> options [i]; options [i] = hp -> group -> options [i];
} }
/* Pack the options into the buffer. Unlike DHCP, we can't /* Pack the options into the buffer. Unlike DHCP, we
pack options into the filename and server name buffers. */ can't pack options into the filename and server
name buffers. */
outgoing.packet_length = outgoing.packet_length =
cons_options (packet, outgoing.raw, options, 0, 0, 1); cons_options (packet, outgoing.raw, 0, options,
(struct agent_options *)0, 0, 0, 1);
if (outgoing.packet_length < BOOTP_MIN_LEN) if (outgoing.packet_length < BOOTP_MIN_LEN)
outgoing.packet_length = BOOTP_MIN_LEN; outgoing.packet_length = BOOTP_MIN_LEN;
}
/* Take the fields that we care about... */ /* Take the fields that we care about... */
raw.op = BOOTREPLY; raw.op = BOOTREPLY;
raw.htype = packet -> raw -> htype; raw.htype = packet -> raw -> htype;
raw.hlen = packet -> raw -> hlen; raw.hlen = packet -> raw -> hlen;
memcpy (raw.chaddr, packet -> raw -> chaddr, raw.hlen); memcpy (raw.chaddr, packet -> raw -> chaddr, sizeof raw.chaddr);
memset (&raw.chaddr [raw.hlen], 0,
(sizeof raw.chaddr) - raw.hlen);
raw.hops = packet -> raw -> hops; raw.hops = packet -> raw -> hops;
raw.xid = packet -> raw -> xid; raw.xid = packet -> raw -> xid;
raw.secs = packet -> raw -> secs; raw.secs = packet -> raw -> secs;