as failover, server tracing, debugging, and the execute() command.
[ISC-Bugs #17678]
via two ./configure parameters, --enable-paranoia and
--enable-early-chroot.
+- ./configure was extended to cover many optional build features, such
+ as failover, server tracing, debugging, and the execute() command.
+
Changes since 4.0.0 (new features)
- Added DHCPv6 rapid commit support.
struct executable_statement *statements;
int indent;
{
- struct executable_statement *r, *x;
+#if defined ENABLE_EXECUTE
struct expression *expr;
+#endif
+ struct executable_statement *r, *x;
const char *s, *t, *dot;
int col;
int *lose;
enum expression_context case_context;
{
+#if defined(ENABLE_EXECUTE)
+ unsigned len;
+ struct expression **ep;
+#endif
enum dhcp_token token;
const char *val;
- unsigned len;
struct class *cta;
struct option *option=NULL;
struct option_cache *cache;
- struct expression **ep;
int known;
int flag;
int i;
[Define to BIG_ENDIAN for MSB (Motorola or SPARC CPUs)
or LITTLE_ENDIAN for LSB (Intel CPUs).])
-# DHCPv6 is off by default
+# Optional compile-time DEBUGging.
+AC_ARG_ENABLE(debug,
+ AC_HELP_STRING([--enable-debug],
+ [create a debug-only version of the software (default is no).]))
+# This is very much off by default.
+if test "$enable_debug" = "yes" ; then
+ AC_DEFINE([DEBUG], [1],
+ [Define to compile debug-only DHCP software.])
+ # Just override CFLAGS to totally to remove optimization.
+ CFLAGS="-g"
+fi
+# XXX: there are actually quite a lot more DEBUG_ features we could enable,
+# but I don't want to pollute the --help space.
+#
+#/* #define DEBUG_TOKENS */
+#/* #define DEBUG_PACKET */
+#/* #define DEBUG_EXPRESSIONS */
+#/* #define DEBUG_FIND_LEASE */
+#/* #define DEBUG_EXPRESSION_PARSE */
+#/* #define DEBUG_CLASS_MATCHING */
+#/* #define DEBUG_MEMORY_LEAKAGE */
+#/* #define DEBUG_MALLOC_POOL */
+#/* #define DEBUG_LEASE_STATE_TRANSITIONS */
+#/* #define DEBUG_RC_HISTORY */
+#/* #define DEBUG_RC_HISTORY_EXHAUSTIVELY */
+#/* #define RC_HISTORY_MAX 10240 */
+#/* #define POINTER_DEBUG */
+#/* #define DEBUG_FAILOVER_MESSAGES */
+#/* #define DEBUG_FAILOVER_TIMING */
+#/* #define DEBUG_DUMP_ALL_LEASES */
+
+# Failover optional compile-time feature.
+AC_ARG_ENABLE(failover,
+ AC_HELP_STRING([--enable-failover],
+ [enable support for failover (default is yes)]))
+# Failover is on by default, so define if it is not explicitly disabled.
+if test "$enable_failover" != "no"; then
+ AC_DEFINE([FAILOVER_PROTOCOL], [1],
+ [Define to include Failover Protocol support.])
+fi
+
+# execute() support.
+AC_ARG_ENABLE(execute,
+ AC_HELP_STRING([--enable-execute],
+ [enable support for execute() in config (default is yes)]))
+# execute() is on by default, so define if it is not explicitly disabled.
+if test "$enable_execute" != "no" ; then
+ AC_DEFINE([ENABLE_EXECUTE], [1],
+ [Define to include execute() config language support.])
+fi
+
+# Server tracing support.
+AC_ARG_ENABLE(tracing,
+ AC_HELP_STRING([--enable-tracing],
+ [enable support for server activity tracing (default is yes)]))
+# tracing is on by default, so define if it is not explicitly disabled.
+if test "$enable_tracing" != "no" ; then
+ AC_DEFINE([TRACING], [1],
+ [Define to include server activity tracing support.])
+fi
+
+# DHCPv6 optional compile-time feature.
AC_ARG_ENABLE(dhcpv6,
AC_HELP_STRING([--enable-dhcpv6],
[enable support for DHCPv6 (default is yes)]))
+# DHCPv6 is on by default, so define if it is not explicitly disabled.
if test "$enable_dhcpv6" != "no"; then
AC_DEFINE([DHCPv6], [1],
[Define to 1 to include DHCPv6 support.])
/* Define this if you want DHCP failover protocol support in the DHCP
server. */
-#define FAILOVER_PROTOCOL
+/* #define FAILOVER_PROTOCOL */
/* Define this if you want DNS update functionality to be available. */
/* Define this if you want to be able to execute external commands
during conditional evaluation. */
-#define ENABLE_EXECUTE
+/* #define ENABLE_EXECUTE */
/* Define this if you aren't debugging and you want to save memory
(potentially a _lot_ of memory) by allocating leases in chunks rather
/* Define this if you want to be able to save and playback server operational
traces. */
-#define TRACING
+/* #define TRACING */
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
-static const char rcsid[] = "$Id: res_init.c,v 1.10 2007/10/01 14:47:35 explorer Exp $";
+static const char rcsid[] = "$Id: res_init.c,v 1.11 2008/02/28 21:21:56 dhankins Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
/* Options. Should all be left alone. */
#define RESOLVSORT
#define RFC1535
-#define DEBUG
static void res_setoptions (res_state, const char *, const char *);
dots--;
}
*pp = NULL;
-#ifdef DEBUG
if (statp->options & RES_DEBUG) {
printf(";; res_init()... default dnsrch list:\n");
for (pp = statp->dnsrch; *pp; pp++)
printf(";;\t%s\n", *pp);
printf(";;\t..END..\n");
}
-#endif
#endif /* !RFC1535 */
}
const char *cp = options;
int i;
-#ifdef DEBUG
if (statp->options & RES_DEBUG)
printf(";; res_setoptions(\"%s\", \"%s\")...\n",
options, source);
-#endif
while (*cp) {
/* skip leading and inner runs of spaces */
while (*cp == ' ' || *cp == '\t')
statp->ndots = i;
else
statp->ndots = RES_MAXNDOTS;
-#ifdef DEBUG
if (statp->options & RES_DEBUG)
printf(";;\tndots=%d\n", statp->ndots);
-#endif
} else if (!strncmp(cp, "timeout:", sizeof("timeout:") - 1)) {
i = atoi(cp + sizeof("timeout:") - 1);
if (i <= RES_MAXRETRANS)
else
statp->retry = RES_MAXRETRY;
} else if (!strncmp(cp, "debug", sizeof("debug") - 1)) {
-#ifdef DEBUG
if (!(statp->options & RES_DEBUG)) {
printf(";; res_setoptions(\"%s\", \"%s\")..\n",
options, source);
statp->options |= RES_DEBUG;
}
printf(";;\tdebug\n");
-#endif
} else if (!strncmp(cp, "inet6", sizeof("inet6") - 1)) {
statp->options |= RES_USE_INET6;
} else if (!strncmp(cp, "rotate", sizeof("rotate") - 1)) {
*/
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: res_mkupdate.c,v 1.11 2007/07/13 06:43:42 shane Exp $";
+static const char rcsid[] = "$Id: res_mkupdate.c,v 1.12 2008/02/28 21:21:56 dhankins Exp $";
#endif /* not lint */
#include <sys/types.h>
#include "arpa/nameser.h"
/* Options. Leave them on. */
-#define DEBUG
#define MAXPORT 1024
static int getnum_str(const u_char **, const u_char *);
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_query.c,v 1.8 2007/09/05 17:32:10 dhankins Exp $";
+static const char rcsid[] = "$Id: res_query.c,v 1.9 2008/02/28 21:21:56 dhankins Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include "arpa/nameser.h"
/* Options. Leave them on. */
-#define DEBUG
-
#if PACKETSZ > 1024
#define MAXPACKET PACKETSZ
#else
hp->rcode = NOERROR; /* default */
-#ifdef DEBUG
if (statp->options & RES_DEBUG)
printf(";; res_query(%s, %d, %d)\n", name, class, type);
-#endif
rcode = res_nmkquery(statp, QUERY, name, class, type, NULL, 0, NULL,
buf, sizeof(buf), &n);
if (rcode != ISC_R_SUCCESS) {
-#ifdef DEBUG
if (statp->options & RES_DEBUG)
printf(";; res_query: mkquery failed\n");
-#endif
RES_SET_H_ERRNO(statp, NO_RECOVERY);
return rcode;
}
rcode = res_nsend(statp, buf, n, answer, anslen, &n);
if (rcode != ISC_R_SUCCESS) {
-#ifdef DEBUG
if (statp->options & RES_DEBUG)
printf(";; res_query: send error\n");
-#endif
RES_SET_H_ERRNO(statp, TRY_AGAIN);
return rcode;
}
if (hp->rcode != NOERROR || ntohs(hp->ancount) == 0) {
-#ifdef DEBUG
if (statp->options & RES_DEBUG)
printf(";; rcode = %d, ancount=%d\n", hp->rcode,
ntohs(hp->ancount));
-#endif
switch (hp->rcode) {
case NXDOMAIN:
RES_SET_H_ERRNO(statp, HOST_NOT_FOUND);
const char *longname = nbuf;
int n, d;
-#ifdef DEBUG
if (statp->options & RES_DEBUG)
printf(";; res_nquerydomain(%s, %s, %d, %d)\n",
name, domain?domain:"<Nil>", class, type);
-#endif
if (domain == NULL) {
/*
* Check for trailing '.';
unsigned first_byte;
omapi_buffer_t *buffer;
omapi_connection_object_t *c;
- isc_result_t status;
if (!h || h -> type != omapi_type_connection)
return ISC_R_INVALIDARG;
#if defined (TRACING)
if (trace_record ()) {
+ isc_result_t status;
trace_iov_t iov [2];
int32_t connect_index;
int force)
{
omapi_connection_object_t *c;
- isc_result_t status;
#ifdef DEBUG_PROTOCOL
log_debug ("omapi_disconnect(%s)", force ? "force" : "");
#if defined (TRACING)
if (trace_record ()) {
+ isc_result_t status;
int32_t index;
index = htonl (c -> index);
#include <errno.h>
+#if defined(TRACING)
static void trace_mr_output_input (trace_type_t *, unsigned, char *);
static void trace_mr_output_stop (trace_type_t *);
static void trace_mr_input_input (trace_type_t *, unsigned, char *);
static void trace_mr_statp_stop (trace_type_t *);
static void trace_mr_randomid_input (trace_type_t *, unsigned, char *);
static void trace_mr_randomid_stop (trace_type_t *);
+#endif /* TRACING */
trace_type_t *trace_mr_output;
trace_type_t *trace_mr_input;
trace_type_t *trace_mr_statp;
unsigned int trace_mr_res_randomid (unsigned int oldid)
{
- u_int32_t id;
int rid = oldid;
#if defined (TRACING)
+ u_int32_t id;
unsigned buflen = 0;
char *buf = (char *)0;
isc_result_t status;
release_lease (lease, packet);
}
log_info ("%s", msgbuf);
+#if defined(FAILOVER_PROTOCOL)
out:
+#endif
if (lease)
lease_dereference (&lease, MDL);
}
if (!ignorep)
log_info ("%s: %s", msgbuf, status);
-
+
+#if defined(FAILOVER_PROTOCOL)
out:
+#endif
if (options)
option_state_dereference (&options, MDL);
if (lease)
struct data_string client_identifier;
struct hardware h;
+#if defined(FAILOVER_PROTOCOL)
/* Quick check to see if the peer has leases. */
if (peer_has_leases) {
struct pool *pool;
}
}
}
+#endif /* FAILOVER_PROTOCOL */
if (packet -> raw -> ciaddr.s_addr) {
cip.len = 4;
is not active, and is not ours to reallocate, forget about it. */
if (ip_lease && (uid_lease || hw_lease) &&
ip_lease -> binding_state != FTS_ACTIVE &&
+#if defined(FAILOVER_PROTOCOL)
!lease_mine_to_reallocate (ip_lease) &&
+#endif
packet -> packet_type == DHCPDISCOVER) {
#if defined (DEBUG_FIND_LEASE)
log_info ("ip lease not ours to offer.");
static isc_result_t dhcp_io_shutdown_countdown (void *vlp)
{
- dhcp_failover_state_t *state;
#if defined (FAILOVER_PROTOCOL)
+ dhcp_failover_state_t *state;
int failover_connection_count = 0;
#endif
struct timeval tv;
case FTS_ABANDONED:
case FTS_RESET:
lease -> next_binding_state = FTS_FREE;
+#if defined(FAILOVER_PROTOCOL)
/* If we are not in partner_down, leases don't go from
EXPIRED to FREE on a timeout - only on an update.
If we're in partner_down, they expire at mclt past
lease -> tsfp =
(lease -> pool -> failover_peer -> me.stos +
lease -> pool -> failover_peer -> mclt);
+#endif /* FAILOVER_PROTOCOL */
break;
case FTS_FREE: