- Remove the -x switch enabling extended new option info. If given to

dhclient now, it's ignored.
This commit is contained in:
David Cantrell 2007-08-16 18:33:06 +00:00
parent a98e2cf2f1
commit c637bc589d
7 changed files with 600 additions and 777 deletions

View File

@ -1,210 +0,0 @@
--- dhcp-3.0.5/client/dhclient.c.enoi 2007-03-30 16:27:32.000000000 -0400
+++ dhcp-3.0.5/client/dhclient.c 2007-03-30 16:27:51.000000000 -0400
@@ -74,6 +74,9 @@
int onetry=0;
int quiet=0;
int nowait=0;
+#ifdef EXTENDED_NEW_OPTION_INFO
+int extended_option_environment = 0;
+#endif
static void usage PROTO ((void));
@@ -203,6 +206,11 @@
} else if (!strcmp (argv [i], "--version")) {
log_info ("isc-dhclient-%s", DHCP_VERSION);
exit (0);
+#ifdef EXTENDED_NEW_OPTION_INFO
+ } else if (!strcmp (argv [i], "-x")) {
+ extended_option_environment = 1;
+ new_option_info_tree = GENERATE_NEW_OPTION_INFO;
+#endif
} else if (argv [i][0] == '-') {
usage ();
} else {
@@ -475,7 +483,11 @@
log_info (arr);
log_info (url);
+#ifdef EXTENDED_NEW_OPTION_INFO
+ log_error ("Usage: dhclient [-1dqr] [-nwx] [-p <port>] %s",
+#else
log_error ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s",
+#endif
"[-s server]");
log_error (" [-cf config-file] [-lf lease-file]%s",
"[-pf pid-file] [-e VAR=val]");
@@ -2426,8 +2438,30 @@
struct envadd_state {
struct client_state *client;
const char *prefix;
+#ifdef EXTENDED_NEW_OPTION_INFO
+ struct universe *universe;
+#endif
};
+#ifdef EXTENDED_NEW_OPTION_INFO
+static
+void build_universe_info_envvar
+( struct option_cache *oc,
+ struct packet *p, struct lease *l,
+ struct client_state *client,
+ struct option_state *in_o,
+ struct option_state *cf_o,
+ struct binding_scope **scope,
+ struct universe *u, void *es
+)
+{
+ char info_name[512], info_data[512];
+ snprintf(info_name, 512, "%s._universe_.", oc->option->universe->name);
+ snprintf(info_data, 512, "%u:%s", oc->option->code,oc->option->format);
+ client_envadd( client, info_name, oc->option->name, info_data );
+}
+#endif
+
void client_option_envadd (struct option_cache *oc,
struct packet *packet, struct lease *lease,
struct client_state *client_state,
@@ -2444,6 +2478,28 @@
in_options, cfg_options, scope, oc, MDL)) {
if (data.len) {
char name [256];
+#ifdef EXTENDED_NEW_OPTION_INFO
+ if (extended_option_environment) {
+ if ((oc->option->universe != &dhcp_universe)
+ && (oc->option->universe->index > fqdn_universe.index)
+ && (es->universe != oc->option->universe)) {
+ es->universe = oc->option->universe;
+ (*(es->universe->foreach)) ((struct packet *)0,
+ (struct lease *)0,
+ client_state,
+ in_options, cfg_options,
+ scope, es->universe, es,
+ build_universe_info_envvar);
+ } else {
+ if (lookup_new_option_info(oc->option) != NULL) {
+ build_universe_info_envvar(oc, packet, lease,
+ client_state, in_options,
+ cfg_options, scope,
+ oc->option->universe, es);
+ }
+ }
+ }
+#endif
if (dhcp_option_ev_name (name, sizeof name,
oc -> option)) {
client_envadd (es -> client, es -> prefix,
@@ -2470,6 +2526,7 @@
es.client = client;
es.prefix = prefix;
+ es.universe = NULL;
client_envadd (client,
prefix, "ip_address", "%s", piaddr (lease -> address));
@@ -2679,7 +2736,14 @@
s = option -> name;
if (j + 1 == buflen)
return 0;
+#ifdef EXTENDED_NEW_OPTION_INFO
+ if (!extended_option_environment)
+ buf[j++] = '_';
+ else
+ buf[j++] = '.';
+#else
buf [j++] = '_';
+#endif
}
++i;
} while (i != 2);
--- dhcp-3.0.5/client/dhclient.8.enoi 2005-09-14 12:03:33.000000000 -0400
+++ dhcp-3.0.5/client/dhclient.8 2007-03-30 16:27:32.000000000 -0400
@@ -82,6 +82,9 @@
.B -w
]
[
+.B -x
+]
+[
.I if0
[
.I ...ifN
@@ -265,6 +268,11 @@
supplying the
.B -nw
flag.
+.PP
+The -x argument enables extended option information to be created in the
+-s dhclient-script environment, which would allow applications running
+in that environment to handle options they do not know about in advance -
+this is a Red Hat extension to support dhcdbd and NetworkManager.
.SH CONFIGURATION
The syntax of the dhclient.conf(5) file is discussed separately.
.SH OMAPI
--- dhcp-3.0.5/common/parse.c.enoi 2007-03-30 16:27:32.000000000 -0400
+++ dhcp-3.0.5/common/parse.c 2007-03-30 16:27:32.000000000 -0400
@@ -1266,6 +1266,10 @@
option_hash_add (option -> universe -> hash,
(const char *)option -> name,
0, option, MDL);
+#ifdef EXTENDED_NEW_OPTION_INFO
+ if (new_option_info_tree != NULL)
+ add_new_option_info(option);
+#endif
return 1;
}
--- dhcp-3.0.5/common/tables.c.enoi 2006-02-22 17:43:27.000000000 -0500
+++ dhcp-3.0.5/common/tables.c 2007-03-30 16:27:32.000000000 -0400
@@ -1250,3 +1250,35 @@
fqdn_universe.name, 0,
&fqdn_universe, MDL);
}
+
+#ifdef EXTENDED_NEW_OPTION_INFO
+#include <search.h>
+
+void *new_option_info_tree = NULL;
+
+static int new_option_info_comparator(const void * p1, const void * p2) {
+ uint32_t ocode1 = (((const struct option*)p1)->universe->index << 8)
+ | (((const struct option*)p1)->code),
+ ocode2 = (((const struct option*)p2)->universe->index << 8)
+ | (((const struct option*)p2)->code);
+
+ return((ocode1 == ocode2) ? 0 : ((ocode1 > ocode2) ? 1 : -1));
+}
+
+void *add_new_option_info(struct option * option) {
+ if (option->universe->index >= fqdn_universe.index)
+ return NULL;
+
+ if (new_option_info_tree == GENERATE_NEW_OPTION_INFO)
+ new_option_info_tree = NULL;
+
+ return tsearch(option, &(new_option_info_tree), new_option_info_comparator);
+}
+
+void *lookup_new_option_info(struct option * option) {
+ if (new_option_info_tree == GENERATE_NEW_OPTION_INFO)
+ return NULL;
+
+ return tfind(option, &(new_option_info_tree), new_option_info_comparator);
+}
+#endif
--- dhcp-3.0.5/includes/dhcpd.h.enoi 2006-05-17 16:16:59.000000000 -0400
+++ dhcp-3.0.5/includes/dhcpd.h 2007-03-30 16:27:32.000000000 -0400
@@ -1811,6 +1811,13 @@
void initialize_common_option_spaces PROTO ((void));
struct universe *config_universe;
+#ifdef EXTENDED_NEW_OPTION_INFO
+#define GENERATE_NEW_OPTION_INFO ((void*)1)
+extern void *new_option_info_tree;
+extern void *add_new_option_info(struct option *);
+extern void *lookup_new_option_info(struct option *);
+#endif
+
/* stables.c */
#if defined (FAILOVER_PROTOCOL)
extern failover_option_t null_failover_option;

View File

@ -1,6 +1,7 @@
--- dhcp-3.0.5/client/dhclient.c.usage 2007-04-17 10:43:00.000000000 -0400 diff -up dhcp-3.0.6/client/dhclient.c.usage dhcp-3.0.6/client/dhclient.c
+++ dhcp-3.0.5/client/dhclient.c 2007-04-17 10:43:30.000000000 -0400 --- dhcp-3.0.6/client/dhclient.c.usage 2007-08-15 11:48:12.000000000 -0400
@@ -819,20 +819,29 @@ +++ dhcp-3.0.6/client/dhclient.c 2007-08-15 11:50:22.000000000 -0400
@@ -808,16 +808,25 @@ int main (argc, argv, envp)
static void usage () static void usage ()
{ {
@ -8,6 +9,12 @@
- log_info (copyright); - log_info (copyright);
- log_info (arr); - log_info (arr);
- log_info (url); - log_info (url);
-
- log_error ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s",
- "[-s server]");
- log_error (" [-cf config-file] [-lf lease-file]%s",
- "[-pf pid-file] [-e VAR=val]");
- log_fatal (" [-sf script-file] [interface]");
+ printf ("%s %s\n", message, DHCP_VERSION); + printf ("%s %s\n", message, DHCP_VERSION);
+ printf (copyright); + printf (copyright);
+ printf ("\n"); + printf ("\n");
@ -15,18 +22,8 @@
+ printf ("\n"); + printf ("\n");
+ printf (url); + printf (url);
+ printf ("\n"); + printf ("\n");
+
#ifdef EXTENDED_NEW_OPTION_INFO
- log_error ("Usage: dhclient [-1dqr] [-nwx] [-p <port>] %s",
+ printf ("Usage: dhclient [-1dqr] [-nwx] [-p <port>] %s",
#else
- log_error ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s",
+ printf ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s", + printf ("Usage: dhclient [-1dqr] [-nw] [-p <port>] %s",
#endif
- "[-s server]");
- log_error (" [-cf config-file] [-lf lease-file]%s",
- "[-pf pid-file] [-e VAR=val]");
- log_fatal (" [-sf script-file] [interface]");
+ "[-s server]"); + "[-s server]");
+ printf (" [-cf config-file] [-lf lease-file]%s", + printf (" [-cf config-file] [-lf lease-file]%s",
+ "[-pf pid-file] [-e VAR=val]"); + "[-pf pid-file] [-e VAR=val]");

View File

