Fix conflicts in merge.
This commit is contained in:
parent
28f100096f
commit
7ccf21d94d
|
@ -56,7 +56,7 @@
|
|||
|
||||
#ifndef lint
|
||||
static char ocopyright[] =
|
||||
"$Id: dhclient.c,v 1.15 1999/03/05 17:52:44 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: dhclient.c,v 1.16 1999/03/26 17:52:45 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
@ -97,7 +97,7 @@ void catch_sigterm PROTO ((int));
|
|||
static char copyright[] =
|
||||
"Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.";
|
||||
static char arr [] = "All rights reserved.";
|
||||
static char message [] = "Internet Software Consortium DHCP Client V2.0b1pl18";
|
||||
static char message [] = "Internet Software Consortium DHCP Client V2.0b1pl19";
|
||||
static char contrib [] = "\nPlease contribute if you find this software useful.";
|
||||
static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.html\n";
|
||||
|
||||
|
@ -493,7 +493,9 @@ void dhcpack (packet)
|
|||
packet -> raw -> hlen) ||
|
||||
(memcmp (packet -> interface -> hw_address.haddr,
|
||||
packet -> raw -> chaddr, packet -> raw -> hlen))) {
|
||||
#if defined (DEBUG)
|
||||
debug ("DHCPACK in wrong transaction.");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -501,7 +503,9 @@ void dhcpack (packet)
|
|||
ip -> client -> state != S_REQUESTING &&
|
||||
ip -> client -> state != S_RENEWING &&
|
||||
ip -> client -> state != S_REBINDING) {
|
||||
#if defined (DEBUG)
|
||||
debug ("DHCPACK in wrong state.");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -738,7 +742,9 @@ void dhcpoffer (packet)
|
|||
packet -> raw -> hlen) ||
|
||||
(memcmp (packet -> interface -> hw_address.haddr,
|
||||
packet -> raw -> chaddr, packet -> raw -> hlen))) {
|
||||
#if defined (DEBUG)
|
||||
debug ("%s in wrong transaction.", name);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -941,7 +947,9 @@ void dhcpnak (packet)
|
|||
packet -> raw -> hlen) ||
|
||||
(memcmp (packet -> interface -> hw_address.haddr,
|
||||
packet -> raw -> chaddr, packet -> raw -> hlen))) {
|
||||
#if defined (DEBUG)
|
||||
debug ("DHCPNAK in wrong transaction.");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -949,7 +957,9 @@ void dhcpnak (packet)
|
|||
ip -> client -> state != S_REQUESTING &&
|
||||
ip -> client -> state != S_RENEWING &&
|
||||
ip -> client -> state != S_REBINDING) {
|
||||
#if defined (DEBUG)
|
||||
debug ("DHCPNAK in wrong state.");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1057,10 +1067,11 @@ void send_discover (ipp)
|
|||
ip -> client -> config -> timeout) - cur_time + 1;
|
||||
|
||||
/* Record the number of seconds since we started sending. */
|
||||
if (interval < 255)
|
||||
ip -> client -> packet.secs = interval;
|
||||
if (interval < 65536)
|
||||
ip -> client -> packet.secs = htons (interval);
|
||||
else
|
||||
ip -> client -> packet.secs = 255;
|
||||
ip -> client -> packet.secs = htons (65535);
|
||||
ip -> client -> secs = ip -> client -> packet.secs;
|
||||
|
||||
note ("DHCPDISCOVER on %s to %s port %d interval %ld",
|
||||
ip -> name,
|
||||
|
@ -1300,10 +1311,14 @@ void send_request (ipp)
|
|||
from.s_addr = INADDR_ANY;
|
||||
|
||||
/* Record the number of seconds since we started sending. */
|
||||
if (interval < 255)
|
||||
ip -> client -> packet.secs = interval;
|
||||
else
|
||||
ip -> client -> packet.secs = 255;
|
||||
if (ip -> client -> state == S_REQUESTING)
|
||||
ip -> client -> packet.secs = ip -> client -> secs;
|
||||
else {
|
||||
if (interval < 65536)
|
||||
ip -> client -> packet.secs = htons (interval);
|
||||
else
|
||||
ip -> client -> packet.secs = htons (65535);
|
||||
}
|
||||
|
||||
note ("DHCPREQUEST on %s to %s port %d", ip -> name,
|
||||
inet_ntoa (destination.sin_addr),
|
||||
|
@ -1433,8 +1448,8 @@ void make_discover (ip, lease)
|
|||
|
||||
/* Set up the option buffer... */
|
||||
ip -> client -> packet_length =
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet,
|
||||
options, 0, 0, 0);
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet, 0,
|
||||
options, 0, 0, 0, (u_int8_t *)0, 0);
|
||||
if (ip -> client -> packet_length < BOOTP_MIN_LEN)
|
||||
ip -> client -> packet_length = BOOTP_MIN_LEN;
|
||||
|
||||
|
@ -1540,8 +1555,8 @@ void make_request (ip, lease)
|
|||
|
||||
/* Set up the option buffer... */
|
||||
ip -> client -> packet_length =
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet,
|
||||
options, 0, 0, 0);
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet, 0,
|
||||
options, 0, 0, 0, (u_int8_t *)0, 0);
|
||||
if (ip -> client -> packet_length < BOOTP_MIN_LEN)
|
||||
ip -> client -> packet_length = BOOTP_MIN_LEN;
|
||||
|
||||
|
@ -1641,8 +1656,8 @@ void make_decline (ip, lease)
|
|||
|
||||
/* Set up the option buffer... */
|
||||
ip -> client -> packet_length =
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet,
|
||||
options, 0, 0, 0);
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet, 0,
|
||||
options, 0, 0, 0, (u_int8_t *)0, 0);
|
||||
if (ip -> client -> packet_length < BOOTP_MIN_LEN)
|
||||
ip -> client -> packet_length = BOOTP_MIN_LEN;
|
||||
|
||||
|
@ -1707,8 +1722,8 @@ void make_release (ip, lease)
|
|||
|
||||
/* Set up the option buffer... */
|
||||
ip -> client -> packet_length =
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet,
|
||||
options, 0, 0, 0);
|
||||
cons_options ((struct packet *)0, &ip -> client -> packet, 0,
|
||||
options, 0, 0, 0, (u_int8_t *)0, 0);
|
||||
if (ip -> client -> packet_length < BOOTP_MIN_LEN)
|
||||
ip -> client -> packet_length = BOOTP_MIN_LEN;
|
||||
|
||||
|
@ -2022,14 +2037,13 @@ void script_write_params (ip, prefix, lease)
|
|||
}
|
||||
dp = dbuf;
|
||||
memcpy (dp,
|
||||
lease -> options [i].data,
|
||||
lease -> options [i].len);
|
||||
memcpy (dp + lease -> options [i].len,
|
||||
ip -> client ->
|
||||
config -> defaults [i].data,
|
||||
ip -> client ->
|
||||
config -> defaults [i].len);
|
||||
memcpy (dp + ip -> client ->
|
||||
config -> defaults [i].len,
|
||||
lease -> options [i].data,
|
||||
lease -> options [i].len);
|
||||
}
|
||||
} else {
|
||||
dp = ip -> client ->
|
||||
|
|
|
@ -160,6 +160,10 @@ struct lease_state {
|
|||
|
||||
struct iaddr from;
|
||||
|
||||
int max_message_size;
|
||||
u_int8_t *prl;
|
||||
int prl_len;
|
||||
|
||||
u_int32_t xid;
|
||||
u_int16_t secs;
|
||||
u_int16_t bootp_flags;
|
||||
|
@ -332,6 +336,7 @@ struct client_state {
|
|||
enum dhcp_state state; /* Current state for this interface. */
|
||||
struct iaddr destination; /* Where to send packet. */
|
||||
u_int32_t xid; /* Transaction ID. */
|
||||
u_int16_t secs; /* secs value from DHCPDISCOVER. */
|
||||
TIME first_sending; /* When was first copy sent? */
|
||||
TIME interval; /* What's the current resend interval? */
|
||||
struct string_list *medium; /* Last media type tried. */
|
||||
|
@ -457,8 +462,9 @@ typedef unsigned char option_mask [16];
|
|||
|
||||
void parse_options PROTO ((struct packet *));
|
||||
void parse_option_buffer PROTO ((struct packet *, unsigned char *, int));
|
||||
int cons_options PROTO ((struct packet *, struct dhcp_packet *,
|
||||
struct tree_cache **, int, int, int));
|
||||
int cons_options PROTO ((struct packet *, struct dhcp_packet *, int,
|
||||
struct tree_cache **, int, int, int,
|
||||
u_int8_t *, int));
|
||||
int store_options PROTO ((unsigned char *, int, struct tree_cache **,
|
||||
unsigned char *, int, int, int, int));
|
||||
char *pretty_print_option PROTO ((unsigned int,
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: bootp.c,v 1.5 1999/02/24 04:14:34 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: bootp.c,v 1.6 1999/03/26 17:52:45 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
@ -254,7 +254,8 @@ void bootp (packet)
|
|||
name buffers. */
|
||||
|
||||
outgoing.packet_length =
|
||||
cons_options (packet, outgoing.raw, options, 0, 0, 1);
|
||||
cons_options (packet, outgoing.raw,
|
||||
0, options, 0, 0, 1, (u_int8_t *)0, 0);
|
||||
if (outgoing.packet_length < BOOTP_MIN_LEN)
|
||||
outgoing.packet_length = BOOTP_MIN_LEN;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
#ifndef lint
|
||||
static char copyright[] =
|
||||
"$Id: dhcp.c,v 1.6 1999/03/05 17:52:46 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
||||
"$Id: dhcp.c,v 1.7 1999/03/26 17:52:46 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "dhcpd.h"
|
||||
|
@ -463,7 +463,8 @@ void nak_lease (packet, cip)
|
|||
|
||||
/* Set up the option buffer... */
|
||||
outgoing.packet_length =
|
||||
cons_options (packet, outgoing.raw, options, 0, 0, 0);
|
||||
cons_options (packet, outgoing.raw, 0, options, 0, 0, 0,
|
||||
(u_int8_t *)0, 0);
|
||||
|
||||
/* memset (&raw.ciaddr, 0, sizeof raw.ciaddr);*/
|
||||
raw.siaddr = packet -> interface -> primary_address;
|
||||
|
@ -803,6 +804,30 @@ void ack_lease (packet, lease, offer, when)
|
|||
state -> hops = packet -> raw -> hops;
|
||||
state -> offer = offer;
|
||||
|
||||
/* Get the Maximum Message Size option from the packet, if one
|
||||
was sent. */
|
||||
if (packet -> options [DHO_DHCP_MAX_MESSAGE_SIZE].data &&
|
||||
(packet -> options [DHO_DHCP_MAX_MESSAGE_SIZE].len >=
|
||||
sizeof (u_int16_t)))
|
||||
state -> max_message_size =
|
||||
getUShort (packet -> options
|
||||
[DHO_DHCP_MAX_MESSAGE_SIZE].data);
|
||||
|
||||
/* Save the parameter request list if there is one. */
|
||||
i = DHO_DHCP_PARAMETER_REQUEST_LIST;
|
||||
if (packet -> options [i].data) {
|
||||
state -> prl = dmalloc (packet -> options [i].len,
|
||||
"ack_lease: prl");
|
||||
if (!state -> prl)
|
||||
warn ("no memory for parameter request list");
|
||||
else {
|
||||
memcpy (state -> prl,
|
||||
packet -> options [i].data,
|
||||
packet -> options [i].len);
|
||||
state -> prl_len = packet -> options [i].len;
|
||||
}
|
||||
}
|
||||
|
||||
/* Figure out what options to send to the client: */
|
||||
|
||||
/* Start out with the subnet options... */
|
||||
|
@ -1110,7 +1135,9 @@ void dhcp_reply (lease)
|
|||
|
||||
/* Insert such options as will fit into the buffer. */
|
||||
packet_length = cons_options ((struct packet *)0, &raw,
|
||||
state -> options, bufs, nulltp, bootpp);
|
||||
state -> max_message_size,
|
||||
state -> options, bufs, nulltp, bootpp,
|
||||
state -> prl, state -> prl_len);
|
||||
|
||||
/* Having done the cons_options(), we can release the tree_cache
|
||||
entries. */
|
||||
|
@ -1186,35 +1213,45 @@ void dhcp_reply (lease)
|
|||
result = send_packet (fallback_interface,
|
||||
(struct packet *)0,
|
||||
&raw, packet_length,
|
||||
raw.siaddr, &to, &hto);
|
||||
raw.siaddr,
|
||||
&to, (struct hardware *)0);
|
||||
|
||||
free_lease_state (state, "dhcp_reply fallback 1");
|
||||
lease -> state = (struct lease_state *)0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* If it comes from a client that already knows its address and
|
||||
is not requesting a broadcast response, sent it directly to
|
||||
that client. */
|
||||
} else if (raw.ciaddr.s_addr && state -> offer == DHCPACK &&
|
||||
!(raw.flags & htons (BOOTP_BROADCAST)) &&
|
||||
can_unicast_without_arp ()) {
|
||||
to.sin_addr = state -> ciaddr;
|
||||
to.sin_port = remote_port; /* XXX */
|
||||
/* If the client is RENEWING, unicast to the client using the
|
||||
regular IP stack. */
|
||||
} else if (raw.ciaddr.s_addr && state -> offer == DHCPACK) {
|
||||
to.sin_addr = raw.ciaddr;
|
||||
to.sin_port = remote_port;
|
||||
|
||||
if (fallback_interface) {
|
||||
result = send_packet (fallback_interface,
|
||||
(struct packet *)0,
|
||||
&raw, packet_length,
|
||||
raw.siaddr, &to, &hto);
|
||||
free_lease_state (state, "dhcp_reply fallback 1");
|
||||
raw.siaddr, &to,
|
||||
(struct hardware *)0);
|
||||
free_lease_state (state,
|
||||
"dhcp_reply fallback 2");
|
||||
lease -> state = (struct lease_state *)0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* If it comes from a client that already knows its address
|
||||
and is not requesting a broadcast response, and we can
|
||||
unicast to a client without using the ARP protocol, sent it
|
||||
directly to that client. */
|
||||
} else if (!(raw.flags & htons (BOOTP_BROADCAST)) &&
|
||||
can_unicast_without_arp ()) {
|
||||
to.sin_addr = raw.yiaddr;
|
||||
to.sin_port = remote_port;
|
||||
|
||||
/* Otherwise, broadcast it on the local network. */
|
||||
} else {
|
||||
/* Otherwise, broadcast it on the local network. */
|
||||
to.sin_addr.s_addr = htonl (INADDR_BROADCAST);
|
||||
to.sin_port = remote_port; /* XXX */
|
||||
to.sin_port = remote_port;
|
||||
}
|
||||
|
||||
memcpy (&from, state -> from.iabuf, sizeof from);
|
||||
|
|
|
@ -42,13 +42,13 @@
|
|||
|
||||
#ifndef lint
|
||||
static char ocopyright[] =
|
||||
"$Id: dhcpd.c,v 1.6 1999/03/05 17:52:46 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.";
|
||||
"$Id: dhcpd.c,v 1.7 1999/03/26 17:52:46 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.";
|
||||
#endif
|
||||
|
||||
static char copyright[] =
|
||||
"Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.";
|
||||
static char arr [] = "All rights reserved.";
|
||||
static char message [] = "Internet Software Consortium DHCP Server V2.0b1pl18 ";
|
||||
static char message [] = "Internet Software Consortium DHCP Server V2.0b1pl19 ";
|
||||
static char contrib [] = "\nPlease contribute if you find this software useful.";
|
||||
static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.html\n";
|
||||
|
||||
|
|
|
@ -515,7 +515,7 @@ hardware type (and others) would also be desirable.
|
|||
The
|
||||
.I hardware-address
|
||||
should be a set of hexadecimal octets (numbers from 0 through ff)
|
||||
seperated by colons. The \fIhardwarefR statement may also be used
|
||||
seperated by colons. The \fIhardware\fR statement may also be used
|
||||
for DHCP clients.
|
||||
.PP
|
||||
.B The
|
||||
|
|
Loading…
Reference in New Issue