@ -0,0 +1,13 @@
diff -up dhcp-3.0.6/client/dhclient.c.enoi dhcp-3.0.6/client/dhclient.c
--- dhcp-3.0.6/client/dhclient.c.enoi 2007-08-15 16:14:32.000000000 -0400
+++ dhcp-3.0.6/client/dhclient.c 2007-08-15 16:17:17.000000000 -0400
@@ -259,6 +259,9 @@ int main (argc, argv, envp)
} else if (!strcmp (argv [i], "--version")) {
log_info ("isc-dhclient-%s", DHCP_VERSION);
exit (0);
+ } else if (!strcmp (argv [i], "-x")) {
+ /* ignored for compatibility */
+ continue;
} else if (!strcmp (argv [i], "-I")) {
if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
usage ();

View File

@ -1,7 +1,8 @@
--- dhcp-3.0.5/client/dhclient.c.libdhcp4client 2007-03-30 20:54:06.000000000 -0400 diff -up dhcp-3.0.6/client/dhclient.c.libdhcp4client dhcp-3.0.6/client/dhclient.c
+++ dhcp-3.0.5/client/dhclient.c 2007-03-30 20:54:34.000000000 -0400 --- dhcp-3.0.6/client/dhclient.c.libdhcp4client 2007-08-15 16:24:55.000000000 -0400
@@ -85,16 +85,52 @@ +++ dhcp-3.0.6/client/dhclient.c 2007-08-15 16:26:24.000000000 -0400
#endif @@ -82,16 +82,52 @@ int quiet=0;
int nowait=0;
int bootp_broadcast_always = 0; int bootp_broadcast_always = 0;
+#ifdef LIBDHCP +#ifdef LIBDHCP
@ -53,7 +54,7 @@
int i; int i;
struct servent *ent; struct servent *ent;
struct interface_info *ip; struct interface_info *ip;
@@ -122,6 +158,7 @@ @@ -119,6 +155,7 @@ int main (argc, argv, envp)
char *arg_conf = NULL; char *arg_conf = NULL;
int arg_conf_len = 0; int arg_conf_len = 0;
@ -61,7 +62,7 @@
/* Make sure we have stdin, stdout and stderr. */ /* Make sure we have stdin, stdout and stderr. */
i = open ("/dev/null", O_RDWR); i = open ("/dev/null", O_RDWR);
if (i == 0) if (i == 0)
@@ -142,6 +179,7 @@ @@ -139,6 +176,7 @@ int main (argc, argv, envp)
#if !(defined (DEBUG) || defined (SYSLOG_4_2) || defined (__CYGWIN32__)) #if !(defined (DEBUG) || defined (SYSLOG_4_2) || defined (__CYGWIN32__))
setlogmask (LOG_UPTO (LOG_INFO)); setlogmask (LOG_UPTO (LOG_INFO));
#endif #endif
@ -69,7 +70,7 @@
/* Set up the OMAPI. */ /* Set up the OMAPI. */
status = omapi_init (); status = omapi_init ();
@@ -439,8 +477,12 @@ @@ -431,8 +469,12 @@ int main (argc, argv, envp)
} }
} }
@ -82,7 +83,7 @@
if (!quiet) { if (!quiet) {
log_info ("%s %s", message, DHCP_VERSION); log_info ("%s %s", message, DHCP_VERSION);
log_info (copyright); log_info (copyright);
@@ -449,6 +491,7 @@ @@ -441,6 +483,7 @@ int main (argc, argv, envp)
log_info ("%s", ""); log_info ("%s", "");
} else } else
log_perror = 0; log_perror = 0;
@ -90,7 +91,7 @@
/* If we're given a relay agent address to insert, for testing /* If we're given a relay agent address to insert, for testing
purposes, figure out what it is. */ purposes, figure out what it is. */
@@ -683,11 +726,17 @@ @@ -672,11 +715,17 @@ int main (argc, argv, envp)
arg_conf_len = 0; arg_conf_len = 0;
} }
@ -108,7 +109,7 @@
/* XXX */ /* XXX */
/* config_counter(&snd_counter, &rcv_counter); */ /* config_counter(&snd_counter, &rcv_counter); */
@@ -706,7 +755,7 @@ @@ -695,7 +744,7 @@ int main (argc, argv, envp)
if (!persist) { if (!persist) {
/* Nothing more to do. */ /* Nothing more to do. */
log_info ("No broadcast interfaces found - exiting."); log_info ("No broadcast interfaces found - exiting.");
@ -117,7 +118,7 @@
} }
} else if (!release_mode) { } else if (!release_mode) {
/* Call the script with the list of interfaces. */ /* Call the script with the list of interfaces. */
@@ -800,6 +849,7 @@ @@ -789,6 +838,7 @@ int main (argc, argv, envp)
dmalloc_outstanding = 0; dmalloc_outstanding = 0;
#endif #endif
@ -125,7 +126,7 @@
/* If we're not supposed to wait before getting the address, /* If we're not supposed to wait before getting the address,
don't. */ don't. */
if (nowait) if (nowait)
@@ -812,6 +862,128 @@ @@ -801,6 +851,126 @@ int main (argc, argv, envp)
/* Start dispatching packets and timeouts... */ /* Start dispatching packets and timeouts... */
dispatch (); dispatch ();
@ -175,7 +176,6 @@
+ default_lease_time = 43200; + default_lease_time = 43200;
+ +
+ dhcp_max_agent_option_packet_length = 0; + dhcp_max_agent_option_packet_length = 0;
+ extended_option_environment = 0;
+ iaddr_any.len = 4; + iaddr_any.len = 4;
+ memset(&(iaddr_any.iabuf[0]), '\0', 4); + memset(&(iaddr_any.iabuf[0]), '\0', 4);
+ iaddr_broadcast.len = 4; + iaddr_broadcast.len = 4;
@ -198,7 +198,6 @@
+ path_dhclient_script = path_dhclient_script_array; + path_dhclient_script = path_dhclient_script_array;
+ remote_port = 0; + remote_port = 0;
+ resolver_inited = 0; + resolver_inited = 0;
+ new_option_info_tree = 0;
+ log_perror = 1; + log_perror = 1;
+ global_scope = NULL; + global_scope = NULL;
+ root_group = NULL; + root_group = NULL;
@ -254,7 +253,7 @@
/*NOTREACHED*/ /*NOTREACHED*/
return 0; return 0;
@@ -1204,7 +1376,20 @@ @@ -1191,7 +1361,20 @@ void dhcpack (packet)
if (client -> new -> rebind < cur_time) if (client -> new -> rebind < cur_time)
client -> new -> rebind = TIME_MAX; client -> new -> rebind = TIME_MAX;
@ -275,7 +274,7 @@
} }
void bind_lease (client) void bind_lease (client)
@@ -1240,6 +1425,9 @@ @@ -1227,6 +1410,9 @@ void bind_lease (client)
return; return;
} }
@ -285,7 +284,7 @@
/* Write out the new lease. */ /* Write out the new lease. */
write_client_lease (client, client -> new, 0, 0); write_client_lease (client, client -> new, 0, 0);
@@ -1340,11 +1528,13 @@ @@ -1327,11 +1513,13 @@ int commit_leases ()
return 0; return 0;
} }
@ -299,7 +298,7 @@
int write_host (host) int write_host (host)
struct host_decl *host; struct host_decl *host;
@@ -1915,6 +2105,10 @@ @@ -1902,6 +2090,10 @@ void state_panic (cpp)
tell the shell script that we failed to allocate an address, tell the shell script that we failed to allocate an address,
and try again later. */ and try again later. */
if (onetry) { if (onetry) {
@ -310,7 +309,7 @@
if (!quiet) if (!quiet)
log_info ("Unable to obtain a lease on first try.%s", log_info ("Unable to obtain a lease on first try.%s",
" Exiting."); " Exiting.");
@@ -2519,7 +2713,9 @@ @@ -2506,7 +2698,9 @@ void destroy_client_lease (lease)
free_client_lease (lease, MDL); free_client_lease (lease, MDL);
} }
@ -320,7 +319,7 @@
void rewrite_client_leases () void rewrite_client_leases ()
{ {
@@ -2960,6 +3156,54 @@ @@ -2902,6 +3096,54 @@ void script_write_params (client, prefix
int script_go (client) int script_go (client)
struct client_state *client; struct client_state *client;
{ {
@ -375,7 +374,7 @@
char *scriptName; char *scriptName;
char *argv [2]; char *argv [2];
char **envp; char **envp;
@@ -3033,6 +3277,7 @@ @@ -2978,6 +3220,7 @@ int script_go (client)
GET_TIME (&cur_time); GET_TIME (&cur_time);
return (WIFEXITED (wstatus) ? return (WIFEXITED (wstatus) ?
WEXITSTATUS (wstatus) : -WTERMSIG (wstatus)); WEXITSTATUS (wstatus) : -WTERMSIG (wstatus));
@ -383,7 +382,7 @@
} }
void client_envadd (struct client_state *client, void client_envadd (struct client_state *client,
@@ -3123,6 +3368,9 @@ @@ -3061,6 +3304,9 @@ void go_daemon ()
/* Don't become a daemon if the user requested otherwise. */ /* Don't become a daemon if the user requested otherwise. */
if (no_daemon) { if (no_daemon) {
@ -393,7 +392,7 @@
write_client_pid_file (); write_client_pid_file ();
return; return;
} }
@@ -3132,6 +3380,10 @@ @@ -3070,6 +3316,10 @@ void go_daemon ()
return; return;
state = 1; state = 1;
@ -404,9 +403,226 @@
/* Stop logging to stderr... */ /* Stop logging to stderr... */
log_perror = 0; log_perror = 0;
--- dhcp-3.0.5/common/discover.c.libdhcp4client 2007-03-30 20:54:06.000000000 -0400 diff -up dhcp-3.0.6/omapip/alloc.c.libdhcp4client dhcp-3.0.6/omapip/alloc.c
+++ dhcp-3.0.5/common/discover.c 2007-03-30 20:54:06.000000000 -0400 --- dhcp-3.0.6/omapip/alloc.c.libdhcp4client 2007-08-15 16:24:55.000000000 -0400
@@ -121,6 +121,10 @@ +++ dhcp-3.0.6/omapip/alloc.c 2007-08-15 16:24:55.000000000 -0400
@@ -40,6 +40,33 @@ static char copyright[] =
#include <omapip/omapip_p.h>
+#ifdef LIBDHCP
+/* OK, we need a quick and dirty way of freeing all memory used by libdhcp.
+ All pointers will be stored in a glibc tree on alloc, and removed on free.
+ This is not too expensive for light single-call library use.
+*/
+#include <search.h>
+extern void tdestroy (void *root, void (*free_node)(void *nodep));
+static void *all_pointers=0L;
+static int ptr_comparator(const void *p1, const void *p2) {
+ return ((p1 == p2) ? 0 : ((p1 > p2) ? 1 : -1));
+}
+
+static void record_pointer(void *ptr) {
+ tsearch(ptr, &(all_pointers), ptr_comparator);
+}
+
+static void forget_pointer(void *ptr) {
+ tdelete(ptr, &(all_pointers), ptr_comparator);
+}
+
+void omapi_free_all_pointers(void) {
+ if (all_pointers != NULL)
+ tdestroy(all_pointers, free);
+ all_pointers = NULL;
+}
+#endif
+
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
struct dmalloc_preamble *dmalloc_list;
@@ -77,7 +104,9 @@ VOIDPTR dmalloc (size, file, line)
return (VOIDPTR)0;
foo = malloc(len);
-
+#ifdef LIBDHCP
+ record_pointer(foo);
+#endif
if (!foo)
return (VOIDPTR)0;
bar = (VOIDPTR)(foo + DMDOFFSET);
@@ -199,6 +228,9 @@ void dfree (ptr, file, line)
0, (unsigned char *)ptr + DMDOFFSET, 0, 1, RC_MALLOC);
#endif
free (ptr);
+#ifdef LIBDHCP
+ forget_pointer(ptr);
+#endif
}
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
diff -up dhcp-3.0.6/omapip/dispatch.c.libdhcp4client dhcp-3.0.6/omapip/dispatch.c
--- dhcp-3.0.6/omapip/dispatch.c.libdhcp4client 2004-11-24 12:39:17.000000000 -0500
+++ dhcp-3.0.6/omapip/dispatch.c 2007-08-15 16:24:55.000000000 -0400
@@ -34,7 +34,7 @@
#include <omapip/omapip_p.h>
-static omapi_io_object_t omapi_io_states;
+omapi_io_object_t omapi_io_states;
TIME cur_time;
OMAPI_OBJECT_ALLOC (omapi_io,
diff -up dhcp-3.0.6/omapip/errwarn.c.libdhcp4client dhcp-3.0.6/omapip/errwarn.c
--- dhcp-3.0.6/omapip/errwarn.c.libdhcp4client 2007-08-15 16:24:55.000000000 -0400
+++ dhcp-3.0.6/omapip/errwarn.c 2007-08-15 16:24:55.000000000 -0400
@@ -39,6 +39,11 @@ static char copyright[] =
#include <omapip/omapip_p.h>
#include <errno.h>
+#ifdef LIBDHCP
+#include <libdhcp_control.h>
+extern LIBDHCP_Control *libdhcp_control;
+#endif
+
#ifdef DEBUG
int log_perror = -1;
#else
@@ -48,7 +53,9 @@ int log_priority;
void (*log_cleanup) (void);
#define CVT_BUF_MAX 1023
+#ifndef LIBDHCP
static char mbuf [CVT_BUF_MAX + 1];
+#endif
static char fbuf [CVT_BUF_MAX + 1];
/* Log an error message, then exit... */
@@ -58,6 +65,16 @@ void log_fatal (const char * fmt, ... )
va_list list;
do_percentm (fbuf, fmt);
+
+#ifdef LIBDHCP
+ if (libdhcp_control && (libdhcp_control->eh)) {
+ va_start (list, fmt);
+ libdhcp_control->eh(libdhcp_control, LOG_FATAL, fbuf, list);
+ va_end(list);
+ libdhcp_control->finished = 1;
+ return;
+ }
+#else
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
@@ -93,6 +110,7 @@ void log_fatal (const char * fmt, ... )
if (log_cleanup)
(*log_cleanup) ();
exit (1);
+#endif
}
/* Log an error message... */
@@ -103,6 +121,13 @@ int log_error (const char * fmt, ...)
do_percentm (fbuf, fmt);
+#ifdef LIBDHCP
+ if (libdhcp_control && libdhcp_control->eh) {
+ va_start (list, fmt);
+ libdhcp_control->eh(libdhcp_control, LOG_ERR, fbuf, list);
+ va_end(list);
+ }
+#else
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
*/
@@ -120,7 +145,7 @@ int log_error (const char * fmt, ...)
if (write (STDERR_FILENO, "\n", 1) <= 0)
return 0;
}
-
+#endif
return 0;
}
@@ -132,6 +157,13 @@ int log_info (const char *fmt, ...)
do_percentm (fbuf, fmt);
+#ifdef LIBDHCP
+ if (libdhcp_control && libdhcp_control->eh) {
+ va_start (list, fmt);
+ libdhcp_control->eh(libdhcp_control, LOG_INFO, fbuf, list);
+ va_end(list);
+ }
+#else
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
*/
@@ -149,7 +181,7 @@ int log_info (const char *fmt, ...)
if (write (STDERR_FILENO, "\n", 1) <= 0)
return 0;
}
-
+#endif
return 0;
}
@@ -160,7 +192,13 @@ int log_debug (const char *fmt, ...)
va_list list;
do_percentm (fbuf, fmt);
-
+#ifdef LIBDHCP
+ if (libdhcp_control && libdhcp_control->eh) {
+ va_start (list, fmt);
+ libdhcp_control->eh(libdhcp_control, LOG_DEBUG, fbuf, list);
+ va_end(list);
+ }
+#else
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
*/
@@ -178,7 +216,7 @@ int log_debug (const char *fmt, ...)
if (write (STDERR_FILENO, "\n", 1) <= 0)
return 0;
}
-
+#endif
return 0;
}
diff -up dhcp-3.0.6/includes/dhcpd.h.libdhcp4client dhcp-3.0.6/includes/dhcpd.h
--- dhcp-3.0.6/includes/dhcpd.h.libdhcp4client 2007-08-15 16:24:55.000000000 -0400
+++ dhcp-3.0.6/includes/dhcpd.h 2007-08-15 16:24:55.000000000 -0400
@@ -861,14 +861,6 @@ struct hardware_link {
typedef void (*tvref_t)(void *, void *, const char *, int);
typedef void (*tvunref_t)(void *, const char *, int);
-struct timeout {
- struct timeout *next;
- TIME when;
- void (*func) PROTO ((void *));
- void *what;
- tvref_t ref;
- tvunref_t unref;
-};
struct protocol {
struct protocol *next;
@@ -1795,7 +1787,6 @@ extern void (*bootp_packet_handler) PROT
struct dhcp_packet *, unsigned,
unsigned int,
struct iaddr, struct hardware *));
-extern struct timeout *timeouts;
extern omapi_object_type_t *dhcp_type_interface;
#if defined (TRACING)
trace_type_t *interface_trace;
diff -up dhcp-3.0.6/common/discover.c.libdhcp4client dhcp-3.0.6/common/discover.c
--- dhcp-3.0.6/common/discover.c.libdhcp4client 2007-08-15 16:24:55.000000000 -0400
+++ dhcp-3.0.6/common/discover.c 2007-08-15 16:24:55.000000000 -0400
@@ -121,6 +121,10 @@ isc_result_t interface_initialize (omapi
register that interface with the network I/O software, figure out what register that interface with the network I/O software, figure out what
subnet it's on, and add it to the list of interfaces. */ subnet it's on, and add it to the list of interfaces. */
@ -417,7 +633,7 @@
void discover_interfaces (state) void discover_interfaces (state)
int state; int state;
{ {
@@ -139,7 +143,9 @@ @@ -139,7 +143,9 @@ void discover_interfaces (state)
char *s; char *s;
#endif #endif
isc_result_t status; isc_result_t status;
@ -427,7 +643,7 @@
int wifcount = 0; int wifcount = 0;
/* Create an unbound datagram socket to do the SIOCGIFADDR ioctl on. */ /* Create an unbound datagram socket to do the SIOCGIFADDR ioctl on. */
@@ -692,10 +698,17 @@ @@ -692,10 +698,17 @@ void discover_interfaces (state)
log_fatal ("Not configured to listen on any interfaces!"); log_fatal ("Not configured to listen on any interfaces!");
} }
@ -445,9 +661,10 @@
#if defined (HAVE_SETFD) #if defined (HAVE_SETFD)
if (fallback_interface) { if (fallback_interface) {
--- dhcp-3.0.5/common/alloc.c.libdhcp4client 2007-03-30 20:54:06.000000000 -0400 diff -up dhcp-3.0.6/common/alloc.c.libdhcp4client dhcp-3.0.6/common/alloc.c
+++ dhcp-3.0.5/common/alloc.c 2007-03-30 20:54:06.000000000 -0400 --- dhcp-3.0.6/common/alloc.c.libdhcp4client 2007-08-15 16:24:55.000000000 -0400
@@ -1009,7 +1009,11 @@ +++ dhcp-3.0.6/common/alloc.c 2007-08-15 16:24:55.000000000 -0400
@@ -1009,7 +1009,11 @@ int executable_statement_reference (ptr,
return 1; return 1;
} }
@ -459,9 +676,10 @@
#if defined (DEBUG_MEMORY_LEAKAGE) || \ #if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
--- dhcp-3.0.5/common/tree.c.libdhcp4client 2007-03-30 20:54:06.000000000 -0400 diff -up dhcp-3.0.6/common/tree.c.libdhcp4client dhcp-3.0.6/common/tree.c
+++ dhcp-3.0.5/common/tree.c 2007-03-30 20:54:06.000000000 -0400 --- dhcp-3.0.6/common/tree.c.libdhcp4client 2007-08-15 16:24:55.000000000 -0400
@@ -40,7 +40,7 @@ +++ dhcp-3.0.6/common/tree.c 2007-08-15 16:24:55.000000000 -0400
@@ -40,7 +40,7 @@ static char copyright[] =
#include "dhcpd.h" #include "dhcpd.h"
#include <omapip/omapip_p.h> #include <omapip/omapip_p.h>
@ -470,7 +688,7 @@
static int do_host_lookup PROTO ((struct data_string *, static int do_host_lookup PROTO ((struct data_string *,
struct dns_host_entry *)); struct dns_host_entry *));
@@ -2615,6 +2615,7 @@ @@ -2615,6 +2615,7 @@ int evaluate_numeric_expression (result,
result of that evaluation. There should never be both an expression result of that evaluation. There should never be both an expression
and a valid data_string. */ and a valid data_string. */
@ -478,9 +696,10 @@
int evaluate_option_cache (result, packet, lease, client_state, int evaluate_option_cache (result, packet, lease, client_state,
in_options, cfg_options, scope, oc, file, line) in_options, cfg_options, scope, oc, file, line)
struct data_string *result; struct data_string *result;
--- dhcp-3.0.5/common/options.c.libdhcp4client 2007-03-30 20:54:06.000000000 -0400 diff -up dhcp-3.0.6/common/options.c.libdhcp4client dhcp-3.0.6/common/options.c
+++ dhcp-3.0.5/common/options.c 2007-03-30 20:54:06.000000000 -0400 --- dhcp-3.0.6/common/options.c.libdhcp4client 2007-08-15 16:24:55.000000000 -0400
@@ -2153,6 +2153,7 @@ +++ dhcp-3.0.6/common/options.c 2007-08-15 16:24:55.000000000 -0400
@@ -2152,6 +2152,7 @@ int fqdn_option_space_encapsulate (resul
return 1; return 1;
} }
@ -488,9 +707,10 @@
void option_space_foreach (struct packet *packet, struct lease *lease, void option_space_foreach (struct packet *packet, struct lease *lease,
struct client_state *client_state, struct client_state *client_state,
struct option_state *in_options, struct option_state *in_options,
--- dhcp-3.0.5/common/dispatch.c.libdhcp4client 2007-03-30 20:54:06.000000000 -0400 diff -up dhcp-3.0.6/common/dispatch.c.libdhcp4client dhcp-3.0.6/common/dispatch.c
+++ dhcp-3.0.5/common/dispatch.c 2007-03-30 20:54:06.000000000 -0400 --- dhcp-3.0.6/common/dispatch.c.libdhcp4client 2007-08-15 16:24:55.000000000 -0400
@@ -39,8 +39,24 @@ +++ dhcp-3.0.6/common/dispatch.c 2007-08-15 16:24:55.000000000 -0400
@@ -39,8 +39,24 @@ static char copyright[] =
#include "dhcpd.h" #include "dhcpd.h"
@ -517,7 +737,7 @@
void set_time(TIME t) void set_time(TIME t)
{ {
@@ -53,9 +69,41 @@ @@ -53,9 +69,41 @@ void set_time(TIME t)
struct timeval *process_outstanding_timeouts (struct timeval *tvp) struct timeval *process_outstanding_timeouts (struct timeval *tvp)
{ {
@ -559,7 +779,7 @@
another: another:
if (timeouts) { if (timeouts) {
struct timeout *t; struct timeout *t;
@@ -73,9 +121,15 @@ @@ -73,9 +121,15 @@ struct timeval *process_outstanding_time
tvp -> tv_sec = timeouts -> when; tvp -> tv_sec = timeouts -> when;
tvp -> tv_usec = 0; tvp -> tv_usec = 0;
} }
@ -575,7 +795,7 @@
} }
/* Wait for packets to come in using select(). When one does, call /* Wait for packets to come in using select(). When one does, call
@@ -104,13 +158,28 @@ @@ -104,13 +158,28 @@ void add_timeout (when, where, what, ref
tvref_t ref; tvref_t ref;
tvunref_t unref; tvunref_t unref;
{ {
@ -606,7 +826,7 @@
if (t) if (t)
t -> next = q -> next; t -> next = q -> next;
else else
@@ -119,7 +188,29 @@ @@ -119,7 +188,29 @@ void add_timeout (when, where, what, ref
} }
t = q; t = q;
} }
@ -636,7 +856,7 @@
/* If we didn't supersede a timeout, allocate a timeout /* If we didn't supersede a timeout, allocate a timeout
structure now. */ structure now. */
if (!q) { if (!q) {
@@ -128,7 +219,7 @@ @@ -128,7 +219,7 @@ void add_timeout (when, where, what, ref
free_timeouts = q -> next; free_timeouts = q -> next;
} else { } else {
q = ((struct timeout *) q = ((struct timeout *)
@ -645,7 +865,7 @@
if (!q) if (!q)
log_fatal ("add_timeout: no memory!"); log_fatal ("add_timeout: no memory!");
} }
@@ -158,22 +249,76 @@ @@ -158,22 +249,76 @@ void add_timeout (when, where, what, ref
if (t -> next -> when > q -> when) { if (t -> next -> when > q -> when) {
q -> next = t -> next; q -> next = t -> next;
t -> next = q; t -> next = q;
@ -722,7 +942,7 @@
t = (struct timeout *)0; t = (struct timeout *)0;
for (q = timeouts; q; q = q -> next) { for (q = timeouts; q; q = q -> next) {
if (q -> func == where && q -> what == what) { if (q -> func == where && q -> what == what) {
@@ -193,10 +338,15 @@ @@ -193,10 +338,15 @@ void cancel_timeout (where, what)
q -> next = free_timeouts; q -> next = free_timeouts;
free_timeouts = q; free_timeouts = q;
} }
@ -738,7 +958,7 @@
struct timeout *t, *n; struct timeout *t, *n;
for (t = timeouts; t; t = n) { for (t = timeouts; t; t = n) {
n = t -> next; n = t -> next;
@@ -205,13 +355,20 @@ @@ -205,13 +355,20 @@ void cancel_all_timeouts ()
t -> next = free_timeouts; t -> next = free_timeouts;
free_timeouts = t; free_timeouts = t;
} }
@ -759,9 +979,10 @@
} }
+#endif +#endif
} }
--- dhcp-3.0.5/dst/hmac_link.c.libdhcp4client 2001-02-22 02:22:08.000000000 -0500 diff -up dhcp-3.0.6/dst/hmac_link.c.libdhcp4client dhcp-3.0.6/dst/hmac_link.c
+++ dhcp-3.0.5/dst/hmac_link.c 2007-03-30 20:54:06.000000000 -0400 --- dhcp-3.0.6/dst/hmac_link.c.libdhcp4client 2001-02-22 02:22:08.000000000 -0500
@@ -38,6 +38,10 @@ +++ dhcp-3.0.6/dst/hmac_link.c 2007-08-15 16:24:55.000000000 -0400
@@ -38,6 +38,10 @@ static const char rcsid[] = "$Header: /p
#include "dst_internal.h" #include "dst_internal.h"
@ -772,7 +993,7 @@
#ifdef USE_MD5 #ifdef USE_MD5
# include "md5.h" # include "md5.h"
# ifndef _MD5_H_ # ifndef _MD5_H_
@@ -86,7 +90,11 @@ @@ -86,7 +90,11 @@ dst_hmac_md5_sign(const int mode, DST_KE
MD5_CTX *ctx = NULL; MD5_CTX *ctx = NULL;
if (mode & SIG_MODE_INIT) if (mode & SIG_MODE_INIT)
@ -784,7 +1005,7 @@
else if (context) else if (context)
ctx = (MD5_CTX *) *context; ctx = (MD5_CTX *) *context;
if (ctx == NULL) if (ctx == NULL)
@@ -153,7 +161,11 @@ @@ -153,7 +161,11 @@ dst_hmac_md5_verify(const int mode, DST_
MD5_CTX *ctx = NULL; MD5_CTX *ctx = NULL;
if (mode & SIG_MODE_INIT) if (mode & SIG_MODE_INIT)
@ -796,7 +1017,7 @@
else if (context) else if (context)
ctx = (MD5_CTX *) *context; ctx = (MD5_CTX *) *context;
if (ctx == NULL) if (ctx == NULL)
@@ -217,8 +229,11 @@ @@ -217,8 +229,11 @@ dst_buffer_to_hmac_md5(DST_KEY *dkey, co
if (dkey == NULL || key == NULL || keylen < 0) if (dkey == NULL || key == NULL || keylen < 0)
return (-1); return (-1);
@ -809,7 +1030,7 @@
return (-2); return (-2);
memset(hkey->hk_ipad, 0, sizeof(hkey->hk_ipad)); memset(hkey->hk_ipad, 0, sizeof(hkey->hk_ipad));
@@ -347,7 +362,11 @@ @@ -347,7 +362,11 @@ dst_hmac_md5_key_from_file_format(DST_KE
if (eol == NULL) if (eol == NULL)
return (-4); return (-4);
len = eol - p; len = eol - p;
@ -821,7 +1042,7 @@
memcpy(tmp, p, len); memcpy(tmp, p, len);
*(tmp + len) = 0x0; *(tmp + len) = 0x0;
key_len = b64_pton((char *)tmp, key, HMAC_LEN+1); /* see above */ key_len = b64_pton((char *)tmp, key, HMAC_LEN+1); /* see above */
@@ -439,8 +458,11 @@ @@ -439,8 +458,11 @@ dst_hmac_md5_generate_key(DST_KEY *key,
return(0); return(0);
len = size > 64 ? 64 : size; len = size > 64 ? 64 : size;
@ -834,7 +1055,7 @@
n = dst_random(DST_RAND_SEMI, len, buff); n = dst_random(DST_RAND_SEMI, len, buff);
n += dst_random(DST_RAND_KEY, len, buff); n += dst_random(DST_RAND_KEY, len, buff);
if (n <= len) { /* failed getting anything */ if (n <= len) { /* failed getting anything */
@@ -463,7 +485,11 @@ @@ -463,7 +485,11 @@ dst_hmac_md5_init()
{ {
if (dst_t_func[KEY_HMAC_MD5] != NULL) if (dst_t_func[KEY_HMAC_MD5] != NULL)
return (1); return (1);
@ -846,220 +1067,9 @@
if (dst_t_func[KEY_HMAC_MD5] == NULL) if (dst_t_func[KEY_HMAC_MD5] == NULL)
return (0); return (0);
memset(dst_t_func[KEY_HMAC_MD5], 0, sizeof(struct dst_func)); memset(dst_t_func[KEY_HMAC_MD5], 0, sizeof(struct dst_func));
--- dhcp-3.0.5/includes/dhcpd.h.libdhcp4client 2007-03-30 20:54:06.000000000 -0400 diff -up dhcp-3.0.6/Makefile.dist.libdhcp4client dhcp-3.0.6/Makefile.dist
+++ dhcp-3.0.5/includes/dhcpd.h 2007-03-30 20:54:06.000000000 -0400 --- dhcp-3.0.6/Makefile.dist.libdhcp4client 2004-06-10 13:59:10.000000000 -0400
@@ -855,14 +855,6 @@ +++ dhcp-3.0.6/Makefile.dist 2007-08-15 16:24:55.000000000 -0400
typedef void (*tvref_t)(void *, void *, const char *, int);
typedef void (*tvunref_t)(void *, const char *, int);
-struct timeout {
- struct timeout *next;
- TIME when;
- void (*func) PROTO ((void *));
- void *what;
- tvref_t ref;
- tvunref_t unref;
-};
struct protocol {
struct protocol *next;
@@ -1789,7 +1781,6 @@
struct dhcp_packet *, unsigned,
unsigned int,
struct iaddr, struct hardware *));
-extern struct timeout *timeouts;
extern omapi_object_type_t *dhcp_type_interface;
#if defined (TRACING)
trace_type_t *interface_trace;
--- dhcp-3.0.5/omapip/alloc.c.libdhcp4client 2007-03-30 20:54:06.000000000 -0400
+++ dhcp-3.0.5/omapip/alloc.c 2007-03-30 20:54:06.000000000 -0400
@@ -40,6 +40,33 @@
#include <omapip/omapip_p.h>
+#ifdef LIBDHCP
+/* OK, we need a quick and dirty way of freeing all memory used by libdhcp.
+ All pointers will be stored in a glibc tree on alloc, and removed on free.
+ This is not too expensive for light single-call library use.
+*/
+#include <search.h>
+extern void tdestroy (void *root, void (*free_node)(void *nodep));
+static void *all_pointers=0L;
+static int ptr_comparator(const void *p1, const void *p2) {
+ return ((p1 == p2) ? 0 : ((p1 > p2) ? 1 : -1));
+}
+
+static void record_pointer(void *ptr) {
+ tsearch(ptr, &(all_pointers), ptr_comparator);
+}
+
+static void forget_pointer(void *ptr) {
+ tdelete(ptr, &(all_pointers), ptr_comparator);
+}
+
+void omapi_free_all_pointers(void) {
+ if (all_pointers != NULL)
+ tdestroy(all_pointers, free);
+ all_pointers = NULL;
+}
+#endif
+
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
struct dmalloc_preamble *dmalloc_list;
@@ -77,7 +104,9 @@
return (VOIDPTR)0;
foo = malloc(len);
-
+#ifdef LIBDHCP
+ record_pointer(foo);
+#endif
if (!foo)
return (VOIDPTR)0;
bar = (VOIDPTR)(foo + DMDOFFSET);
@@ -199,6 +228,9 @@
0, (unsigned char *)ptr + DMDOFFSET, 0, 1, RC_MALLOC);
#endif
free (ptr);
+#ifdef LIBDHCP
+ forget_pointer(ptr);
+#endif
}
#if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
--- dhcp-3.0.5/omapip/dispatch.c.libdhcp4client 2004-11-24 12:39:17.000000000 -0500
+++ dhcp-3.0.5/omapip/dispatch.c 2007-03-30 20:54:06.000000000 -0400
@@ -34,7 +34,7 @@
#include <omapip/omapip_p.h>
-static omapi_io_object_t omapi_io_states;
+omapi_io_object_t omapi_io_states;
TIME cur_time;
OMAPI_OBJECT_ALLOC (omapi_io,
--- dhcp-3.0.5/omapip/errwarn.c.libdhcp4client 2007-03-30 20:54:06.000000000 -0400
+++ dhcp-3.0.5/omapip/errwarn.c 2007-03-30 20:54:06.000000000 -0400
@@ -39,6 +39,11 @@
#include <omapip/omapip_p.h>
#include <errno.h>
+#ifdef LIBDHCP
+#include <libdhcp_control.h>
+extern LIBDHCP_Control *libdhcp_control;
+#endif
+
#ifdef DEBUG
int log_perror = -1;
#else
@@ -48,7 +53,9 @@
void (*log_cleanup) (void);
#define CVT_BUF_MAX 1023
+#ifndef LIBDHCP
static char mbuf [CVT_BUF_MAX + 1];
+#endif
static char fbuf [CVT_BUF_MAX + 1];
/* Log an error message, then exit... */
@@ -58,6 +65,16 @@
va_list list;
do_percentm (fbuf, fmt);
+
+#ifdef LIBDHCP
+ if (libdhcp_control && (libdhcp_control->eh)) {
+ va_start (list, fmt);
+ libdhcp_control->eh(libdhcp_control, LOG_FATAL, fbuf, list);
+ va_end(list);
+ libdhcp_control->finished = 1;
+ return;
+ }
+#else
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
@@ -93,6 +110,7 @@
if (log_cleanup)
(*log_cleanup) ();
exit (1);
+#endif
}
/* Log an error message... */
@@ -103,6 +121,13 @@
do_percentm (fbuf, fmt);
+#ifdef LIBDHCP
+ if (libdhcp_control && libdhcp_control->eh) {
+ va_start (list, fmt);
+ libdhcp_control->eh(libdhcp_control, LOG_ERR, fbuf, list);
+ va_end(list);
+ }
+#else
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
*/
@@ -120,7 +145,7 @@
if (write (STDERR_FILENO, "\n", 1) <= 0)
return 0;
}
-
+#endif
return 0;
}
@@ -132,6 +157,13 @@
do_percentm (fbuf, fmt);
+#ifdef LIBDHCP
+ if (libdhcp_control && libdhcp_control->eh) {
+ va_start (list, fmt);
+ libdhcp_control->eh(libdhcp_control, LOG_INFO, fbuf, list);
+ va_end(list);
+ }
+#else
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
*/
@@ -149,7 +181,7 @@
if (write (STDERR_FILENO, "\n", 1) <= 0)
return 0;
}
-
+#endif
return 0;
}
@@ -160,7 +192,13 @@
va_list list;
do_percentm (fbuf, fmt);
-
+#ifdef LIBDHCP
+ if (libdhcp_control && libdhcp_control->eh) {
+ va_start (list, fmt);
+ libdhcp_control->eh(libdhcp_control, LOG_DEBUG, fbuf, list);
+ va_end(list);
+ }
+#else
/* %Audit% This is log output. %2004.06.17,Safe%
* If we truncate we hope the user can get a hint from the log.
*/
@@ -178,7 +216,7 @@
if (write (STDERR_FILENO, "\n", 1) <= 0)
return 0;
}
-
+#endif
return 0;
}
--- dhcp-3.0.5/Makefile.dist.libdhcp4client 2004-06-10 13:59:10.000000000 -0400
+++ dhcp-3.0.5/Makefile.dist 2007-03-30 20:54:06.000000000 -0400
@@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
# http://www.isc.org/ # http://www.isc.org/
@ -1069,9 +1079,10 @@
all: all:
@for dir in ${SUBDIRS}; do \ @for dir in ${SUBDIRS}; do \
--- dhcp-3.0.5/configure.libdhcp4client 2004-09-10 17:02:30.000000000 -0400 diff -up dhcp-3.0.6/configure.libdhcp4client dhcp-3.0.6/configure
+++ dhcp-3.0.5/configure 2007-03-30 20:54:06.000000000 -0400 --- dhcp-3.0.6/configure.libdhcp4client 2004-09-10 17:02:30.000000000 -0400
@@ -246,7 +246,7 @@ +++ dhcp-3.0.6/configure 2007-08-15 16:24:55.000000000 -0400
@@ -246,7 +246,7 @@ if [ ! -d $workname ]; then
fi fi
if [ x"$dirs" = x ]; then if [ x"$dirs" = x ]; then

View File

@ -1,77 +1,8 @@
--- dhcp-3.0.5/client/dhclient-script.8.manpages 2005-09-28 15:17:08.000000000 -0400 diff -up dhcp-3.0.6/client/dhclient.8.manpages dhcp-3.0.6/client/dhclient.8
+++ dhcp-3.0.5/client/dhclient-script.8 2007-04-26 14:52:13.000000000 -0400 --- dhcp-3.0.6/client/dhclient.8.manpages 2007-05-01 16:42:55.000000000 -0400
@@ -47,7 +47,7 @@ +++ dhcp-3.0.6/client/dhclient.8 2007-08-15 12:08:48.000000000 -0400
exit hooks provided (see HOOKS for details). These hooks will allow the @@ -82,6 +82,28 @@ relay
user to override the default behaviour of the client in creating a .B -w
.B /etc/resolv.conf
-file.
+file, and to handle DHCP options not handled by default.
.PP
No standard client script exists for some operating systems, even though
the actual client may work, so a pioneering user may well need to create
@@ -91,6 +91,27 @@
.B ETCDIR/dhclient-exit-hooks
script can modify the valid of exit_status to change the exit status
of dhclient-script.
+.PP
+Immediately after dhclient brings an interface UP with a new IP address,
+subnet mask, and routes, in the REBOOT/BOUND states, it will check for the
+existence of an executable
+.B ETCDIR/dhclient-up-hooks
+script, and source it if found. This script can handle DHCP options in
+the environment that are not handled by default. A per-interface
+.B ETCDIR/dhclient-${IF}-up-hooks
+script will override the generic script and be sourced when interface
+$IF has been brought up.
+.PP
+Immediately before dhclient brings an interface DOWN, removing its IP
+address, subnet mask, and routes, in the STOP/RELEASE states, it will
+check for the existence of an executable
+.B ETCDIR/dhclient-down-hooks
+script, and source it if found. This script can handle DHCP options in
+the environment that are not handled by default. A per-interface
+.B ETCDIR/dhclient-${IF}-down-hooks
+script will override the generic script and be sourced when interface
+$IF is about to be brought down.
+
.SH OPERATION
When dhclient needs to invoke the client configuration script, it
defines a set of variables in the environment, and then invokes
--- dhcp-3.0.5/client/dhclient.conf.5.manpages 2005-06-16 15:40:13.000000000 -0400
+++ dhcp-3.0.5/client/dhclient.conf.5 2007-04-26 14:51:02.000000000 -0400
@@ -185,7 +185,8 @@
options. Only the option names should be specified in the request
statement - not option parameters. By default, the DHCP server
requests the subnet-mask, broadcast-address, time-offset, routers,
-domain-name, domain-name-servers and host-name options.
+domain-name, domain-name-servers, host-name, nis-domain, nis-servers,
+and ntp-servers options.
.PP
In some cases, it may be desirable to send no parameter request list
at all. To do this, simply write the request statement but specify
@@ -581,6 +582,18 @@
Whenever the client tries to renew the lease, it will use that same
media type. The lease must expire before the client will go back to
cycling through media types.
+.PP
+ \fBbootp-broadcast-always;\fR
+.PP
+The
+.B bootp-broadcast-always
+statement instructs dhclient to always set the bootp broadcast flag in
+request packets, so that servers will always broadcast replies.
+This is equivalent to supplying the dhclient -B argument, and has
+the same effect as specifying 'always-broadcast' in the server's dhcpd.conf.
+This option is provided as a Red Hat extension to enable dhclient to work
+on IBM zSeries z/OS Linux guests .
+.PP
.SH SAMPLE
The following configuration file is used on a laptop running NetBSD
1.3. The laptop has an IP alias of 192.5.5.213, and has one
--- dhcp-3.0.5/client/dhclient.8.manpages 2007-04-26 14:51:02.000000000 -0400
+++ dhcp-3.0.5/client/dhclient.8 2007-04-26 14:51:02.000000000 -0400
@@ -85,6 +85,28 @@
.B -x
] ]
[ [
+.B -I +.B -I
@ -92,25 +23,25 @@
+.I request option list +.I request option list
+] +]
+[ +[
+.B -T +.B -T
+.I timeout +.I timeout
+] +]
+[ +[
.I if0 .I if0
[ [
.I ...ifN .I ...ifN
@@ -273,6 +295,107 @@ @@ -265,6 +287,110 @@ than waiting until it has acquired an IP
-s dhclient-script environment, which would allow applications running supplying the
in that environment to handle options they do not know about in advance - .B -nw
this is a Red Hat extension to support dhcdbd and NetworkManager. flag.
+.PP +.PP
+The -I <id> argument allows you to specify the dhcp-client-identifier string, <id>, +The -I <id> argument allows you to specify the dhcp-client-identifier string,
+to be sent to the dhcp server on the command line. It is equivalent to the +<id>, to be sent to the dhcp server on the command line. It is equivalent to
+top level dhclient.conf statement: +the top level dhclient.conf statement:
+.br +.br
+ \fBsend dhcp-client-identifier "<id>";\fR + \fBsend dhcp-client-identifier "<id>";\fR
+.br +.br
+The -I <id> command line option will override any top level dhclient.conf +The -I <id> command line option will override any top level dhclient.conf
+ 'send dhcp-client-identifier' statement, but more specific per-interface + 'send dhcp-client-identifier' statement, but more specific per-interface
+ 'interface "X" { send dhcp-client-identifier...; }' statements in dhclient.conf + 'interface "X" { send dhcp-client-identifier...; }' statements in dhclient.conf
+will override the -I <id> command line option for interface "X". +will override the -I <id> command line option for interface "X".
@ -123,15 +54,15 @@
+the same effect as specifying 'always-broadcast' in the server's dhcpd.conf. +the same effect as specifying 'always-broadcast' in the server's dhcpd.conf.
+This option is provided as a Red Hat extension to enable dhclient to work +This option is provided as a Red Hat extension to enable dhclient to work
+on IBM zSeries z/OS Linux guests. +on IBM zSeries z/OS Linux guests.
+.PP +.PP
+The -H <host-name> option allows you to specify the DHCP host-name option +The -H <host-name> option allows you to specify the DHCP host-name option
+to send to the server on the dhclient command line. It is equivalent to the +to send to the server on the dhclient command line. It is equivalent to the
+top level dhclient.conf statement: +top level dhclient.conf statement:
+.br +.br
+\f send host-name "<host-name>";\fR +\f send host-name "<host-name>";\fR
+.br +.br
+The -H <host-name> option will override any top level dhclient.conf +The -H <host-name> option will override any top level dhclient.conf
+ 'send host-name' statement, but more specific per-interface + 'send host-name' statement, but more specific per-interface
+ 'interface "X" { send host-name...;' statements in dhclient.conf + 'interface "X" { send host-name...;' statements in dhclient.conf
+will override the -H <host-name> command line option for interface "X". +will override the -H <host-name> command line option for interface "X".
+The host-name option only specifies the client's host name prefix, to which +The host-name option only specifies the client's host name prefix, to which
@ -141,7 +72,7 @@
+Only one -H <host-name> option may be specified. +Only one -H <host-name> option may be specified.
+The -H <host-name> option is provided as a Red Hat extension to simplify +The -H <host-name> option is provided as a Red Hat extension to simplify
+configuration of clients of DHCP servers that require the host-name option +configuration of clients of DHCP servers that require the host-name option
+to be sent (eg. some modern cable modems), and for dynamic DNS updates (DDNS). +to be sent (eg. some modern cable modems), and for dynamic DNS updates (DDNS).
+.PP +.PP
+The -F <fqdn.fqdn> option allows you to specify the DHCP fqdn.fqdn option +The -F <fqdn.fqdn> option allows you to specify the DHCP fqdn.fqdn option
+to send to the server on the dhclient command line. It is equivalent to the +to send to the server on the dhclient command line. It is equivalent to the
@ -149,8 +80,8 @@
+.br +.br
+\f send fqdn.fqdn "<domain-name>";\fR +\f send fqdn.fqdn "<domain-name>";\fR
+.br +.br
+The -F <fqdn.fqdn> option will override any top level dhclient.conf +The -F <fqdn.fqdn> option will override any top level dhclient.conf
+ 'send fqdn.fqdn' statement, but more specific per-interface + 'send fqdn.fqdn' statement, but more specific per-interface
+ 'interface "X" { send fqdn.fqdn...;' statements in dhclient.conf + 'interface "X" { send fqdn.fqdn...;' statements in dhclient.conf
+will override the -F <fqdn.fqdn> command line option for interface "X". +will override the -F <fqdn.fqdn> command line option for interface "X".
+This option cannot be used with the -H <host-name> option. +This option cannot be used with the -H <host-name> option.
@ -158,11 +89,11 @@
+host, which the server may use for dynamic DNS updates. +host, which the server may use for dynamic DNS updates.
+Only one -F <fqdn.fqdn> option may be specified. +Only one -F <fqdn.fqdn> option may be specified.
+The -F <fqdn.fqdn> option is provided as a Red Hat extension to simplify +The -F <fqdn.fqdn> option is provided as a Red Hat extension to simplify
+configuration of DDNS. +configuration of DDNS.
+.PP +.PP
+The -T <timeout> option allows you to specify the time after which +The -T <timeout> option allows you to specify the time after which
+the dhclient will decide that no DHCP servers can be contacted when +the dhclient will decide that no DHCP servers can be contacted when
+no responses have been received. It is equivalent to the +no responses have been received. It is equivalent to the
+.br +.br
+\f timeout <integer>;\fR +\f timeout <integer>;\fR
+.br +.br
@ -170,54 +101,208 @@
+.br +.br
+This option is provided as a Red Hat extension. +This option is provided as a Red Hat extension.
+.PP +.PP
+The -V <vendor-class-identifier> option allows you to specify the DHCP +The -V <vendor-class-identifier> option allows you to specify the DHCP
+vendor-class-identifier option to send to the server on the dhclient command line. +vendor-class-identifier option to send to the server on the dhclient command
+It is equivalent to the top level dhclient.conf statement: +line. It is equivalent to the top level dhclient.conf statement:
+.br +.br
+\f send vendor-class-identifier "<vendor-class-identifier>";\fR +\f send vendor-class-identifier "<vendor-class-identifier>";\fR
+.br +.br
+The -V <vendor-class-identifier> option will override any top level dhclient.conf +The -V <vendor-class-identifier> option will override any top level
+ 'send vendor-class-identifier' statement, but more specific per-interface +dhclient.conf
+ 'send vendor-class-identifier' statement, but more specific per-interface
+ 'interface "X" { send vendor-class-identifier...;' statements in dhclient.conf + 'interface "X" { send vendor-class-identifier...;' statements in dhclient.conf
+will override the -V <vendor-class-identifier> command line option for interface "X". +will override the -V <vendor-class-identifier> command line option for
+The -V <vendor-class-identifier> option is provided as a Red Hat extension to simplify +interface "X".
+configuration of clients of DHCP servers that require the vendor-class-identifier option +The -V <vendor-class-identifier> option is provided as a Red Hat extension to
+to be sent. +simplify configuration of clients of DHCP servers that require the
+vendor-class-identifier option to be sent.
+.PP +.PP
+The -R <request option list> option allows you to specify the list of options the +The -R <request option list> option allows you to specify the list of options
+client is to request from the server on the dhclient command line. +the client is to request from the server on the dhclient command line.
+The option list must be a single string, consisting of option names separated +The option list must be a single string, consisting of option names separated
+by at least one comma and optional space characters. The default option list +by at least one comma and optional space characters. The default option list
+is : +is:
+.br +.br
+ subnet-mask, broadcast-address, time-offset, routers, + subnet-mask, broadcast-address, time-offset, routers,
+.br +.br
+ domain-name, domain-name-servers, host-name, nis-domain, + domain-name, domain-name-servers, host-name, nis-domain,
+.br +.br
+ nis-servers, ntp-servers + nis-servers, ntp-servers
+.br +.br
+You can specify a different list of options to request with the -R <option list> argument. +You can specify a different list of options to request with the -R <option list>
+This is equivalent to the dhclient.conf statement: +argument. This is equivalent to the dhclient.conf statement:
+.br +.br
+\f request <option list> ;\fR +\f request <option list> ;\fR
+.br +.br
+The -R argument is provided as a Red Hat extension to ISC dhclient to facilitate requesting +The -R argument is provided as a Red Hat extension to ISC dhclient to
+a list of options from the server different to the default. +facilitate requesting a list of options from the server different to the
+default.
+.PP +.PP
.SH CONFIGURATION .SH CONFIGURATION
The syntax of the dhclient.conf(5) file is discussed separately. The syntax of the dhclient.conf(5) file is discussed separately.
.SH OMAPI .SH OMAPI
--- dhcp-3.0.5/common/dhcp-options.5.manpages 2006-04-26 11:12:43.000000000 -0400 diff -up dhcp-3.0.6/client/dhclient-script.8.manpages dhcp-3.0.6/client/dhclient-script.8
+++ dhcp-3.0.5/common/dhcp-options.5 2007-04-26 14:51:02.000000000 -0400 --- dhcp-3.0.6/client/dhclient-script.8.manpages 2005-09-28 15:17:08.000000000 -0400
@@ -834,6 +834,24 @@ +++ dhcp-3.0.6/client/dhclient-script.8 2007-08-15 11:55:11.000000000 -0400
@@ -47,7 +47,7 @@ customizations are needed, they should b
exit hooks provided (see HOOKS for details). These hooks will allow the
user to override the default behaviour of the client in creating a
.B /etc/resolv.conf
-file.
+file, and to handle DHCP options not handled by default.
.PP
No standard client script exists for some operating systems, even though
the actual client may work, so a pioneering user may well need to create
@@ -91,6 +91,27 @@ present. The
.B ETCDIR/dhclient-exit-hooks
script can modify the valid of exit_status to change the exit status
of dhclient-script.
+.PP
+Immediately after dhclient brings an interface UP with a new IP address,
+subnet mask, and routes, in the REBOOT/BOUND states, it will check for the
+existence of an executable
+.B ETCDIR/dhclient-up-hooks
+script, and source it if found. This script can handle DHCP options in
+the environment that are not handled by default. A per-interface.
+.B ETCDIR/dhclient-${IF}-up-hooks
+script will override the generic script and be sourced when interface
+$IF has been brought up.
+.PP
+Immediately before dhclient brings an interface DOWN, removing its IP
+address, subnet mask, and routes, in the STOP/RELEASE states, it will
+check for the existence of an executable
+.B ETCDIR/dhclient-down-hooks
+script, and source it if found. This script can handle DHCP options in
+the environment that are not handled by default. A per-interface
+.B ETCDIR/dhclient-${IF}-down-hooks
+script will override the generic script and be sourced when interface
+$IF is about to be brought down.
+
.SH OPERATION
When dhclient needs to invoke the client configuration script, it
defines a set of variables in the environment, and then invokes
diff -up dhcp-3.0.6/client/dhclient.conf.5.manpages dhcp-3.0.6/client/dhclient.conf.5
--- dhcp-3.0.6/client/dhclient.conf.5.manpages 2007-05-01 16:42:55.000000000 -0400
+++ dhcp-3.0.6/client/dhclient.conf.5 2007-08-15 11:56:40.000000000 -0400
@@ -185,7 +185,8 @@ responding to the client send the client
options. Only the option names should be specified in the request
statement - not option parameters. By default, the DHCP server
requests the subnet-mask, broadcast-address, time-offset, routers,
-domain-name, domain-name-servers and host-name options.
+domain-name, domain-name-servers, host-name, nis-domain, nis-servers,
+and ntp-servers options.
.PP
In some cases, it may be desirable to send no parameter request list
at all. To do this, simply write the request statement but specify
@@ -581,6 +582,18 @@ database and will record the media type
Whenever the client tries to renew the lease, it will use that same
media type. The lease must expire before the client will go back to
cycling through media types.
+.PP
+ \fBbootp-broadcast-always;\fR
+.PP
+The
+.B bootp-broadcast-always
+statement instructs dhclient to always set the bootp broadcast flag in
+request packets, so that servers will always broadcast replies.
+This is equivalent to supplying the dhclient -B argument, and has
+the same effect as specifying 'always-broadcast' in the server's dhcpd.conf.
+This option is provided as a Red Hat extension to enable dhclient to work
+on IBM zSeries z/OS Linux guests.
+.PP
.SH SAMPLE
The following configuration file is used on a laptop running NetBSD
1.3. The laptop has an IP alias of 192.5.5.213, and has one
diff -up dhcp-3.0.6/dhcpctl/dhcpctl.3.manpages dhcp-3.0.6/dhcpctl/dhcpctl.3
--- dhcp-3.0.6/dhcpctl/dhcpctl.3.manpages 2004-09-24 17:08:38.000000000 -0400
+++ dhcp-3.0.6/dhcpctl/dhcpctl.3 2007-08-15 12:59:06.000000000 -0400
@@ -43,7 +43,7 @@
.\"
.\"
.Sh SYNOPSIS
-.Fd #include <dhcpctl/dhcpctl.h>
+.Fd #include <dhcpctl.h>
.Ft dhcpctl_status
.Fo dhcpctl_initialize
.Fa void
@@ -426,7 +426,7 @@ that most error checking has been ommitt
#include <netinet/in.h>
#include <isc/result.h>
-#include <dhcpctl/dhcpctl.h>
+#include <dhcpctl.h>
int main (int argc, char **argv) {
dhcpctl_data_string ipaddrstring = NULL;
diff -up dhcp-3.0.6/server/dhcpd.conf.5.manpages dhcp-3.0.6/server/dhcpd.conf.5
--- dhcp-3.0.6/server/dhcpd.conf.5.manpages 2007-05-01 16:42:56.000000000 -0400
+++ dhcp-3.0.6/server/dhcpd.conf.5 2007-08-15 13:00:35.000000000 -0400
@@ -531,9 +531,9 @@ primary server might look like this:
failover peer "foo" {
primary;
address anthrax.rc.vix.com;
- port 519;
+ port 647;
peer address trantor.rc.vix.com;
- peer port 520;
+ peer port 847;
max-response-delay 60;
max-unacked-updates 10;
mclt 3600;
@@ -592,9 +592,7 @@ statement
.B port \fIport-number\fR\fB;\fR
.PP
The \fBport\fR statement declares the TCP port on which the server
-should listen for connections from its failover peer. This statement
-may not currently be omitted, because the failover protocol does not
-yet have a reserved TCP port number.
+should listen for connections from its failover peer.
.RE
.PP
The
@@ -606,10 +604,8 @@ statement
.PP
The \fBpeer port\fR statement declares the TCP port to which the
server should connect to reach its failover peer for failover
-messages. This statement may not be omitted because the failover
-protocol does not yet have a reserved TCP port number. The port
-number declared in the \fBpeer port\fR statement may be the same as
-the port number declared in the \fBport\fR statement.
+messages. The port number declared in the \fBpeer port\fR statement
+may be the same as the port number declared in the \fBport\fR statement.
.RE
.PP
The
@@ -1133,7 +1129,7 @@ the zone containing PTR records - for IS
.PP
.nf
key DHCP_UPDATER {
- algorithm HMAC-MD5.SIG-ALG.REG.INT;
+ algorithm hmac-md5;
secret pRP5FapFoJ95JEL06sv4PQ==;
};
@@ -1156,7 +1152,7 @@ dhcpd.conf file:
.PP
.nf
key DHCP_UPDATER {
- algorithm HMAC-MD5.SIG-ALG.REG.INT;
+ algorithm hmac-md5;
secret pRP5FapFoJ95JEL06sv4PQ==;
};
diff -up dhcp-3.0.6/common/dhcp-options.5.manpages dhcp-3.0.6/common/dhcp-options.5
--- dhcp-3.0.6/common/dhcp-options.5.manpages 2006-04-26 11:12:43.000000000 -0400
+++ dhcp-3.0.6/common/dhcp-options.5 2007-08-15 12:10:12.000000000 -0400
@@ -834,6 +834,24 @@ classless IP routing - it does not inclu
classless IP routing is now the most widely deployed routing standard, classless IP routing is now the most widely deployed routing standard,
this option is virtually useless, and is not implemented by any of the this option is virtually useless, and is not implemented by any of the
popular DHCP clients, for example the Microsoft DHCP client. popular DHCP clients, for example the Microsoft DHCP client.
+.PP +.PP
+NOTE to Red Hat dhclient users: +NOTE to Red Hat dhclient users:
+.br +.br
+The RedHat dhclient-script interprets trailing 0 octets of the target +The RedHat dhclient-script interprets trailing 0 octets of the target
+as indicating the subnet class of the route - so for this +as indicating the subnet class of the route - so for this
+static-routes value: +static-routes value:
+.br +.br
+ option static-routes 172.0.0.0 172.16.2.254, + option static-routes 172.0.0.0 172.16.2.254,
@ -234,80 +319,3 @@
.RE .RE
.PP .PP
.nf .nf
--- dhcp-3.0.5/dhcpctl/dhcpctl.3.manpages 2004-09-24 17:08:38.000000000 -0400
+++ dhcp-3.0.5/dhcpctl/dhcpctl.3 2007-04-26 14:51:02.000000000 -0400
@@ -43,7 +43,8 @@
.\"
.\"
.Sh SYNOPSIS
-.Fd #include <dhcpctl/dhcpctl.h>
+.Fd #include <dhcpctl.h>
+.sp
.Ft dhcpctl_status
.Fo dhcpctl_initialize
.Fa void
@@ -426,7 +427,7 @@
#include <netinet/in.h>
#include <isc/result.h>
-#include <dhcpctl/dhcpctl.h>
+#include <dhcpctl.h>
int main (int argc, char **argv) {
dhcpctl_data_string ipaddrstring = NULL;
--- dhcp-3.0.5/server/dhcpd.conf.5.manpages 2006-07-09 11:02:24.000000000 -0400
+++ dhcp-3.0.5/server/dhcpd.conf.5 2007-04-26 14:51:02.000000000 -0400
@@ -531,9 +531,9 @@
failover peer "foo" {
primary;
address anthrax.rc.vix.com;
- port 519;
+ port 647;
peer address trantor.rc.vix.com;
- peer port 520;
+ peer port 847;
max-response-delay 60;
max-unacked-updates 10;
mclt 3600;
@@ -592,9 +592,7 @@
.B port \fIport-number\fR\fB;\fR
.PP
The \fBport\fR statement declares the TCP port on which the server
-should listen for connections from its failover peer. This statement
-may not currently be omitted, because the failover protocol does not
-yet have a reserved TCP port number.
+should listen for connections from its failover peer.
.RE
.PP
The
@@ -606,10 +604,8 @@
.PP
The \fBpeer port\fR statement declares the TCP port to which the
server should connect to reach its failover peer for failover
-messages. This statement may not be omitted because the failover
-protocol does not yet have a reserved TCP port number. The port
-number declared in the \fBpeer port\fR statement may be the same as
-the port number declared in the \fBport\fR statement.
+messages. The port number declared in the \fBpeer port\fR statement
+may be the same as the port number declared in the \fBport\fR statement.
.RE
.PP
The
@@ -1133,7 +1129,7 @@
.PP
.nf
key DHCP_UPDATER {
- algorithm HMAC-MD5.SIG-ALG.REG.INT;
+ algorithm hmac-md5;
secret pRP5FapFoJ95JEL06sv4PQ==;
};
@@ -1156,7 +1152,7 @@
.PP
.nf
key DHCP_UPDATER {
- algorithm HMAC-MD5.SIG-ALG.REG.INT;
+ algorithm hmac-md5;
secret pRP5FapFoJ95JEL06sv4PQ==;
};

View File

@ -1,5 +1,6 @@
--- dhcp-3.0.5/client/dhclient.c.options 2007-06-15 18:56:41.000000000 -0400 diff -up dhcp-3.0.6/client/dhclient.c.options dhcp-3.0.6/client/dhclient.c
+++ dhcp-3.0.5/client/dhclient.c 2007-06-15 18:56:41.000000000 -0400 --- dhcp-3.0.6/client/dhclient.c.options 2007-08-15 11:19:40.000000000 -0400
+++ dhcp-3.0.6/client/dhclient.c 2007-08-15 11:43:18.000000000 -0400
@@ -38,6 +38,12 @@ static char ocopyright[] = @@ -38,6 +38,12 @@ static char ocopyright[] =
#include "dhcpd.h" #include "dhcpd.h"
#include "version.h" #include "version.h"
@ -13,17 +14,17 @@
TIME default_lease_time = 43200; /* 12 hours... */ TIME default_lease_time = 43200; /* 12 hours... */
TIME max_lease_time = 86400; /* 24 hours... */ TIME max_lease_time = 86400; /* 24 hours... */
@@ -77,6 +83,9 @@ int nowait=0; @@ -74,6 +80,9 @@ int client_env_count=0;
#ifdef EXTENDED_NEW_OPTION_INFO int onetry=0;
int extended_option_environment = 0; int quiet=0;
#endif int nowait=0;
+int bootp_broadcast_always = 0; +int bootp_broadcast_always = 0;
+ +
+extern u_int32_t default_requested_options[]; +extern u_int32_t default_requested_options[];
static void usage PROTO ((void)); static void usage PROTO ((void));
@@ -103,6 +112,15 @@ int main (argc, argv, envp) @@ -100,6 +109,15 @@ int main (argc, argv, envp)
int no_dhclient_pid = 0; int no_dhclient_pid = 0;
int no_dhclient_script = 0; int no_dhclient_script = 0;
char *s; char *s;
@ -39,10 +40,10 @@
/* Make sure we have stdin, stdout and stderr. */ /* Make sure we have stdin, stdout and stderr. */
i = open ("/dev/null", O_RDWR); i = open ("/dev/null", O_RDWR);
@@ -211,6 +229,88 @@ int main (argc, argv, envp) @@ -203,6 +221,88 @@ int main (argc, argv, envp)
extended_option_environment = 1; } else if (!strcmp (argv [i], "--version")) {
new_option_info_tree = GENERATE_NEW_OPTION_INFO; log_info ("isc-dhclient-%s", DHCP_VERSION);
#endif exit (0);
+ } else if (!strcmp (argv [i], "-I")) { + } else if (!strcmp (argv [i], "-I")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) { + if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
+ usage (); + usage ();
@ -128,12 +129,12 @@
} else if (argv [i][0] == '-') { } else if (argv [i][0] == '-') {
usage (); usage ();
} else { } else {
@@ -347,6 +447,170 @@ int main (argc, argv, envp) @@ -339,6 +439,167 @@ int main (argc, argv, envp)
/* Parse the dhclient.conf file. */ /* Parse the dhclient.conf file. */
read_client_conf (); read_client_conf ();
+ /* Parse any extra command line configuration arguments: */ + /* Parse any extra command line configuration arguments: */
+ if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) { + if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
+ arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg); + arg_conf_len = asprintf(&arg_conf, "send dhcp-client-identifier \"%s\";", dhcp_client_identifier_arg);
+ +
+ if ((arg_conf == 0) || (arg_conf_len <= 0)) + if ((arg_conf == 0) || (arg_conf_len <= 0))
@ -177,8 +178,7 @@
+ } + }
+ +
+ if (timeout_arg) { + if (timeout_arg) {
+ if( arg_conf == 0 ) + if (arg_conf == 0) {
+ {
+ arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg); + arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg);
+ +
+ if ((arg_conf == 0) || (arg_conf_len <= 0)) + if ((arg_conf == 0) || (arg_conf_len <= 0))
@ -232,8 +232,8 @@
+ } + }
+ +
+ if (arg_conf) { + if (arg_conf) {
+ if( arg_conf_len == 0 ) + if (arg_conf_len == 0)
+ if( (arg_conf_len = strlen(arg_conf)) == 0 ) + if ((arg_conf_len = strlen(arg_conf)) == 0)
+ /* huh ? cannot happen ! */ + /* huh ? cannot happen ! */
+ log_fatal("Unable to process -I/-H/-F/-T/-V/-R configuration arguments"); + log_fatal("Unable to process -I/-H/-F/-T/-V/-R configuration arguments");
+ +
@ -255,8 +255,6 @@
+ break; + break;
+ +
+ parse_client_statement (cfile, (struct interface_info *)0, &top_level_config); + parse_client_statement (cfile, (struct interface_info *)0, &top_level_config);
+
+
+ } while (1); + } while (1);
+ +
+ if (cfile -> warnings_occurred) + if (cfile -> warnings_occurred)
@ -299,7 +297,7 @@
/* Parse the lease database. */ /* Parse the lease database. */
read_client_leases (); read_client_leases ();
@@ -1924,7 +2188,8 @@ void make_discover (client, lease) @@ -1912,7 +2173,8 @@ void make_discover (client, lease)
client -> packet.xid = random (); client -> packet.xid = random ();
client -> packet.secs = 0; /* filled in by send_discover. */ client -> packet.secs = 0; /* filled in by send_discover. */
@ -309,7 +307,7 @@
client -> packet.flags = 0; client -> packet.flags = 0;
else else
client -> packet.flags = htons (BOOTP_BROADCAST); client -> packet.flags = htons (BOOTP_BROADCAST);
@@ -2008,7 +2273,9 @@ void make_request (client, lease) @@ -1996,7 +2258,9 @@ void make_request (client, lease)
} else { } else {
memset (&client -> packet.ciaddr, 0, memset (&client -> packet.ciaddr, 0,
sizeof client -> packet.ciaddr); sizeof client -> packet.ciaddr);
@ -320,7 +318,7 @@
client -> packet.flags = 0; client -> packet.flags = 0;
else else
client -> packet.flags = htons (BOOTP_BROADCAST); client -> packet.flags = htons (BOOTP_BROADCAST);
@@ -2067,7 +2334,8 @@ void make_decline (client, lease) @@ -2055,7 +2319,8 @@ void make_decline (client, lease)
client -> packet.hops = 0; client -> packet.hops = 0;
client -> packet.xid = client -> xid; client -> packet.xid = client -> xid;
client -> packet.secs = 0; /* Filled in by send_request. */ client -> packet.secs = 0; /* Filled in by send_request. */
@ -330,8 +328,9 @@
client -> packet.flags = 0; client -> packet.flags = 0;
else else
client -> packet.flags = htons (BOOTP_BROADCAST); client -> packet.flags = htons (BOOTP_BROADCAST);
--- dhcp-3.0.5/client/clparse.c.options 2007-06-15 18:56:41.000000000 -0400 diff -up dhcp-3.0.6/client/clparse.c.options dhcp-3.0.6/client/clparse.c
+++ dhcp-3.0.5/client/clparse.c 2007-06-15 18:56:41.000000000 -0400 --- dhcp-3.0.6/client/clparse.c.options 2007-08-15 11:19:40.000000000 -0400
+++ dhcp-3.0.6/client/clparse.c 2007-08-15 11:44:34.000000000 -0400
@@ -81,6 +81,7 @@ isc_result_t read_client_conf () @@ -81,6 +81,7 @@ isc_result_t read_client_conf ()
top_level_config.requested_options = default_requested_options; top_level_config.requested_options = default_requested_options;
top_level_config.omapi_port = -1; top_level_config.omapi_port = -1;
@ -363,20 +362,10 @@
default: default:
lose = 0; lose = 0;
stmt = (struct executable_statement *)0; stmt = (struct executable_statement *)0;
--- dhcp-3.0.5/common/conflex.c.options 2007-06-15 18:56:41.000000000 -0400 diff -up dhcp-3.0.6/includes/dhcpd.h.options dhcp-3.0.6/includes/dhcpd.h
+++ dhcp-3.0.5/common/conflex.c 2007-06-15 18:56:41.000000000 -0400 --- dhcp-3.0.6/includes/dhcpd.h.options 2007-08-15 11:19:40.000000000 -0400
@@ -599,6 +599,8 @@ static enum dhcp_token intern (atom, dfv +++ dhcp-3.0.6/includes/dhcpd.h 2007-08-15 11:45:51.000000000 -0400
return BALANCE; @@ -773,6 +773,9 @@ struct client_config {
if (!strcasecmp (atom + 1, "ound"))
return BOUND;
+ if (!strcasecmp (atom + 1, "ootp-broadcast-always"))
+ return BOOTP_BROADCAST_ALWAYS;
break;
case 'c':
if (!strcasecmp (atom + 1, "ase"))
--- dhcp-3.0.5/includes/dhcpd.h.options 2007-06-15 18:56:41.000000000 -0400
+++ dhcp-3.0.5/includes/dhcpd.h 2007-06-15 18:56:41.000000000 -0400
@@ -767,6 +767,9 @@ struct client_config {
int do_forward_update; /* If nonzero, and if we have the int do_forward_update; /* If nonzero, and if we have the
information we need, update the information we need, update the
A record for the address we get. */ A record for the address we get. */
@ -386,8 +375,9 @@
}; };
/* Per-interface state used in the dhcp client... */ /* Per-interface state used in the dhcp client... */
--- dhcp-3.0.5/includes/dhctoken.h.options 2005-09-22 12:19:57.000000000 -0400 diff -up dhcp-3.0.6/includes/dhctoken.h.options dhcp-3.0.6/includes/dhctoken.h
+++ dhcp-3.0.5/includes/dhctoken.h 2007-06-15 18:56:56.000000000 -0400 --- dhcp-3.0.6/includes/dhctoken.h.options 2005-09-22 12:19:57.000000000 -0400
+++ dhcp-3.0.6/includes/dhctoken.h 2007-08-15 11:46:11.000000000 -0400
@@ -309,7 +309,8 @@ enum dhcp_token { @@ -309,7 +309,8 @@ enum dhcp_token {
DOMAIN_NAME = 613, DOMAIN_NAME = 613,
DO_FORWARD_UPDATE = 614, DO_FORWARD_UPDATE = 614,
@ -398,3 +388,15 @@
}; };
#define is_identifier(x) ((x) >= FIRST_TOKEN && \ #define is_identifier(x) ((x) >= FIRST_TOKEN && \
diff -up dhcp-3.0.6/common/conflex.c.options dhcp-3.0.6/common/conflex.c
--- dhcp-3.0.6/common/conflex.c.options 2007-08-15 11:19:40.000000000 -0400
+++ dhcp-3.0.6/common/conflex.c 2007-08-15 11:45:02.000000000 -0400
@@ -599,6 +599,8 @@ static enum dhcp_token intern (atom, dfv
return BALANCE;
if (!strcasecmp (atom + 1, "ound"))
return BOUND;
+ if (!strcasecmp (atom + 1, "ootp-broadcast-always"))
+ return BOOTP_BROADCAST_ALWAYS;
break;
case 'c':
if (!strcasecmp (atom + 1, "ase"))

View File

@ -13,7 +13,7 @@
Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent
Name: dhcp Name: dhcp
Version: 3.0.6 Version: 3.0.6
Release: 2%{?dist} Release: 3%{?dist}
Epoch: 12 Epoch: 12
License: ISC License: ISC
Group: System Environment/Daemons Group: System Environment/Daemons
@ -34,26 +34,26 @@ Source12: dhcp4client.h
Source13: libdhcp_control.h Source13: libdhcp_control.h
Patch0: %{name}-3.0.5-Makefile.patch Patch0: %{name}-3.0.5-Makefile.patch
Patch5: %{name}-3.0.5-warnings.patch Patch1: %{name}-3.0.5-warnings.patch
Patch10: %{name}-3.0.5-extended-new-option-info.patch Patch2: %{name}-3.0.5-errwarn-message.patch
Patch15: %{name}-3.0.5-errwarn-message.patch Patch3: %{name}-3.0.5-ldap-configuration.patch
Patch20: %{name}-3.0.5-ldap-configuration.patch Patch4: %{name}-3.0.6-memory.patch
Patch25: %{name}-3.0.6-memory.patch Patch5: %{name}-3.0.6-options.patch
Patch30: %{name}-3.0.5-options.patch Patch6: %{name}-3.0.5-release-by-ifup.patch
Patch35: %{name}-3.0.5-release-by-ifup.patch Patch7: %{name}-3.0.5-dhclient-decline-backoff.patch
Patch40: %{name}-3.0.5-dhclient-decline-backoff.patch Patch8: %{name}-3.0.5-enable-timeout-functions.patch
Patch45: %{name}-3.0.5-enable-timeout-functions.patch Patch9: %{name}-3.0.5-inherit-leases.patch
Patch50: %{name}-3.0.5-inherit-leases.patch Patch10: %{name}-3.0.5-unicast-bootp.patch
Patch55: %{name}-3.0.5-unicast-bootp.patch Patch11: %{name}-3.0.5-fast-timeout.patch
Patch60: %{name}-3.0.5-fast-timeout.patch Patch12: %{name}-3.0.5-failover-ports.patch
Patch65: %{name}-3.0.5-failover-ports.patch Patch13: %{name}-3.0.6-dhclient-usage.patch
Patch70: %{name}-3.0.5-dhclient-usage.patch Patch14: %{name}-3.0.5-default-requested-options.patch
Patch75: %{name}-3.0.5-default-requested-options.patch Patch15: %{name}-3.0.5-prototypes.patch
Patch80: %{name}-3.0.5-prototypes.patch Patch16: %{name}-3.0.6-manpages.patch
Patch85: %{name}-3.0.5-manpages.patch Patch17: %{name}-3.0.6-libdhcp4client.patch
Patch90: %{name}-3.0.5-libdhcp4client.patch Patch18: %{name}-3.0.6-xen-checksum.patch
Patch95: %{name}-3.0.6-xen-checksum.patch Patch19: %{name}-3.0.5-dhclient-anycast.patch
Patch100: %{name}-3.0.5-dhclient-anycast.patch Patch20: %{name}-3.0.6-ignore-hyphen-x.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: groff openldap-devel BuildRequires: groff openldap-devel
@ -150,64 +150,60 @@ libdhcp4client.
%patch0 -p1 -b .Makefile %patch0 -p1 -b .Makefile
# Fix up anything that fails -Wall -Werror # Fix up anything that fails -Wall -Werror
%patch5 -p1 -b .warnings %patch1 -p1 -b .warnings
# Extended new option info patch. Adds the -x option to dhclient, which is
# needed for dhcdbd and NetworkManager
%patch10 -p1 -b .enoi
# Replace the standard ISC warning message about requesting help with an # Replace the standard ISC warning message about requesting help with an
# explanation that this is a patched build of ISC DHCP and bugs should be # explanation that this is a patched build of ISC DHCP and bugs should be
# reported through bugzilla.redhat.com # reported through bugzilla.redhat.com
%patch15 -p1 -b .message %patch2 -p1 -b .message
# Add support for dhcpd.conf data in LDAP # Add support for dhcpd.conf data in LDAP
%patch20 -p1 -b .ldap %patch3 -p1 -b .ldap
# Fix memory alignment and initialization problems in common/packet.c # Fix memory alignment and initialization problems in common/packet.c
# Fix buffer overflow in minires library # Fix buffer overflow in minires library
# Init struct sock_prog in common/lpf.c to NULL # Init struct sock_prog in common/lpf.c to NULL
%patch25 -p1 -b .memory %patch4 -p1 -b .memory
# Add more dhclient options (-I, -B, -H, -F, -T, -V, and -R) # Add more dhclient options (-I, -B, -H, -F, -T, -V, and -R)
%patch30 -p1 -b .options %patch5 -p1 -b .options
# Handle releasing interfaces requested by /sbin/ifup # Handle releasing interfaces requested by /sbin/ifup
# pid file is assumed to be /var/run/dhclient-$interface.pid # pid file is assumed to be /var/run/dhclient-$interface.pid
%patch35 -p1 -b .release %patch6 -p1 -b .release
# If we receive a DHCP offer in dhclient and it's DECLINEd in dhclient-script, # If we receive a DHCP offer in dhclient and it's DECLINEd in dhclient-script,
# backoff for an amount of time before trying again # backoff for an amount of time before trying again
%patch40 -p1 -b .decline %patch7 -p1 -b .decline
# Enable cancel_all_timeouts() and relinquish_timeouts() regardless of # Enable cancel_all_timeouts() and relinquish_timeouts() regardless of
# the DEBUG_MEMORY_LEAKAGE_ON_EXIT macro # the DEBUG_MEMORY_LEAKAGE_ON_EXIT macro
%patch45 -p1 -b .etf %patch8 -p1 -b .etf
# Inherit active leases # Inherit active leases
%patch50 -p1 -b .inherit %patch9 -p1 -b .inherit
# Support unicast BOOTP for IBM pSeries systems (and maybe others) # Support unicast BOOTP for IBM pSeries systems (and maybe others)
%patch55 -p1 -b .unicast %patch10 -p1 -b .unicast
# Fast timeout for dhclient # Fast timeout for dhclient
%patch60 -p1 -b .fast %patch11 -p1 -b .fast
# Use the following IANA-registered failover ports: # Use the following IANA-registered failover ports:
# dhcp-failover 647/tcp # dhcp-failover 647/tcp
# dhcp-failover 647/udp # dhcp-failover 647/udp
# dhcp-failover 847/tcp # dhcp-failover 847/tcp
# dhcp-failover 847/udp # dhcp-failover 847/udp
%patch65 -p1 -b .failover %patch12 -p1 -b .failover
# Update the usage screen for dhclient(8) indicating new options # Update the usage screen for dhclient(8) indicating new options
# Use printf() rather than log_info() to display the information # Use printf() rather than log_info() to display the information
# Also, return EXIT_FAILURE when the usage() screen is displayed (stop parsing) # Also, return EXIT_FAILURE when the usage() screen is displayed (stop parsing)
%patch70 -p1 -b .usage %patch13 -p1 -b .usage
# Add NIS domain, NIS servers, and NTP servers to the list of default # Add NIS domain, NIS servers, and NTP servers to the list of default
# requested DHCP options # requested DHCP options
%patch75 -p1 -b .dho %patch14 -p1 -b .dho
# Add missing prototypes to take care of gcc warnings # Add missing prototypes to take care of gcc warnings
# in dst/dst_api.c: add b64_pton() and b64_ntop() # in dst/dst_api.c: add b64_pton() and b64_ntop()
@ -216,7 +212,7 @@ libdhcp4client.
# in minires/res_comp.c: add ns_name_uncompress(), ns_name_compress(), and # in minires/res_comp.c: add ns_name_uncompress(), ns_name_compress(), and
# ns_name_skip() # ns_name_skip()
# in minires/res_init.c: add res_randomid() # in minires/res_init.c: add res_randomid()
%patch80 -p1 -b .prototypes %patch15 -p1 -b .prototypes
# Man page updates explaining new features added from the above patches. # Man page updates explaining new features added from the above patches.
# Normally these man page changes would be included in the feature patch, # Normally these man page changes would be included in the feature patch,
@ -226,16 +222,19 @@ libdhcp4client.
# and not affect the code changes in the other patches. It's actually # and not affect the code changes in the other patches. It's actually
# pretty common to update or alter these man pages independent of the code # pretty common to update or alter these man pages independent of the code
# changes. # changes.
%patch85 -p1 -b .manpages %patch16 -p1 -b .manpages
# Add the libdhcp4client target (library version of dhclient) # Add the libdhcp4client target (library version of dhclient)
%patch90 -p1 -b .libdhcp4client %patch17 -p1 -b .libdhcp4client
# Handle Xen partial UDP checksums # Handle Xen partial UDP checksums
%patch95 -p1 -b .xen %patch18 -p1 -b .xen
# Add anycast support to dhclient (for OLPC) # Add anycast support to dhclient (for OLPC)
%patch100 -p1 -b .anycast %patch19 -p1 -b .anycast
# Ignore the old extended new option info command line switch (-x)
%patch20 -p1 -b .enoi
# Copy in documentation and example scripts for LDAP patch to dhcpd # Copy in documentation and example scripts for LDAP patch to dhcpd
%{__install} -p -m 0644 %SOURCE6 . %{__install} -p -m 0644 %SOURCE6 .
@ -293,9 +292,8 @@ EOF
COPTS="-fPIC -Werror -Dlint -fno-strict-aliasing" COPTS="-fPIC -Werror -Dlint -fno-strict-aliasing"
# DO NOT use the %%configure macro because this configure script is not autognu # DO NOT use the %%configure macro because this configure script is not autognu
# Enable extended option info patch (-DEXTENDED_NEW_OPTION_INFO)
CC="%{__cc}" ./configure \ CC="%{__cc}" ./configure \
--copts "$RPM_OPT_FLAGS $COPTS %{?bigptrs} -DEXTENDED_NEW_OPTION_INFO" \ --copts "$RPM_OPT_FLAGS $COPTS %{?bigptrs}" \
--work-dir %{workdir} --work-dir %{workdir}
%{__sed} 's/@DHCP_VERSION@/%{version}/' < %SOURCE5 > libdhcp4client.pc %{__sed} 's/@DHCP_VERSION@/%{version}/' < %SOURCE5 > libdhcp4client.pc
@ -433,6 +431,10 @@ fi
%{_libdir}/libdhcp4client.a %{_libdir}/libdhcp4client.a
%changelog %changelog
* Wed Aug 15 2007 David Cantrell <dcantrell@redhat.com> - 12:3.0.6-3
- Remove the -x switch enabling extended new option info. If given to
dhclient now, it's ignored.
* Wed Jul 18 2007 Florian La Roche <laroche@redhat.com> - 12:3.0.6-2 * Wed Jul 18 2007 Florian La Roche <laroche@redhat.com> - 12:3.0.6-2
- use a new macro name vendor -> vvendor to not overwrite the - use a new macro name vendor -> vvendor to not overwrite the
RPMTAG_VENDOR setting RPMTAG_VENDOR setting