rpms/dhcp/devel dhcp-4.0.0-default-requested-options.patch, 1.2, 1.3 dhcp-4.0.0-dhclient-anycast.patch, 1.2, 1.3 dhcp-4.0.0-dhclient-usage.patch, 1.2, 1.3 dhcp-4.0.0-fast-timeout.patch, 1.2, 1.3 dhcp-4.0.0-ldap-configuration.patch, 1.2, 1.3 dhcp-4.0.0-libdhcp4client.patch, 1.2, 1.3 dhcp-4.0.0-manpages.patch, 1.2, 1.3 dhcp-4.0.0-options.patch, 1.2, 1.3 dhcp-4.0.0-paths.patch, 1.2, 1.3 dhcp-4.0.0-server-Makefile.patch, NONE, 1.1 dhcp-4.0.0-xen-checksum.patch, 1.2, 1.3 .cvsignore, 1.21, 1.22 dhcp.spec, 1.191, 1.192 sources, 1.22, 1.23 Makefile.libdhcp4client, 1.4, NONE dhclient-script.8, 1.4, NONE dhclient.8, 1.4, NONE dhclient.conf.5, 1.4, NONE dhcp-3.0.5-Makefile.patch, 1.5, NONE dhcp-3.0.5-default-requested-options.patch, 1.3, NONE dhcp-3.0.5-fast-timeout.patch, 1.3, NONE dhcp-3.0.5-inherit-leases.patch, 1.3, NONE dhcp-3.0.5-prototypes.patch, 1.3, NONE dhcp-3.0.6-ignore-hyphen-x.patch, 1.3, NONE dhcp-3.1.0-dhclient-anycast.patch, 1.3, NONE dhcp-3.1.0-dhclient-usage.patch, 1.3, NONE dhcp-3.1.0-ldap-configuration.patch, 1.4, NONE dhcp-3.1.0-libdhcp4client.patch, 1.4, NONE dhcp-3.1.0-options.patch, 1.3, NONE dhcp-3.1.0-warnings.patch, 1.4, NONE dhcp-3.1.0-xen-checksum.patch, 1.3, NONE dhcp-options.5, 1.4, NONE dhcpctl.3, 1.3, NONE dhcpd.conf, 1.3, NONE dhcpd.conf.5, 1.4, NONE dhcpd.conf.sample, 1.6, NONE

David Cantrell (dcantrel) fedora-extras-commits at redhat.com
Sun Jan 13 21:02:59 UTC 2008


Author: dcantrel

Update of /cvs/pkgs/rpms/dhcp/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv32261

Modified Files:
	.cvsignore dhcp.spec sources 
Added Files:
	dhcp-4.0.0-default-requested-options.patch 
	dhcp-4.0.0-dhclient-anycast.patch 
	dhcp-4.0.0-dhclient-usage.patch dhcp-4.0.0-fast-timeout.patch 
	dhcp-4.0.0-ldap-configuration.patch 
	dhcp-4.0.0-libdhcp4client.patch dhcp-4.0.0-manpages.patch 
	dhcp-4.0.0-options.patch dhcp-4.0.0-paths.patch 
	dhcp-4.0.0-server-Makefile.patch dhcp-4.0.0-xen-checksum.patch 
Removed Files:
	Makefile.libdhcp4client dhclient-script.8 dhclient.8 
	dhclient.conf.5 dhcp-3.0.5-Makefile.patch 
	dhcp-3.0.5-default-requested-options.patch 
	dhcp-3.0.5-fast-timeout.patch dhcp-3.0.5-inherit-leases.patch 
	dhcp-3.0.5-prototypes.patch dhcp-3.0.6-ignore-hyphen-x.patch 
	dhcp-3.1.0-dhclient-anycast.patch 
	dhcp-3.1.0-dhclient-usage.patch 
	dhcp-3.1.0-ldap-configuration.patch 
	dhcp-3.1.0-libdhcp4client.patch dhcp-3.1.0-options.patch 
	dhcp-3.1.0-warnings.patch dhcp-3.1.0-xen-checksum.patch 
	dhcp-options.5 dhcpctl.3 dhcpd.conf dhcpd.conf.5 
	dhcpd.conf.sample 
Log Message:
* Sun Jan 13 2008 David Cantrell <dcantrell at redhat.com> - 12:4.0.0-1
- Upgrade to ISC dhcp-4.0.0 (#426634)
     - first ISC release to incorporate DHCPv6 protocol support
     - source tree now uses GNU autoconf/automake
- Removed the libdhcp4client-static package


dhcp-4.0.0-default-requested-options.patch:

Index: dhcp-4.0.0-default-requested-options.patch
===================================================================
RCS file: dhcp-4.0.0-default-requested-options.patch
diff -N dhcp-4.0.0-default-requested-options.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ dhcp-4.0.0-default-requested-options.patch	13 Jan 2008 21:02:47 -0000	1.3
@@ -0,0 +1,34 @@
+diff -up dhcp-4.0.0/client/clparse.c.dho dhcp-4.0.0/client/clparse.c
+--- dhcp-4.0.0/client/clparse.c.dho	2007-12-29 06:32:16.000000000 -1000
++++ dhcp-4.0.0/client/clparse.c	2007-12-29 06:35:41.000000000 -1000
+@@ -37,7 +37,7 @@
+ 
+ struct client_config top_level_config;
+ 
+-#define NUM_DEFAULT_REQUESTED_OPTS	9
++#define NUM_DEFAULT_REQUESTED_OPTS	12
+ struct option *default_requested_options[NUM_DEFAULT_REQUESTED_OPTS + 1];
+ 
+ static void parse_client_default_duid(struct parse *cfile);
+@@ -107,6 +107,21 @@ isc_result_t read_client_conf ()
+ 	option_code_hash_lookup(&default_requested_options[8],
+ 				dhcpv6_universe.code_hash, &code, 0, MDL);
+ 
++	/* 10 */
++	code = DHO_NIS_DOMAIN;
++	option_code_hash_lookup(&default_requested_options[9],
++				dhcp_universe.code_hash, &code, 0, MDL);
++
++	/* 11 */
++	code = DHO_NIS_SERVERS;
++	option_code_hash_lookup(&default_requested_options[10],
++				dhcp_universe.code_hash, &code, 0, MDL);
++
++	/* 12 */
++	code = DHO_NTP_SERVERS;
++	option_code_hash_lookup(&default_requested_options[11],
++				dhcp_universe.code_hash, &code, 0, MDL);
++
+ 	for (code = 0 ; code < NUM_DEFAULT_REQUESTED_OPTS ; code++) {
+ 		if (default_requested_options[code] == NULL)
+ 			log_fatal("Unable to find option definition for "

dhcp-4.0.0-dhclient-anycast.patch:

Index: dhcp-4.0.0-dhclient-anycast.patch
===================================================================
RCS file: dhcp-4.0.0-dhclient-anycast.patch
diff -N dhcp-4.0.0-dhclient-anycast.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ dhcp-4.0.0-dhclient-anycast.patch	13 Jan 2008 21:02:47 -0000	1.3
@@ -0,0 +1,70 @@
+diff -up dhcp-4.0.0/common/lpf.c.anycast dhcp-4.0.0/common/lpf.c
+--- dhcp-4.0.0/common/lpf.c.anycast	2007-12-29 06:44:46.000000000 -1000
++++ dhcp-4.0.0/common/lpf.c	2007-12-29 10:40:11.000000000 -1000
+@@ -331,6 +331,9 @@ ssize_t send_packet (interface, packet, 
+ 		return send_fallback (interface, packet, raw,
+ 				      len, from, to, hto);
+ 
++	if (hto == NULL && interface->anycast_mac_addr.hlen)
++		hto = &interface->anycast_mac_addr;
++
+ 	/* Assemble the headers... */
+ 	assemble_hw_header (interface, (unsigned char *)hh, &hbufp, hto);
+ 	fudge = hbufp % 4;	/* IP header must be word-aligned. */
+diff -up dhcp-4.0.0/common/conflex.c.anycast dhcp-4.0.0/common/conflex.c
+--- dhcp-4.0.0/common/conflex.c.anycast	2007-12-29 06:44:46.000000000 -1000
++++ dhcp-4.0.0/common/conflex.c	2007-12-29 10:39:30.000000000 -1000
+@@ -715,6 +715,8 @@ intern(char *atom, enum dhcp_token dfv) 
+ 		}
+ 		if (!strcasecmp (atom + 1, "nd"))
+ 			return AND;
++		if (!strcasecmp (atom + 1, "nycast-mac"))
++			return ANYCAST_MAC;
+ 		if (!strcasecmp (atom + 1, "ppend"))
+ 			return APPEND;
+ 		if (!strcasecmp (atom + 1, "llow"))
+diff -up dhcp-4.0.0/includes/dhcpd.h.anycast dhcp-4.0.0/includes/dhcpd.h
+--- dhcp-4.0.0/includes/dhcpd.h.anycast	2007-12-29 06:44:46.000000000 -1000
++++ dhcp-4.0.0/includes/dhcpd.h	2007-12-29 10:42:56.000000000 -1000
+@@ -1188,6 +1188,7 @@ struct interface_info {
+ 	int dlpi_sap_length;
+ 	struct hardware dlpi_broadcast_addr;
+ # endif /* DLPI_SEND || DLPI_RECEIVE */
++	struct hardware anycast_mac_addr;
+ };
+ 
+ struct hardware_link {
+diff -up dhcp-4.0.0/includes/dhctoken.h.anycast dhcp-4.0.0/includes/dhctoken.h
+--- dhcp-4.0.0/includes/dhctoken.h.anycast	2007-12-29 06:44:46.000000000 -1000
++++ dhcp-4.0.0/includes/dhctoken.h	2007-12-29 10:44:00.000000000 -1000
+@@ -346,7 +346,8 @@ enum dhcp_token {
+ 	WHITESPACE = 649,
+ 	TOKEN_ALSO = 650,
+ 	AFTER = 651,
+-	BOOTP_BROADCAST_ALWAYS = 652
++	BOOTP_BROADCAST_ALWAYS = 652,
++	ANYCAST_MAC = 653
+ };
+ 
+ #define is_identifier(x)	((x) >= FIRST_TOKEN &&	\
+diff -up dhcp-4.0.0/client/clparse.c.anycast dhcp-4.0.0/client/clparse.c
+--- dhcp-4.0.0/client/clparse.c.anycast	2007-12-29 06:44:46.000000000 -1000
++++ dhcp-4.0.0/client/clparse.c	2007-12-29 10:38:55.000000000 -1000
+@@ -550,6 +550,17 @@ void parse_client_statement (cfile, ip, 
+ 		}
+ 		return;
+ 
++	      case ANYCAST_MAC:
++		token = next_token (&val, (unsigned *)0, cfile);
++		if (ip) {
++			parse_hardware_param (cfile, &ip -> anycast_mac_addr);
++		} else {
++			parse_warn (cfile, "anycast mac address parameter %s",
++			            "not allowed here.");
++			skip_to_semi (cfile);
++		}
++		return;
++
+ 	      case REQUEST:
+ 		token = next_token (&val, (unsigned *)0, cfile);
+ 		if (config -> requested_options == default_requested_options)

dhcp-4.0.0-dhclient-usage.patch:

Index: dhcp-4.0.0-dhclient-usage.patch
===================================================================
RCS file: dhcp-4.0.0-dhclient-usage.patch
diff -N dhcp-4.0.0-dhclient-usage.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ dhcp-4.0.0-dhclient-usage.patch	13 Jan 2008 21:02:47 -0000	1.3
@@ -0,0 +1,43 @@
+diff -up dhcp-4.0.0/client/dhclient.c.usage dhcp-4.0.0/client/dhclient.c
+--- dhcp-4.0.0/client/dhclient.c.usage	2007-12-31 18:05:29.000000000 -1000
++++ dhcp-4.0.0/client/dhclient.c	2007-12-31 18:05:43.000000000 -1000
+@@ -893,21 +893,30 @@ main(int argc, char **argv) {
+ 
+ static void usage ()
+ {
+-	log_info ("%s %s", message, PACKAGE_VERSION);
+-	log_info (copyright);
+-	log_info (arr);
+-	log_info (url);
++	printf ("%s %s", message, PACKAGE_VERSION);
++	printf (copyright);
++	printf ("\n");
++	printf (arr);
++	printf ("\n");
++	printf (url);
++	printf ("\n");
+ 
+-	log_error ("Usage: dhclient %s %s",
++	printf ("Usage: dhclient %s %s",
+ #ifdef DHCPv6
+                    "[-4|-6] [-1dvrx] [-nw] [-p <port>]",
+ #else /* DHCPv6 */
+                    "[-1dvrx] [-nw] [-p <port>]",
+ #endif /* DHCPv6 */
+-		   "[-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]\n");
++	printf ("                [-cf config-file] [-lf lease-file]%s",
++		   "[-pf pid-file] [-e VAR=val]\n");
++	printf ("                [ -I <dhcp-client-identifier> ] [-B]\n");
++	printf ("                [ -H <host-name> | -F <fqdn.fqdn> ] [ -T <timeout> ]\n");
++	printf ("                [ -V <vendor-class-identifier> ]\n");
++	printf ("                [ -R <request option list> ]\n");
++	printf ("                [-sf script-file] [interface]\n");
++
++	exit (EXIT_FAILURE);
+ }
+ 
+ isc_result_t find_class (struct class **c,

dhcp-4.0.0-fast-timeout.patch:

Index: dhcp-4.0.0-fast-timeout.patch
===================================================================
RCS file: dhcp-4.0.0-fast-timeout.patch
diff -N dhcp-4.0.0-fast-timeout.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ dhcp-4.0.0-fast-timeout.patch	13 Jan 2008 21:02:47 -0000	1.3
@@ -0,0 +1,15 @@
+diff -up dhcp-4.0.0/client/dhclient.c.fast dhcp-4.0.0/client/dhclient.c
+--- dhcp-4.0.0/client/dhclient.c.fast	2007-12-29 06:07:14.000000000 -1000
++++ dhcp-4.0.0/client/dhclient.c	2007-12-29 06:08:07.000000000 -1000
+@@ -3624,10 +3624,7 @@ isc_result_t dhclient_interface_startup_
+ 		ip -> flags |= INTERFACE_RUNNING;
+ 		for (client = ip -> client; client; client = client -> next) {
+ 			client -> state = S_INIT;
+-			/* Set up a timeout to start the initialization
+-			   process. */
+-			add_timeout (cur_time + random () % 5,
+-				     state_reboot, client, 0, 0);
++			add_timeout (cur_time, state_reboot, client, 0, 0);
+ 		}
+ 	}
+ 	return ISC_R_SUCCESS;

dhcp-4.0.0-ldap-configuration.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.2 -r 1.3 dhcp-4.0.0-ldap-configuration.patch
Index: dhcp-4.0.0-ldap-configuration.patch
===================================================================
RCS file: dhcp-4.0.0-ldap-configuration.patch
diff -N dhcp-4.0.0-ldap-configuration.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ dhcp-4.0.0-ldap-configuration.patch	13 Jan 2008 21:02:47 -0000	1.3
@@ -0,0 +1,2677 @@
+diff -up dhcp-4.0.0/server/Makefile.am.ldap dhcp-4.0.0/server/Makefile.am
+--- dhcp-4.0.0/server/Makefile.am.ldap	2007-05-29 06:32:11.000000000 -1000
++++ dhcp-4.0.0/server/Makefile.am	2008-01-11 17:45:47.000000000 -1000
+@@ -4,12 +4,12 @@ dist_sysconf_DATA = dhcpd.conf
+ sbin_PROGRAMS = dhcpd
+ dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \
+ 		omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c \
+-		dhcpv6.c mdb6.c
++		dhcpv6.c mdb6.c ldap.c ldap_casa.c
+ 
+ # libomapi.a this is here twice to handle circular library dependencies :(
+ dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a ../dst/libdst.a \
+ 	      ../dhcpctl/libdhcpctl.a ../minires/libres.a \
+-	      ../omapip/libomapi.a
++	      ../omapip/libomapi.a -lldap
+ 
+ man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
+ EXTRA_DIST = $(man_MANS)
+diff -up dhcp-4.0.0/server/mdb.c.ldap dhcp-4.0.0/server/mdb.c
+--- dhcp-4.0.0/server/mdb.c.ldap	2007-11-30 11:51:43.000000000 -1000
++++ dhcp-4.0.0/server/mdb.c	2008-01-11 17:45:28.000000000 -1000
+@@ -600,6 +600,12 @@ int find_hosts_by_haddr (struct host_dec
+ 			 const char *file, int line)
+ {
+ 	struct hardware h;
++	int ret;
++
++#if defined(LDAP_CONFIGURATION)
++	if ((ret = find_haddr_in_ldap (hp, htype, hlen, haddr, file, line)))
++		return ret;
++#endif
+ 
+ 	h.hlen = hlen + 1;
+ 	h.hbuf [0] = htype;
+diff -up /dev/null dhcp-4.0.0/server/ldap_casa.c
+--- /dev/null	2008-01-11 10:40:59.147013395 -1000
++++ dhcp-4.0.0/server/ldap_casa.c	2008-01-11 17:45:28.000000000 -1000
+@@ -0,0 +1,138 @@
++/* ldap_casa.c
++   
++   CASA routines for DHCPD... */
++
++/* Copyright (c) 2004 Internet Systems Consorium, Inc. ("ISC")
++ * Copyright (c) 1995-2003 Internet Software Consortium.
++ * Copyright (c) 2006 Novell, Inc.
++
++ * All rights reserved.
++ * Redistribution and use in source and binary forms, with or without 
++ * modification, are permitted provided that the following conditions are met: 
++ * 1.Redistributions of source code must retain the above copyright notice, 
++ *   this list of conditions and the following disclaimer. 
++ * 2.Redistributions in binary form must reproduce the above copyright notice, 
++ *   this list of conditions and the following disclaimer in the documentation 
++ *   and/or other materials provided with the distribution. 
++ * 3.Neither the name of ISC, ISC DHCP, nor the names of its contributors 
++ *   may be used to endorse or promote products derived from this software 
++ *   without specific prior written permission. 
++
++ * THIS SOFTWARE IS PROVIDED BY INTERNET SYSTEMS CONSORTIUM AND CONTRIBUTORS 
++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ISC OR CONTRIBUTORS BE LIABLE 
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
++ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
++ * POSSIBILITY OF SUCH DAMAGE.
++
++ * This file was written by S Kalyanasundaram <skalyanasundaram at novell.com>
++ */
++
++#if defined(LDAP_CASA_AUTH)
++#include "ldap_casa.h"
++#include "dhcpd.h"
++
++int
++load_casa (void)
++{
++       if( !(casaIDK = dlopen(MICASA_LIB,RTLD_LAZY)))
++       	  return 0;
++       p_miCASAGetCredential = (CASA_GetCredential_T) dlsym(casaIDK, "miCASAGetCredential");
++       p_miCASASetCredential = (CASA_SetCredential_T) dlsym(casaIDK, "miCASASetCredential");
++       p_miCASARemoveCredential = (CASA_RemoveCredential_T) dlsym(casaIDK, "miCASARemoveCredential");
++
++       if((p_miCASAGetCredential == NULL) ||
++         (p_miCASASetCredential == NULL) ||
++         (p_miCASARemoveCredential == NULL))
++       {
++          if(casaIDK)
++            dlclose(casaIDK);
++          casaIDK = NULL;
++          p_miCASAGetCredential = NULL;
++          p_miCASASetCredential = NULL;
++          p_miCASARemoveCredential = NULL;
++          return 0;
++       }
++       else
++          return 1;
++}
++
++static void
++release_casa(void)
++{
++   if(casaIDK)
++   {
++      dlclose(casaIDK);
++      casaIDK = NULL;
++   }
++
++   p_miCASAGetCredential = NULL;
++   p_miCASASetCredential = NULL;
++   p_miCASARemoveCredential = NULL;
++
++}
++
++int
++load_uname_pwd_from_miCASA (char **ldap_username, char **ldap_password)
++ {
++   int                     result = 0;
++   uint32_t                credentialtype = SSCS_CRED_TYPE_SERVER_F;
++   SSCS_BASIC_CREDENTIAL   credential;
++   SSCS_SECRET_ID_T        applicationSecretId;
++   char                    *tempVar = NULL;
++
++   const char applicationName[10] = "dhcp-ldap";
++
++   if ( load_casa() )
++   {
++      memset(&credential, 0, sizeof(SSCS_BASIC_CREDENTIAL));
++      memset(&applicationSecretId, 0, sizeof(SSCS_SECRET_ID_T));
++
++      applicationSecretId.len = strlen(applicationName) + 1;
++      memcpy (applicationSecretId.id, applicationName, applicationSecretId.len);
++
++      credential.unFlags = USERNAME_TYPE_CN_F;
++
++      result = p_miCASAGetCredential (0,
++                 &applicationSecretId,NULL,&credentialtype,
++                 &credential,NULL);
++
++      if(credential.unLen)
++      {
++         tempVar = dmalloc (credential.unLen + 1, MDL);
++         if (!tempVar)
++             log_fatal ("no memory for ldap_username");
++         memcpy(tempVar , credential.username, credential.unLen);
++         *ldap_username = tempVar;
++
++         tempVar = dmalloc (credential.pwordLen + 1, MDL);
++         if (!tempVar)
++             log_fatal ("no memory for ldap_password");
++         memcpy(tempVar, credential.password, credential.pwordLen);
++         *ldap_password = tempVar;
++
++#if defined (DEBUG_LDAP)
++         log_info ("Authentication credential taken from CASA");
++#endif
++
++         release_casa();
++         return 1;
++
++        }
++        else
++        {
++            release_casa();
++            return 0;
++        }
++      }
++      else
++          return 0; //casa libraries not loaded
++ }
++
++#endif /* LDAP_CASA_AUTH */
++
+diff -up dhcp-4.0.0/server/dhcpd.c.ldap dhcp-4.0.0/server/dhcpd.c
+--- dhcp-4.0.0/server/dhcpd.c.ldap	2007-11-30 11:51:43.000000000 -1000
++++ dhcp-4.0.0/server/dhcpd.c	2008-01-11 17:45:28.000000000 -1000
+@@ -505,6 +505,14 @@ main(int argc, char **argv) {
+ 	/* Add the ddns update style enumeration prior to parsing. */
+ 	add_enumeration (&ddns_styles);
+ 	add_enumeration (&syslog_enum);
++#if defined (LDAP_CONFIGURATION)
++	add_enumeration (&ldap_methods);
++#if defined (USE_SSL)
++	add_enumeration (&ldap_ssl_usage_enum);
++	add_enumeration (&ldap_tls_reqcert_enum);
++	add_enumeration (&ldap_tls_crlcheck_enum);
++#endif
++#endif
+ 
+ 	if (!group_allocate (&root_group, MDL))
[...2284 lines suppressed...]
+ };
+ 
+ /* Variable-length array of data. */
+@@ -421,6 +428,32 @@ struct hardware {
+ 	u_int8_t hbuf [17];
+ };
+ 
++#if defined(LDAP_CONFIGURATION)
++# define LDAP_BUFFER_SIZE		8192
++# define LDAP_METHOD_STATIC		0
++# define LDAP_METHOD_DYNAMIC	1
++#if defined (USE_SSL)
++# define LDAP_SSL_OFF			0
++# define LDAP_SSL_ON			1
++# define LDAP_SSL_TLS			2
++# define LDAP_SSL_LDAPS			3
++#endif
++
++/* This is a tree of the current configuration we are building from LDAP */
++struct ldap_config_stack {
++	LDAPMessage * res;	/* Pointer returned from ldap_search */
++	LDAPMessage * ldent;	/* Current item in LDAP that we're processing.
++							in res */
++	int close_brace;	/* Put a closing } after we're through with
++						this item */
++	int processed;	/* We set this flag if this base item has been
++					processed. After this base item is processed,
++					we can start processing the children */
++	struct ldap_config_stack *children;
++	struct ldap_config_stack *next;
++};
++#endif
++
+ typedef enum {
+ 	server_startup = 0,
+ 	server_running = 1,
+@@ -626,6 +659,29 @@ struct lease_state {
+ # define DEFAULT_PING_TIMEOUT 1
+ #endif
+ 
++#if defined(LDAP_CONFIGURATION)
++# define SV_LDAP_SERVER				47
++# define SV_LDAP_PORT				48
++# define SV_LDAP_USERNAME			49
++# define SV_LDAP_PASSWORD			50
++# define SV_LDAP_BASE_DN			51
++# define SV_LDAP_METHOD				52
++# define SV_LDAP_DEBUG_FILE			53
++# define SV_LDAP_DHCP_SERVER_CN		54
++# define SV_LDAP_REFERRALS			55
++#if defined (USE_SSL)
++# define SV_LDAP_SSL				56
++# define SV_LDAP_TLS_REQCERT		57
++# define SV_LDAP_TLS_CA_FILE		58
++# define SV_LDAP_TLS_CA_DIR			59
++# define SV_LDAP_TLS_CERT			60
++# define SV_LDAP_TLS_KEY			61
++# define SV_LDAP_TLS_CRLCHECK		62
++# define SV_LDAP_TLS_CIPHERS		63
++# define SV_LDAP_TLS_RANDFILE		64
++#endif
++#endif
++
+ #if !defined (DEFAULT_DEFAULT_LEASE_TIME)
+ # define DEFAULT_DEFAULT_LEASE_TIME 43200
+ #endif
+@@ -2035,7 +2091,7 @@ extern int db_time_format;
+ char *quotify_string (const char *, const char *, int);
+ char *quotify_buf (const unsigned char *, unsigned, const char *, int);
+ char *print_base64 (const unsigned char *, unsigned, const char *, int);
+-char *print_hw_addr PROTO ((int, int, unsigned char *));
++char *print_hw_addr PROTO ((const int, const int, const unsigned char *));
+ void print_lease PROTO ((struct lease *));
+ void dump_raw PROTO ((const unsigned char *, unsigned));
+ void dump_packet_option (struct option_cache *, struct packet *,
+@@ -3158,6 +3214,20 @@ OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_l
+ 
+ const char *binding_state_print (enum failover_state);
+ 
++/* ldap.c */
++#if defined(LDAP_CONFIGURATION)
++extern struct enumeration ldap_methods;
++#if defined (USE_SSL)
++extern struct enumeration ldap_ssl_usage_enum;
++extern struct enumeration ldap_tls_reqcert_enum;
++extern struct enumeration ldap_tls_crlcheck_enum;
++#endif
++isc_result_t ldap_read_config (void);
++int find_haddr_in_ldap (struct host_decl **, int, unsigned,
++                        const unsigned char *, const char *, int);
++int find_subclass_in_ldap (struct class *, struct class **,
++                           struct data_string *);
++#endif
+ 
+ /* mdb6.c */
+ HASH_FUNCTIONS_DECL(ia_na, unsigned char *, struct ia_na, ia_na_hash_t);
+diff -up dhcp-4.0.0/includes/site.h.ldap dhcp-4.0.0/includes/site.h
+--- dhcp-4.0.0/includes/site.h.ldap	2006-07-31 12:19:51.000000000 -1000
++++ dhcp-4.0.0/includes/site.h	2008-01-11 17:45:28.000000000 -1000
+@@ -183,3 +183,13 @@
+    traces. */
+ 
+ #define TRACING
++
++/* Define this if you want to read your config from LDAP. Read README.ldap
++   about how to set this up */
++
++#define LDAP_CONFIGURATION
++
++/* Define this if you want to enable LDAP over a SSL connection. You will need
++   to add -lcrypto -lssl to the LIBS= line of server/Makefile */
++
++#define USE_SSL
+diff -up /dev/null dhcp-4.0.0/includes/ldap_casa.h
+--- /dev/null	2008-01-11 10:40:59.147013395 -1000
++++ dhcp-4.0.0/includes/ldap_casa.h	2008-01-11 17:45:28.000000000 -1000
+@@ -0,0 +1,83 @@
++/* ldap_casa.h
++   
++   Definition for CASA modules... */
++
++/* Copyright (c) 2004 Internet Systems Consorium, Inc. ("ISC")
++ * Copyright (c) 1995-2003 Internet Software Consortium.
++ * Copyright (c) 2006 Novell, Inc.
++
++ * All rights reserved.
++ * Redistribution and use in source and binary forms, with or without 
++ * modification, are permitted provided that the following conditions are met: 
++ * 1.Redistributions of source code must retain the above copyright notice, 
++ *   this list of conditions and the following disclaimer. 
++ * 2.Redistributions in binary form must reproduce the above copyright notice, 
++ *   this list of conditions and the following disclaimer in the documentation 
++ *   and/or other materials provided with the distribution. 
++ * 3.Neither the name of ISC, ISC DHCP, nor the names of its contributors 
++ *   may be used to endorse or promote products derived from this software 
++ *   without specific prior written permission. 
++
++ * THIS SOFTWARE IS PROVIDED BY INTERNET SYSTEMS CONSORTIUM AND CONTRIBUTORS 
++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ISC OR CONTRIBUTORS BE LIABLE 
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
++ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
++ * POSSIBILITY OF SUCH DAMAGE.
++
++ * This file was written by S Kalyanasundaram <skalyanasundaram at novell.com>
++ */
++
++#if defined(LDAP_CASA_AUTH)
++#ifndef __LDAP_CASA_H__
++#define __LDAP_CASA_H__
++
++#include <micasa_mgmd.h>
++#include <dlfcn.h>
++#include <string.h>
++
++#define MICASA_LIB     "libmicasa.so.1"
++
++SSCS_TYPEDEF_LIBCALL(int, CASA_GetCredential_T)
++(
++       uint32_t            ssFlags,
++       SSCS_SECRET_ID_T   *appSecretID,
++       SSCS_SECRET_ID_T   *sharedSecretID,
++       uint32_t           *credentialType,
++       void               *credential,
++       SSCS_EXT_T         *ext 
++);
++SSCS_TYPEDEF_LIBCALL(int, CASA_SetCredential_T)
++(
++       uint32_t            ssFlags,
++       SSCS_SECRET_ID_T   *appSecretID,
++       SSCS_SECRET_ID_T   *sharedSecretID,
++       uint32_t            credentialType,
++       void               *credential,
++       SSCS_EXT_T         *ext
++);
++
++SSCS_TYPEDEF_LIBCALL(int, CASA_RemoveCredential_T)
++(
++       uint32_t            ssFlags,
++       SSCS_SECRET_ID_T   *appSecretID,
++       SSCS_SECRET_ID_T   *sharedSecretID,
++       SSCS_EXT_T         *ext
++);
++static CASA_GetCredential_T            p_miCASAGetCredential = NULL;
++static CASA_SetCredential_T            p_miCASASetCredential = NULL;
++static CASA_RemoveCredential_T         p_miCASARemoveCredential = NULL;
++static void                            *casaIDK = NULL;
++
++int load_casa(void);
++static void release_casa(void);
++int load_uname_pwd_from_miCASA(char **, char **);
++
++#endif /* __LDAP_CASA_H__ */
++#endif /* LDAP_CASA_AUTH */
++

dhcp-4.0.0-libdhcp4client.patch:

Index: dhcp-4.0.0-libdhcp4client.patch
===================================================================
RCS file: dhcp-4.0.0-libdhcp4client.patch
diff -N dhcp-4.0.0-libdhcp4client.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ dhcp-4.0.0-libdhcp4client.patch	13 Jan 2008 21:02:47 -0000	1.3
@@ -0,0 +1,1206 @@
+diff -up dhcp-4.0.0/configure.ac.libdhcp4client dhcp-4.0.0/configure.ac
+--- dhcp-4.0.0/configure.ac.libdhcp4client	2007-12-14 08:24:56.000000000 -1000
++++ dhcp-4.0.0/configure.ac	2008-01-12 17:19:29.000000000 -1000
+@@ -1,5 +1,32 @@
+ AC_INIT([DHCP], [4.0.0], [dhcp-users at isc.org])
+ 
++dnl Versioning
++dnl (from glib's configure.in ...)
++dnl Making releases:
++dnl     DHCP_MICRO_VERSION += 1;
++dnl     DHCP_INTERFACE_AGE += 1;
++dnl     DHCP_BINARY_AGE += 1;
++dnl if any functions have been added, set DHCP_INTERFACE_AGE to 0.
++dnl if backwards compatibility has been broken (e.g., functions removed,
++dnl function signatures changed),
++dnl set DHCP_BINARY_AGE and DHCP_INTERFACE_AGE to 0.
++DHCP_MAJOR_VERSION=4
++DHCP_MINOR_VERSION=0
++DHCP_MICRO_VERSION=0
++DHCP_INTERFACE_AGE=0
++DHCP_BINARY_AGE=0
++DHCP_VERSION_SUFFIX=
++DHCP_VERSION=$DHCP_MAJOR_VERSION.$DHCP_MINOR_VERSION.$DHCP_MICRO_VERSION$DHCP_VERSION_SUFFIX
++
++LT_RELEASE=$DHCP_MAJOR_VERSION.$DHCP_MINOR_VERSION
++LT_CURRENT=`expr $DHCP_MICRO_VERSION - $DHCP_INTERFACE_AGE`
++LT_REVISION=$DHCP_INTERFACE_AGE
++AC_SUBST(DHCP_VERSION)
++AC_SUBST(LT_RELEASE)
++AC_SUBST(LT_CURRENT)
++AC_SUBST(LT_REVISION)
++AC_SUBST(LT_AGE)
++
+ # we specify "foreign" to avoid having to have the GNU mandated files,
+ # like AUTHORS, COPYING, and such
+ AM_INIT_AUTOMAKE([foreign])
+@@ -20,7 +47,8 @@ if test "$GCC" = "yes"; then
+ 	fi
+ fi
+ 
+-AC_PROG_RANLIB
++AC_PROG_LIBTOOL
++
+ AC_CONFIG_HEADERS([includes/config.h])
+ 
+ # we sometimes need to know byte order for building packets
+diff -up dhcp-4.0.0/omapip/Makefile.am.libdhcp4client dhcp-4.0.0/omapip/Makefile.am
+--- dhcp-4.0.0/omapip/Makefile.am.libdhcp4client	2007-05-29 06:32:11.000000000 -1000
++++ dhcp-4.0.0/omapip/Makefile.am	2008-01-12 17:19:29.000000000 -1000
+@@ -1,10 +1,18 @@
+ lib_LIBRARIES = libomapi.a
++noinst_LIBRARIES = libomapiLIBDHCP.a
+ noinst_PROGRAMS = svtest
+ 
+ libomapi_a_SOURCES = protocol.c buffer.c alloc.c result.c connection.c \
+ 		     errwarn.c listener.c dispatch.c generic.c support.c \
+ 		     handle.c message.c convert.c hash.c auth.c inet_addr.c \
+ 		     array.c trace.c mrtrace.c toisc.c iscprint.c
++
++libomapiLIBDHCP_a_CFLAGS = -DLIBDHCP
++libomapiLIBDHCP_a_SOURCES = alloc.c array.c auth.c buffer.c connection.c \
++		     convert.c dispatch.c errwarn.c handle.c hash.c listener.c \
++		     mrtrace.c result.c support.c toisc.c trace.c generic.c message.c \
++		     protocol.c
++
+ man_MANS = omapi.3
+ EXTRA_DIST = $(man_MANS)
+ 
+diff -up dhcp-4.0.0/omapip/dispatch.c.libdhcp4client dhcp-4.0.0/omapip/dispatch.c
+--- dhcp-4.0.0/omapip/dispatch.c.libdhcp4client	2007-11-30 11:51:43.000000000 -1000
++++ dhcp-4.0.0/omapip/dispatch.c	2008-01-12 17:19:29.000000000 -1000
+@@ -37,7 +37,7 @@
+ #include <omapip/omapip_p.h>
+ #include <sys/time.h>
+ 
+-static omapi_io_object_t omapi_io_states;
++omapi_io_object_t omapi_io_states;
+ time_t cur_time;
+ 
+ OMAPI_OBJECT_ALLOC (omapi_io,
+diff -up dhcp-4.0.0/omapip/errwarn.c.libdhcp4client dhcp-4.0.0/omapip/errwarn.c
+--- dhcp-4.0.0/omapip/errwarn.c.libdhcp4client	2008-01-12 17:19:29.000000000 -1000
++++ dhcp-4.0.0/omapip/errwarn.c	2008-01-12 17:19:29.000000000 -1000
+@@ -37,6 +37,11 @@
+ #include <errno.h>
+ #include <syslog.h>
+ 
++#ifdef LIBDHCP
++#include <isc-dhcp/libdhcp_control.h>
++extern LIBDHCP_Control *libdhcp_control;
++#endif
++
+ #ifdef DEBUG
+ int log_perror = -1;
+ #else
+@@ -46,7 +51,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... */
+@@ -56,6 +63,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.
+@@ -89,6 +106,7 @@ void log_fatal (const char * fmt, ... )
+   if (log_cleanup)
+ 	  (*log_cleanup) ();
+   exit (1);
++#endif
+ }
+ 
+ /* Log an error message... */
+@@ -99,6 +117,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.
+    */
+@@ -114,7 +139,7 @@ int log_error (const char * fmt, ...)
+ 	  write (STDERR_FILENO, mbuf, strlen (mbuf));
+ 	  write (STDERR_FILENO, "\n", 1);
+   }
+-
++#endif
+   return 0;
+ }
+ 
+@@ -126,6 +151,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.
+    */
+@@ -141,7 +173,7 @@ int log_info (const char *fmt, ...)
+ 	  write (STDERR_FILENO, mbuf, strlen (mbuf));
+ 	  write (STDERR_FILENO, "\n", 1);
+   }
+-
++#endif
+   return 0;
+ }
+ 
+@@ -152,7 +184,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.
+    */
+@@ -168,7 +206,7 @@ int log_debug (const char *fmt, ...)
+ 	  write (STDERR_FILENO, mbuf, strlen (mbuf));
+ 	  write (STDERR_FILENO, "\n", 1);
+   }
+-
++#endif
+   return 0;
+ }
+ 
+diff -up dhcp-4.0.0/omapip/alloc.c.libdhcp4client dhcp-4.0.0/omapip/alloc.c
+--- dhcp-4.0.0/omapip/alloc.c.libdhcp4client	2007-07-12 20:43:42.000000000 -1000
++++ dhcp-4.0.0/omapip/alloc.c	2008-01-12 17:19:29.000000000 -1000
+@@ -37,6 +37,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;
+@@ -72,7 +99,9 @@ dmalloc(unsigned size, const char *file,
+ 		return NULL;
+ 
+ 	foo = malloc(len);
+-
++#ifdef LIBDHCP
++	record_pointer(foo);
++#endif
+ 	if (!foo)
+ 		return NULL;
+ 	bar = (void *)(foo + DMDOFFSET);
+@@ -191,6 +220,9 @@ dfree(void *ptr, const char *file, int l
+ 		     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-4.0.0/dst/Makefile.am.libdhcp4client dhcp-4.0.0/dst/Makefile.am
+--- dhcp-4.0.0/dst/Makefile.am.libdhcp4client	2008-01-12 17:19:29.000000000 -1000
++++ dhcp-4.0.0/dst/Makefile.am	2008-01-12 17:19:29.000000000 -1000
+@@ -2,7 +2,13 @@ AM_CPPFLAGS = -DMINIRES_LIB -DHMAC_MD5
+ 
+ lib_LIBRARIES = libdst.a
+ 
++noinst_LIBRARIES = libdstLIBDHCP.a
++
+ libdst_a_SOURCES = dst_support.c dst_api.c hmac_link.c \
+ 		   base64.c prandom.c
+ 
++libdstLIBDHCP_a_CFLAGS = -DLIBDHCP
++libdstLIBDHCP_a_SOURCES = dst_support.c dst_api.c hmac_link.c \
++		   base64.c prandom.c
++
+ EXTRA_DIST = dst_internal.h md5.h md5_locl.h
+diff -up dhcp-4.0.0/dst/hmac_link.c.libdhcp4client dhcp-4.0.0/dst/hmac_link.c
+--- dhcp-4.0.0/dst/hmac_link.c.libdhcp4client	2007-12-05 14:50:22.000000000 -1000
++++ dhcp-4.0.0/dst/hmac_link.c	2008-01-12 17:19:29.000000000 -1000
+@@ -39,6 +39,10 @@ static const char rcsid[] = "$Header: /p
+ 
+ #include "dst_internal.h"
+ 
++#ifdef LIBDHCP
++extern void* dmalloc(size_t,char *,int);
++#endif
++
+ #ifdef USE_MD5
+ # include "md5.h"
+ # ifndef _MD5_H_
+@@ -87,7 +91,11 @@ dst_hmac_md5_sign(const int mode, DST_KE
+ 	MD5_CTX *ctx = NULL;
+ 
+ 	if (mode & SIG_MODE_INIT) 
++#ifdef LIBDHCP
++		ctx = (MD5_CTX *) dmalloc(sizeof(*ctx),__FILE__,__LINE__);
++#else
+ 		ctx = (MD5_CTX *) malloc(sizeof(*ctx));
++#endif
+ 	else if (context)
+ 		ctx = (MD5_CTX *) *context;
+ 	if (ctx == NULL) 
+@@ -154,7 +162,11 @@ dst_hmac_md5_verify(const int mode, DST_
+ 	MD5_CTX *ctx = NULL;
+ 
+ 	if (mode & SIG_MODE_INIT) 
++#ifdef LIBDHCP
++		ctx = (MD5_CTX *) dmalloc(sizeof(*ctx),__FILE__,__LINE__);
++#else
+ 		ctx = (MD5_CTX *) malloc(sizeof(*ctx));
++#endif
+ 	else if (context)
+ 		ctx = (MD5_CTX *) *context;
+ 	if (ctx == NULL) 
+@@ -218,8 +230,11 @@ dst_buffer_to_hmac_md5(DST_KEY *dkey, co
+ 
+ 	if (dkey == NULL || key == NULL || keylen < 0)
+ 		return (-1);
+-
++#ifdef  LIBDHCP
++	if ((hkey = (HMAC_Key *) dmalloc(sizeof(HMAC_Key),__FILE__,__LINE__)) == NULL)
++#else
+ 	if ((hkey = (HMAC_Key *) malloc(sizeof(HMAC_Key))) == NULL)
++#endif
+ 		  return (-2);
+ 
+ 	memset(hkey->hk_ipad, 0, sizeof(hkey->hk_ipad));
+@@ -348,7 +363,11 @@ dst_hmac_md5_key_from_file_format(DST_KE
+ 	if (eol == NULL)
+ 		return (-4);
+ 	len = eol - p;
++#ifdef LIBDHCP
++	tmp = dmalloc(len + 2,__FILE__,__LINE__);
++#else
+ 	tmp = malloc(len + 2);
++#endif
+ 	memcpy(tmp, p, len);
+ 	*(tmp + len) = 0x0;
+ 	key_len = b64_pton((char *)tmp, key, HMAC_LEN+1);	/* see above */
+@@ -440,8 +459,11 @@ dst_hmac_md5_generate_key(DST_KEY *key, 
+ 		return(0);
+ 	
+ 	len = size > 64 ? 64 : size;
++#ifdef LIBDHCP
++	buff = dmalloc(len+8,__FILE__,__LINE__);
++#else
+ 	buff = malloc(len+8);
+-
++#endif
+ 	n = dst_random(DST_RAND_SEMI, len, buff);
+ 	n += dst_random(DST_RAND_KEY, len, buff);
+ 	if (n <= len) {	/* failed getting anything */
+@@ -464,7 +486,11 @@ dst_hmac_md5_init()
+ {
+ 	if (dst_t_func[KEY_HMAC_MD5] != NULL)
+ 		return (1);
++#ifdef LIBDHCP
++	dst_t_func[KEY_HMAC_MD5] = dmalloc(sizeof(struct dst_func),__FILE__,__LINE__);
++#else
+ 	dst_t_func[KEY_HMAC_MD5] = malloc(sizeof(struct dst_func));
++#endif
+ 	if (dst_t_func[KEY_HMAC_MD5] == NULL)
+ 		return (0);
+ 	memset(dst_t_func[KEY_HMAC_MD5], 0, sizeof(struct dst_func));
+diff -up dhcp-4.0.0/common/Makefile.am.libdhcp4client dhcp-4.0.0/common/Makefile.am
+--- dhcp-4.0.0/common/Makefile.am.libdhcp4client	2007-11-16 01:04:11.000000000 -1000
++++ dhcp-4.0.0/common/Makefile.am	2008-01-12 17:19:29.000000000 -1000
+@@ -1,11 +1,17 @@
+ AM_CPPFLAGS = -I.. -DLOCALSTATEDIR='"@localstatedir@"'
+ 
+-noinst_LIBRARIES = libdhcp.a
++noinst_LIBRARIES = libdhcp.a libdhcpLIBDHCP.a
+ libdhcp_a_SOURCES = alloc.c bpf.c comapi.c conflex.c ctrace.c discover.c \
+ 		    dispatch.c dlpi.c dns.c ethernet.c execute.c fddi.c \
+ 		    icmp.c inet.c lpf.c memory.c nit.c options.c packet.c \
+ 		    parse.c print.c raw.c resolv.c socket.c tables.c tr.c \
+ 		    tree.c upf.c heap.c
++libdhcpLIBDHCP_a_CFLAGS = -DLIBDHCP
++libdhcpLIBDHCP_a_SOURCES = alloc.c bpf.c comapi.c conflex.c ctrace.c \
++		    discover.c dispatch.c dlpi.c dns.c ethernet.c \
++		    execute.c inet.c lpf.c memory.c nit.c options.c \
++		    packet.c parse.c print.c resolv.c socket.c \
++		    tables.c tr.c tree.c upf.c
+ man_MANS = dhcp-eval.5 dhcp-options.5
+ EXTRA_DIST = $(man_MANS)
+ 
+diff -up dhcp-4.0.0/common/discover.c.libdhcp4client dhcp-4.0.0/common/discover.c
+--- dhcp-4.0.0/common/discover.c.libdhcp4client	2007-10-05 12:29:51.000000000 -1000
++++ dhcp-4.0.0/common/discover.c	2008-01-12 17:19:29.000000000 -1000
+@@ -883,6 +883,10 @@ add_ipv6_addr_to_interface(struct interf
+    register that interface with the network I/O software, figure out what
+    subnet it's on, and add it to the list of interfaces. */
+ 
++#ifdef LIBDHCP
++int have_setup_fallback = 0;
++#endif
++
+ void 
+ discover_interfaces(int state) {
+ 	struct iface_conf_list ifaces;
+@@ -902,7 +906,9 @@ discover_interfaces(int state) {
+ 	isc_result_t status;
+ 	int wifcount = 0;
+ 
++#ifndef LIBDHCP
+ 	static int setup_fallback = 0;
++#endif
+ 
+ 	if (!begin_iface_scan(&ifaces)) {
+ 		log_fatal("Can't get list of interfaces.");
+@@ -1242,10 +1248,17 @@ discover_interfaces(int state) {
+ 		log_fatal ("Not configured to listen on any interfaces!");
+ 	}
+ 
++#ifdef LIBDHCP
++	if ((local_family == AF_INET) && !have_setup_fallback) {
++		have_setup_fallback = 1;
++		maybe_setup_fallback ();
++	}
++#else
+ 	if ((local_family == AF_INET) && !setup_fallback) {
+ 		setup_fallback = 1;
+ 		maybe_setup_fallback();
+ 	}
++#endif
+ 
+ #if defined (F_SETFD)
+ 	if (fallback_interface) {
+diff -up dhcp-4.0.0/common/tree.c.libdhcp4client dhcp-4.0.0/common/tree.c
+--- dhcp-4.0.0/common/tree.c.libdhcp4client	2007-08-22 03:41:37.000000000 -1000
++++ dhcp-4.0.0/common/tree.c	2008-01-12 17:19:29.000000000 -1000
+@@ -41,7 +41,7 @@
+ # include <regex.h>
+ #endif
+ 
+-struct binding_scope *global_scope;
++struct binding_scope __attribute__ ((visibility ("default"))) *global_scope;
+ 
+ static int do_host_lookup PROTO ((struct data_string *,
+ 				  struct dns_host_entry *));
+@@ -2859,6 +2859,7 @@ int evaluate_numeric_expression (result,
+    result of that evaluation.   There should never be both an expression
+    and a valid data_string. */
+ 
++__attribute__ ((visibility ("default")))
+ int evaluate_option_cache (result, packet, lease, client_state,
+ 			   in_options, cfg_options, scope, oc, file, line)
+ 	struct data_string *result;
+diff -up dhcp-4.0.0/common/options.c.libdhcp4client dhcp-4.0.0/common/options.c
+--- dhcp-4.0.0/common/options.c.libdhcp4client	2007-11-30 11:51:43.000000000 -1000
++++ dhcp-4.0.0/common/options.c	2008-01-12 17:19:29.000000000 -1000
+@@ -3392,6 +3392,7 @@ fqdn6_universe_decode(struct option_stat
+ 	return 0;
+ }
+ 
++__attribute__ ((visibility ("default")))
+ void option_space_foreach (struct packet *packet, struct lease *lease,
+ 			   struct client_state *client_state,
+ 			   struct option_state *in_options,
+diff -up dhcp-4.0.0/common/dispatch.c.libdhcp4client dhcp-4.0.0/common/dispatch.c
+--- dhcp-4.0.0/common/dispatch.c.libdhcp4client	2008-01-12 17:19:29.000000000 -1000
++++ dhcp-4.0.0/common/dispatch.c	2008-01-12 17:19:29.000000000 -1000
+@@ -34,8 +34,24 @@
+ 
+ #include "dhcpd.h"
+ 
+-struct timeout *timeouts;
+-static struct timeout *free_timeouts;
++struct timeout {
++#ifndef LIBDHCP
++	struct timeout *next;
++#endif
++	TIME when;
++	void (*func) PROTO ((void *));
++	void *what;
++	tvref_t ref;
++	tvunref_t unref;
++};
++
++#ifdef LIBDHCP
++static struct timeout *timeouts = NULL;
++static int ntimeouts = 0;
++#else
++static struct timeout *timeouts = NULL;
++static struct timeout *free_timeouts = NULL;
++#endif
+ 
+ void set_time(TIME t)
+ {
+@@ -48,9 +64,41 @@ void set_time(TIME t)
+ 
+ struct timeval *process_outstanding_timeouts (struct timeval *tvp)
+ {
++#ifdef LIBDHCP
++	int i;
++	struct timeout t = { 0 };
++#endif
+ 	/* Call any expired timeouts, and then if there's
+ 	   still a timeout registered, time out the select
+ 	   call then. */
++#ifdef LIBDHCP
++	if (!ntimeouts)
++		return NULL;
++
++	for (i = 0; i < ntimeouts && timeouts[i].when <= cur_time;) {
++		struct timeout *new_timeouts;
++		size_t n;
++
++		memmove(&t, &timeouts[i], sizeof (t));
++
++		n = (ntimeouts - i - 1) * sizeof (t);
++		memmove(&timeouts[i+1], &timeouts[i], n);
++
++		n = --ntimeouts * sizeof (t);
++		new_timeouts = realloc(timeouts, n);
++		/* XXX broken API, no way to return error here */
++		if (new_timeouts || !n)
++			timeouts = new_timeouts;
++
++		if (t.func)
++			t.func(t.what);
++		if (t.unref)
++			t.unref(t.what, MDL);
++	}
++	if (tvp && ntimeouts) {
++		tvp->tv_sec = timeouts[0].when;
++		tvp->tv_usec = 0;
++#else
+       another:
+ 	if (timeouts) {
+ 		struct timeout *t;
+@@ -68,9 +116,15 @@ struct timeval *process_outstanding_time
+ 			tvp -> tv_sec = timeouts -> when;
+ 			tvp -> tv_usec = 0;
+ 		}
++#endif
+ 		return tvp;
++#ifdef LIBDHCP
++	}
++	return NULL;
++#else
+ 	} else
+ 		return (struct timeval *)0;
++#endif
+ }
+ 
+ /* Wait for packets to come in using select().   When one does, call
+@@ -99,13 +153,28 @@ void add_timeout (when, where, what, ref
+ 	tvref_t ref;
+ 	tvunref_t unref;
+ {
++#ifdef LIBDHCP
++	struct timeout t = {
++		.when = when,
++		.func = where,
++		.what = what,
++		.ref = ref,
++		.unref = unref
++	};
++	struct timeout *new_timeouts;
++	int i, pos = 0;
++#else
+ 	struct timeout *t, *q;
++#endif
+ 
+ 	/* See if this timeout supersedes an existing timeout. */
++#ifdef LIBDHCP
++	for (i = 0; i < ntimeouts; i++) {
++		struct timeout *q = &timeouts[i];
++#else
+ 	t = (struct timeout *)0;
+ 	for (q = timeouts; q; q = q -> next) {
+-		if ((where == NULL || q -> func == where) &&
+-		    q -> what == what) {
++		if ((where == NULL || q -> func == where) && q -> what == what) {
+ 			if (t)
+ 				t -> next = q -> next;
+ 			else
+@@ -114,7 +183,29 @@ void add_timeout (when, where, what, ref
+ 		}
+ 		t = q;
+ 	}
++#endif
+ 
++#ifdef LIBDHCP
++		/* If this one is already in the list with a different time,
++		 * remove it and re-add */
++		if ((where == NULL || q->func == where) &&
++				q->what == what) {
++			size_t n = (--ntimeouts - i) * sizeof (*q);
++			memmove(&t, q, sizeof (t));
++
++			if (n)
++				memmove(&timeouts[i], &timeouts[i+1], n);
++
++			if (ntimeouts) {
++				new_timeouts = realloc(timeouts, ntimeouts * sizeof (*q));
++				/* XXX broken API, no way to return error here */
++				if (new_timeouts)
++					timeouts = new_timeouts;
++			} else {
++				timeouts = NULL;
++			}
++			add_timeout(when, where, what, ref, unref);
++#else
+ 	/* If we didn't supersede a timeout, allocate a timeout
+ 	   structure now. */
+ 	if (!q) {
+@@ -123,7 +214,7 @@ void add_timeout (when, where, what, ref
+ 			free_timeouts = q -> next;
+ 		} else {
+ 			q = ((struct timeout *)
+-			     dmalloc (sizeof (struct timeout), MDL));
++				dmalloc (sizeof (struct timeout), MDL));
+ 			if (!q)
+ 				log_fatal ("add_timeout: no memory!");
+ 		}
+@@ -153,22 +244,76 @@ void add_timeout (when, where, what, ref
+ 		if (t -> next -> when > q -> when) {
+ 			q -> next = t -> next;
+ 			t -> next = q;
++#endif
+ 			return;
++#ifdef LIBDHCP
++		} else if (timeouts[i].when > when) {
++			pos = i;
++#endif
+ 		}
+ 	}
+ 
++#ifdef LIBDHCP
++	/* If we didn't supersede an existing timeout, then pos is set
++	 * to the timeout which will post after this one.  Insert this
++	 * one before it. */
++
++	new_timeouts = realloc(timeouts, sizeof (t) * (ntimeouts+1));
++	/* XXX broken API, no way to return error here */
++	if (new_timeouts) {
++		/* ntimeouts = 10
++		 * pos = 3;
++		 * n = 10-3 * sizeof (t) = 7 * sizeof (t) 
++		 */
++		size_t n = (ntimeouts - pos) * sizeof (t);
++
++		timeouts = new_timeouts;
++		memmove(&timeouts[pos+1], &timeouts[pos], n);
++		memmove(&timeouts[pos], &t, sizeof (t));
++		ntimeouts++;
++	}
++#else
+ 	/* End of list. */
+ 	t -> next = q;
+ 	q -> next = (struct timeout *)0;
++#endif
+ }
+ 
+ void cancel_timeout (where, what)
+ 	void (*where) PROTO ((void *));
+ 	void *what;
+ {
++#ifdef LIBDHCP
++	struct timeout t;
++	int i = 0;
++#else
+ 	struct timeout *t, *q;
++#endif
+ 
+ 	/* Look for this timeout on the list, and unlink it if we find it. */
++#ifdef LIBDHCP
++	for (i = 0; i < ntimeouts; i++) {
++		struct timeout *new_timeouts, *q = &timeouts[i];
++
++		if (q->func == where && q->what == what) {
++			size_t n;
++
++			memmove(&t, q, sizeof (t));
++
++			n = (ntimeouts - i - 1) * sizeof (t);
++			memmove(&timeouts[i+1], &timeouts[i], n);
++
++			n = --ntimeouts * sizeof (t);
++			new_timeouts = realloc(timeouts, n);
++			/* XXX broken API, no way to return error here */
++			if (new_timeouts || !n)
++				timeouts = new_timeouts;
++
++			if (t.unref)
++				t.unref(t.what, MDL);
++		}
++	}
++#else
+ 	t = (struct timeout *)0;
+ 	for (q = timeouts; q; q = q -> next) {
+ 		if (q -> func == where && q -> what == what) {
+@@ -188,10 +333,15 @@ void cancel_timeout (where, what)
+ 		q -> next = free_timeouts;
+ 		free_timeouts = q;
+ 	}
++#endif
+ }
+ 
+ void cancel_all_timeouts ()
+ {
++#ifdef LIBDHCP
++	cur_time = TIME_MAX;
++	process_outstanding_timeouts(NULL);
++#else
+ 	struct timeout *t, *n;
+ 	for (t = timeouts; t; t = n) {
+ 		n = t -> next;
+@@ -200,13 +350,20 @@ void cancel_all_timeouts ()
+ 		t -> next = free_timeouts;
+ 		free_timeouts = t;
+ 	}
++#endif
+ }
+ 
++__attribute__ ((visibility ("default")))
+ void relinquish_timeouts ()
+ {
++#ifdef LIBDHCP
++	while (ntimeouts)
++		cancel_timeout(timeouts[0].func, timeouts[0].what);
++#else
+ 	struct timeout *t, *n;
+ 	for (t = free_timeouts; t; t = n) {
+ 		n = t -> next;
+ 		dfree (t, MDL);
+ 	}
++#endif
+ }
+diff -up dhcp-4.0.0/common/alloc.c.libdhcp4client dhcp-4.0.0/common/alloc.c
+--- dhcp-4.0.0/common/alloc.c.libdhcp4client	2007-10-23 14:54:11.000000000 -1000
++++ dhcp-4.0.0/common/alloc.c	2008-01-12 17:19:29.000000000 -1000
+@@ -1004,7 +1004,11 @@ int executable_statement_reference (ptr,
+ 	return 1;
+ }
+ 
++#ifdef LIBDHCP
++struct packet *free_packets;
++#else
+ static struct packet *free_packets;
++#endif
+ 
+ #if defined (DEBUG_MEMORY_LEAKAGE) || \
+ 		defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+diff -up dhcp-4.0.0/includes/dhcpd.h.libdhcp4client dhcp-4.0.0/includes/dhcpd.h
+--- dhcp-4.0.0/includes/dhcpd.h.libdhcp4client	2008-01-12 17:19:29.000000000 -1000
++++ dhcp-4.0.0/includes/dhcpd.h	2008-01-12 17:19:29.000000000 -1000
+@@ -1199,14 +1199,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;
+@@ -1664,7 +1656,6 @@ extern const char *path_dhcpd_pid;
+ 
+ extern int dhcp_max_agent_option_packet_length;
+ 
+-int main(int, char **);
+ void postconf_initialization(int);
+ void postdb_startup(void);
+ void cleanup PROTO ((void));
+@@ -2337,7 +2328,6 @@ extern void (*bootp_packet_handler) PROT
+ extern void (*dhcpv6_packet_handler)(struct interface_info *,
+ 				     const char *, int,
+ 				     int, const struct iaddr *, isc_boolean_t);
+-extern struct timeout *timeouts;
+ extern omapi_object_type_t *dhcp_type_interface;
+ #if defined (TRACING)
+ extern trace_type_t *interface_trace;
+diff -up dhcp-4.0.0/client/Makefile.am.libdhcp4client dhcp-4.0.0/client/Makefile.am
+--- dhcp-4.0.0/client/Makefile.am.libdhcp4client	2007-12-12 09:23:42.000000000 -1000
++++ dhcp-4.0.0/client/Makefile.am	2008-01-12 17:21:17.000000000 -1000
+@@ -1,10 +1,19 @@
+ dist_sysconf_DATA = dhclient.conf
+ sbin_PROGRAMS = dhclient
++lib_LTLIBRARIES = libdhcp4client.la
+ dhclient_SOURCES = clparse.c dhclient.c dhc6.c \
+ 		   scripts/bsdos scripts/freebsd scripts/linux scripts/netbsd \
+ 		   scripts/nextstep scripts/openbsd scripts/solaris
+ dhclient_LDADD = ../common/libdhcp.a ../minires/libres.a \
+ 		 ../omapip/libomapi.a ../dst/libdst.a
++libdhcp4client_la_CFLAGS = -DLIBDHCP -DLOCALSTATEDIR='"@localstatedir@"' \
++		 -fvisibility=hidden
++libdhcp4client_la_LDFLAGS = -version-info \
++		 $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
++		 -release $(LT_RELEASE)
++libdhcp4client_la_SOURCES = clparse.c dhclient.c dhc6.c
++libdhcp4client_la_LIBADD = ../common/libdhcpLIBDHCP.a ../minires/libres.a \
++		 ../omapip/libomapiLIBDHCP.a ../dst/libdstLIBDHCP.a
+ man_MANS = dhclient.8 dhclient-script.8 dhclient.conf.5 dhclient.leases.5
+ EXTRA_DIST = $(man_MANS)
+ 
+diff -up dhcp-4.0.0/client/dhclient.c.libdhcp4client dhcp-4.0.0/client/dhclient.c
+--- dhcp-4.0.0/client/dhclient.c.libdhcp4client	2008-01-12 17:19:29.000000000 -1000
++++ dhcp-4.0.0/client/dhclient.c	2008-01-12 17:19:29.000000000 -1000
+@@ -83,14 +83,50 @@ int nowait=0;
+ char *mockup_relay = NULL;
+ int bootp_broadcast_always = 0;
+ 
++#ifdef LIBDHCP
++FILE *leaseFile = NULL;
++#endif
++
+ extern u_int32_t default_requested_options[];
+ 
+ static void usage PROTO ((void));
+ 
+ static isc_result_t write_duid(struct data_string *duid);
+ 
+-int 
+-main(int argc, char **argv) {
++#ifdef LIBDHCP
++#include "isc-dhcp/libdhcp_control.h"
++LIBDHCP_Control *libdhcp_control;
++static void libdhcp_dispatch(void)
++{
++	struct timeval tv = { 0, 0 }, *tvp;
++	isc_result_t status;
++
++	/* Wait for a packet, or a timeout, or libdhcp being finished */
++	do {
++		tvp = process_outstanding_timeouts(&tv);
++		status = omapi_one_dispatch(0, tvp);
++
++		if (libdhcp_control && ((status == ISC_R_TIMEDOUT) || (libdhcp_control->timeout && (time(NULL) >= (libdhcp_control->timeout + libdhcp_control->now))))) {
++			if (libdhcp_control->callback)
++				libdhcp_control->callback(libdhcp_control, DHC_TIMEDOUT, NULL);
++
++			break;
++		}
++	} while ((status != ISC_R_TIMEDOUT) && ((!libdhcp_control) || (!(libdhcp_control->finished))));
++}
++
++extern void omapi_free_all_pointers(void);
++
++__attribute__ ((visibility ("default")))
++int dhcpv4_client (LIBDHCP_Control *libdhcp_ctl, int argc, char **argv,
++                   char **envp)
++#else
++int main(int argc, char **argv, char **envp)
++#endif
++{
++#ifdef LIBDHCP
++	libdhcp_control = libdhcp_ctl;
++#endif
+ 	int fd;
+ 	int i;
+ 	struct interface_info *ip;
+@@ -122,6 +158,7 @@ main(int argc, char **argv) {
+ 	/* Initialize client globals. */
+ 	memset(&default_duid, 0, sizeof(default_duid));
+ 
++#ifndef LIBDHCP
+         /* Make sure that file descriptors 0 (stdin), 1, (stdout), and
+            2 (stderr) are open. To do this, we assume that when we
+            open a file the lowest available file descriptor is used. */
+@@ -140,6 +177,7 @@ main(int argc, char **argv) {
+ #if !(defined (DEBUG) || defined (__CYGWIN32__))
+ 	setlogmask (LOG_UPTO (LOG_INFO));
+ #endif	
++#endif
+ 
+ 	/* Set up the OMAPI. */
+ 	status = omapi_init ();
+@@ -485,8 +523,12 @@ main(int argc, char **argv) {
+ 		}
+ 	}
+ 
++#ifdef LIBDHCP
++	if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_PID_FILE))
++#endif
+ 	write_client_pid_file();
+ 
++#ifndef LIBDHCP
+ 	if (!quiet) {
+ 		log_info ("%s %s", message, PACKAGE_VERSION);
+ 		log_info (copyright);
+@@ -497,6 +539,7 @@ main(int argc, char **argv) {
+ 		log_perror = 0;
+ 		quiet_interface_discovery = 1;
+ 	}
++#endif
+ 
+ 	/* If we're given a relay agent address to insert, for testing
+ 	   purposes, figure out what it is. */
+@@ -702,11 +745,17 @@ main(int argc, char **argv) {
+ 		arg_conf_len = 0;
+ 	}
+ 
++#ifdef LIBDHCP
++	if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE)) {
++#endif
+ 	/* Parse the lease database. */
+ 	read_client_leases ();
+ 
+ 	/* Rewrite the lease database... */
+ 	rewrite_client_leases ();
++#ifdef LIBDHCP
++	}
++#endif
+ 
+ 	/* XXX */
+ /* 	config_counter(&snd_counter, &rcv_counter); */
+@@ -725,7 +774,7 @@ main(int argc, char **argv) {
+ 		if (!persist) {
+ 			/* Nothing more to do. */
+ 			log_info ("No broadcast interfaces found - exiting.");
+-			exit (0);
++			return (0);
+ 		}
+ 	} else if (!release_mode && !exit_mode) {
+ 		/* Call the script with the list of interfaces. */
+@@ -863,6 +912,7 @@ main(int argc, char **argv) {
+ 	dmalloc_outstanding = 0;
+ #endif
+ 
++#ifndef LIBDHCP
+ 	/* If we're not supposed to wait before getting the address,
+ 	   don't. */
+ 	if (nowait)
+@@ -875,6 +925,126 @@ main(int argc, char **argv) {
+ 
+ 	/* Start dispatching packets and timeouts... */
+ 	dispatch ();
++#else
++	if (libdhcp_control) {
++		if (libdhcp_control->timeout)
++			libdhcp_control->now = time(NULL);
++		else
++			libdhcp_control->now = 0;
++	}
++
++	libdhcp_dispatch();
++
++	/* libdhcp is finished with us. */
++
++	/* close all file descriptors:  */
++	for (ip = interfaces; ip; ip = ip->next) {
++		shutdown(ip->wfdesc, SHUT_RDWR);
++		close(ip->wfdesc);
++
++		if (ip->rfdesc != ip->wfdesc)
++			close(ip->rfdesc);
++	}
++
++	if (fallback_interface != 0) {
++		ip = fallback_interface;
++		shutdown(ip->wfdesc, SHUT_RDWR);
++		close(ip->wfdesc);
++
++		if (ip->rfdesc != ip->wfdesc)
++			close(ip->rfdesc);
++	}
++
++	if (leaseFile)
++		fclose (leaseFile);
++
++	closelog();
++
++	char *current_pid_file = _PATH_DHCLIENT_PID;
++
++	/* Free ALL allocated memory: */
++	omapi_free_all_pointers();
++
++	/* Re-Initialize globals: */
++	client_env = 0;
++	client_env_count = 0;
++	default_lease_time = 43200;
++
++	dhcp_max_agent_option_packet_length = 0;
++	iaddr_any.len = 4;
++	memset(&(iaddr_any.iabuf[0]), '\0', 4);
++	iaddr_broadcast.len = 4;
++	memset(&(iaddr_broadcast.iabuf[0]), 0xff, 4);
++	interfaces_requested = 0;
++	leaseFile = 0;
++
++	libdhcp_control = 0;
++
++	local_port = 0;
++	no_daemon = 0;
++	nowait = 0;
++	onetry = 0;
++	quiet = 0;
++	max_lease_time = 86400;
++	path_dhclient_conf = _PATH_DHCLIENT_CONF;
++	path_dhclient_db = _PATH_DHCLIENT_DB;
++	path_dhclient_pid = _PATH_DHCLIENT_PID;
++	strcpy(&(path_dhclient_script_array[0]), _PATH_DHCLIENT_SCRIPT);
++	path_dhclient_script = path_dhclient_script_array;
++	remote_port = 0;
++	resolver_inited = 0;
++	log_perror = 1;
++	global_scope = NULL;
++	root_group = NULL;
++	group_name_hash = NULL;
++	interfaces = NULL;
++	dummy_interfaces = NULL;
++	fallback_interface = NULL;
++	extern int have_setup_fallback;
++	have_setup_fallback = 0;
++	quiet_interface_discovery = 1;
++#ifndef LIBDHCP
++	timeouts = NULL;
++#endif
++	dhcp_type_interface = NULL;
++	interface_vector = NULL;
++	interface_count = 0;
++	interface_max = 0;
++	name_servers = 0;
++	domains = 0;
++	dhcp_type_interface = NULL;
++	dhcp_type_group = NULL;
++	dhcp_type_shared_network = NULL;
++	dhcp_type_control = NULL;
++	memset(&dhcp_universe, '\0', sizeof(struct universe));
++	memset(&nwip_universe, '\0', sizeof(struct universe));
++	memset(&fqdn_universe, '\0', sizeof(struct universe));
++	universe_hash = 0;
++	universes = 0;
++	universe_count = 0;
++	universe_max = 0;
++	config_universe = 0;
++	extern struct hash_bucket *free_hash_buckets;
++	free_hash_buckets = NULL;
++	extern struct dhcp_packet *dhcp_free_list;
++	dhcp_free_list = NULL;
++	extern struct packet *packet_free_list;
++	packet_free_list = NULL;
++	extern struct binding_value *free_binding_values;
++	free_binding_values = NULL;
++	extern struct expression *free_expressions;
++	free_expressions = NULL;
++	extern struct option_cache *free_option_caches;
++	free_option_caches = NULL;
++	extern  struct packet *free_packets;
++	free_packets = NULL;
++	extern  pair free_pairs;
++	free_pairs = NULL;
++	extern omapi_io_object_t omapi_io_states;
++	memset(&omapi_io_states, '\0', sizeof(omapi_io_states));
++	dhcp_control_object = NULL;
++	unlink(current_pid_file);
++#endif
+ 
+ 	/*NOTREACHED*/
+ 	return 0;
+@@ -1270,7 +1440,20 @@ void dhcpack (packet)
+ 	if (client -> new -> rebind < cur_time)
+ 		client -> new -> rebind = TIME_MAX;
+ 
++#ifdef LIBDHCP
++	/* We need the server's siaddr for the 'bootServer'
++	 * pump option
++	 */
++	u_int32_t set_siaddr = 0;
++	set_siaddr = client->packet.siaddr.s_addr;
++	client->packet.siaddr.s_addr = packet->raw->siaddr.s_addr;
++#endif
++
+ 	bind_lease (client);
++
++#ifdef LIBDHCP
++	client->packet.siaddr.s_addr = set_siaddr;
++#endif
+ }
+ 
+ void bind_lease (client)
+@@ -1306,6 +1489,9 @@ void bind_lease (client)
+ 		return;
+ 	}
+ 
++#ifdef LIBDHCP
++	if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE))
++#endif
+ 	/* Write out the new lease. */
+ 	write_client_lease (client, client -> new, 0, 0);
+ 
+@@ -1398,10 +1584,12 @@ void state_stop (cpp)
+ 	}
+ }  
+ 
++#ifndef LIBDHCP
+ int commit_leases ()
+ {
+ 	return 0;
+ }
++#endif
+ 
+ int write_lease (lease)
+ 	struct lease *lease;
+@@ -2074,6 +2262,10 @@ void state_panic (cpp)
+ 	   tell the shell script that we failed to allocate an address,
+ 	   and try again later. */
+ 	if (onetry) {
++#ifdef LIBDHCP
++		script_init (client, "FAIL", (struct string_list *)0);
++		return;
++#endif
+ 		if (!quiet)
+ 			log_info ("Unable to obtain a lease on first try.%s",
+ 				  "  Exiting.");
+@@ -2691,7 +2883,9 @@ void destroy_client_lease (lease)
+ 	free_client_lease (lease, MDL);
+ }
+ 
++#ifndef LIBDHCP
+ FILE *leaseFile = NULL;
++#endif
+ int leases_written = 0;
+ 
+ void rewrite_client_leases ()
+@@ -3218,6 +3412,54 @@ void script_write_params (client, prefix
+ int script_go (client)
+ 	struct client_state *client;
+ {
++#ifdef LIBDHCP
++	struct string_list *sp;
++
++	if (libdhcp_control && libdhcp_control->callback) {
++		int dhcmsg;
++		char *reason="";
++
++		for (sp = client->env; sp; sp = sp->next)
++			if (strncmp(sp->string, "reason=", 7) == 0) {
++				reason = sp->string + 7;
++				break;
++			}
++
++		if (strcmp(reason,"NBI") == 0)
++			dhcmsg = DHC4_NBI;
++		else if (strcmp(reason,"PREINIT") == 0)
++			dhcmsg = DHC4_PREINIT;
++		else if (strcmp(reason,"BOUND") == 0)
++			dhcmsg = DHC4_BOUND;
++		else if (strcmp(reason,"RENEW") == 0)
++			dhcmsg = DHC4_RENEW;
++		else if (strcmp(reason,"REBOOT") == 0)
++			dhcmsg = DHC4_REBOOT;
++		else if (strcmp(reason,"REBIND") == 0)
++			dhcmsg = DHC4_REBIND;
++		else if (strcmp(reason,"STOP") == 0)
++			dhcmsg = DHC4_STOP;
++		else if (strcmp(reason,"MEDIUM") == 0)
++			dhcmsg = DHC4_MEDIUM;
++		else if (strcmp(reason,"TIMEOUT") == 0)
++			dhcmsg = DHC4_TIMEOUT;
++		else if (strcmp(reason,"FAIL") == 0)
++			dhcmsg = DHC4_FAIL;
++		else if (strcmp(reason,"EXPIRE") == 0)
++			dhcmsg = DHC4_EXPIRE;
++		else if (strcmp(reason,"RELEASE") == 0)
++			dhcmsg = DHC4_RELEASE;
++		else
++			dhcmsg = DHC4_NBI;
++
++		(*libdhcp_control->callback) (libdhcp_control, dhcmsg, client);
++
++		if (libdhcp_control->decline)
++			return 1;
++	}
++
++	return 0;
++#else
+ 	char *scriptName;
+ 	char *argv [2];
+ 	char **envp;
+@@ -3294,6 +3536,7 @@ int script_go (client)
+ 	time(&cur_time);
+ 	return (WIFEXITED (wstatus) ?
+ 		WEXITSTATUS (wstatus) : -WTERMSIG (wstatus));
++#endif
+ }
+ 
+ void client_envadd (struct client_state *client,
+@@ -3376,6 +3619,9 @@ void go_daemon ()
+ 
+ 	/* Don't become a daemon if the user requested otherwise. */
+ 	if (no_daemon) {
++#ifdef LIBDHCP
++		if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_PID_FILE))
++#endif
+ 		write_client_pid_file ();
+ 		return;
+ 	}
+@@ -3385,6 +3631,10 @@ void go_daemon ()
+ 		return;
+ 	state = 1;
+ 
++#ifdef LIBDHCP
++	return;
++#endif
++
+ 	/* Stop logging to stderr... */
+ 	log_perror = 0;
+ 

dhcp-4.0.0-manpages.patch:

Index: dhcp-4.0.0-manpages.patch
===================================================================
RCS file: dhcp-4.0.0-manpages.patch
diff -N dhcp-4.0.0-manpages.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ dhcp-4.0.0-manpages.patch	13 Jan 2008 21:02:47 -0000	1.3
@@ -0,0 +1,533 @@
+diff -up dhcp-4.0.0/server/dhcpd.conf.5.manpages dhcp-4.0.0/server/dhcpd.conf.5
+--- dhcp-4.0.0/server/dhcpd.conf.5.manpages	2007-11-20 08:34:37.000000000 -1000
++++ dhcp-4.0.0/server/dhcpd.conf.5	2008-01-02 11:26:38.000000000 -1000
+@@ -513,6 +513,9 @@ pool {
+ };
+ .fi
+ .PP
++Dynamic BOOTP leases are not compatible with failover, and, as such,
++you need to disallow BOOTP in pools that you are using failover for.
++.PP
+ The  server currently  does very  little  sanity checking,  so if  you
+ configure it wrong, it will just  fail in odd ways.  I would recommend
+ therefore that you either do  failover or don't do failover, but don't
+@@ -527,9 +530,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;
+@@ -588,9 +591,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 
+@@ -602,10 +603,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
+@@ -1272,7 +1271,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==;
+ };
+ 
+@@ -1295,7 +1294,7 @@ dhcpd.conf file:
+ .PP
+ .nf
+ key DHCP_UPDATER {
+-  algorithm HMAC-MD5.SIG-ALG.REG.INT;
++  algorithm hmac-md5;
+   secret pRP5FapFoJ95JEL06sv4PQ==;
+ };
+ 
+@@ -2433,7 +2432,8 @@ statement
+ The \fInext-server\fR statement is used to specify the host address of
+ the server from which the initial boot file (specified in the
+ \fIfilename\fR statement) is to be loaded.   \fIServer-name\fR should
+-be a numeric IP address or a domain name.
++be a numeric IP address or a domain name.  If no \fInext-server\fR statement
++applies to a given client, the address 0.0.0.0 is used.
+ .RE
+ .PP
+ The
+diff -up dhcp-4.0.0/common/dhcp-options.5.manpages dhcp-4.0.0/common/dhcp-options.5
+--- dhcp-4.0.0/common/dhcp-options.5.manpages	2007-09-17 07:52:01.000000000 -1000
++++ dhcp-4.0.0/common/dhcp-options.5	2008-01-02 11:26:38.000000000 -1000
+@@ -896,6 +896,21 @@ classless IP routing - it does not inclu
+ classless IP routing is now the most widely deployed routing standard,
+ this option is virtually useless, and is not implemented by any of the
+ popular DHCP clients, for example the Microsoft DHCP client.
++.PP
++NOTE to @PRODUCTNAME@ dhclient users:
++.br
++dhclient-script interprets trailing 0 octets of the target as indicating
++the subnet class of the route, so for the following static-routes value:
++.br
++        option static-routes 172.0.0.0 172.16.2.254,
++.br
++                             192.168.0.0 192.168.2.254;
++.br
++dhclient-script will create routes:
++.br
++        172/8 via 172.16.2.254 dev $interface
++.br
++        192.168/16 via 192.168.2.254 dev $interface
+ .RE
+ .PP
+ .nf
+diff -up dhcp-4.0.0/client/dhclient-script.8.manpages dhcp-4.0.0/client/dhclient-script.8
+--- dhcp-4.0.0/client/dhclient-script.8.manpages	2006-02-24 13:16:27.000000000 -1000
++++ dhcp-4.0.0/client/dhclient-script.8	2008-01-02 11:26:38.000000000 -1000
+@@ -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,26 @@ 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-4.0.0/client/dhclient.conf.5.manpages dhcp-4.0.0/client/dhclient.conf.5
+--- dhcp-4.0.0/client/dhclient.conf.5.manpages	2007-08-23 06:06:08.000000000 -1000
++++ dhcp-4.0.0/client/dhclient.conf.5	2008-01-02 11:26:38.000000000 -1000
+@@ -186,9 +186,9 @@ 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.  Note that if
+-you enter a 'request' statement, you over-ride this default and these
+-options will not be requested.
++domain-name, domain-name-servers host-name, nis-domain, nis-servers,
++and ntp-servers options.  Note that if you enter a 'request' statement,
++you over-ride this default and these options will not be requested.
+ .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
+@@ -626,6 +626,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 an extension to enable dhclient to work
++on IBM s390 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-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
+--- dhcp-4.0.0/client/dhclient.8.manpages	2007-10-04 07:13:25.000000000 -1000
++++ dhcp-4.0.0/client/dhclient.8	2008-01-02 11:26:38.000000000 -1000
+@@ -91,6 +91,33 @@ relay
+ .B -w
+ ]
+ [
++.B -B
++]
++[
++.B -I
++.I dhcp-client-identifier
++]
++[
++.B -H
++.I host-name
++]
++[
++.B -F
++.I fqdn.fqdn
++]
++[
++.B -V
++.I vendor-class-identifier
++]
++[
++.B -R
++.I request-option-list
++]
++[
++.B -T
++.I timeout
++]
++[
+ .B -v
+ ]
+ [
+@@ -118,16 +145,6 @@ important details about the network to w
+ the location of a default router, the location of a name server, and
+ so on.
+ .PP
+-If given the -4 command line argument (default), dhclient will use the
+-DHCPv4 protocol to obtain an IPv4 address and configuration parameters.
+-.PP
+-If given the -6 command line argument, dhclient will use the DHCPv6
+-protocol to obtain whatever IPv6 addresses are available along with
+-configuration parameters.  Information-request is not yet supported.
+-.PP
+-If given the --version command line argument, dhclient will print its
+-version number and exit.
+-.PP
+ On startup, dhclient reads the
+ .IR dhclient.conf
+ for configuration instructions.   It then gets a list of all the
+@@ -181,67 +198,183 @@ file.   If interfaces are specified in t
+ only configure interfaces that are either specified in the
+ configuration file or on the command line, and will ignore all other
+ interfaces.
+-.PP
+-If the DHCP client should listen and transmit on a port other than the
+-standard (port 68), the
+-.B -p
+-flag may used.  It should be followed by the udp port number that
+-dhclient should use.  This is mostly useful for debugging purposes.
+-If a different port is specified for the client to listen on and
+-transmit on, the client will also use a different destination port -
+-one greater than the specified destination port.
+-.PP
+-The DHCP client normally transmits any protocol messages it sends
+-before acquiring an IP address to, 255.255.255.255, the IP limited
+-broadcast address.   For debugging purposes, it may be useful to have
+-the server transmit these messages to some other address.   This can
+-be specified with the 
+-.B -s
+-flag, followed by the IP address or domain name of the destination.
+-.PP
+-For testing purposes, the giaddr field of all packets that the client
+-sends can be set using the
+-.B -g
+-flag, followed by the IP address to send.   This is only useful for testing,
+-and should not be expected to work in any consistent or useful way.
+-.PP
+-The DHCP client will normally run in the foreground until it has
+-configured an interface, and then will revert to running in the
+-background.   To run force dhclient to always run as a foreground
+-process, the
+-.B -d
+-flag should be specified.  This is useful when running the client
+-under a debugger, or when running it out of inittab on System V
+-systems.
+-.PP
+-The dhclient daemon creates its own environment when executing the
+-dhclient-script to do the grunt work of interface configuration.
+-To define extra environment variables and their values, use the
+-.B -e
+-flag, followed by the environment variable name and value assignment,
+-just as one would assign a variable in a shell.  Eg:
+-.B -e
+-.I IF_METRIC=1
+-.PP
+-The client normally prints no output during its startup sequence.  It
+-can be made to emit verbose messages displaying the startup sequence events
+-until it has acquired an address by supplying the
+-.B -v
+-command line argument.  In either case, the client logs messages using
+-the
+-.B syslog (3)
+-facility.  A
+-.B -q
+-command line argument is provided for backwards compatibility, but since
+-dhclient is quiet by default, it has no effect.
+-.PP
+-The client normally doesn't release the current lease as it is not
+-required by the DHCP protocol.  Some cable ISPs require their clients
+-to notify the server if they wish to release an assigned IP address.
++.SH OPTIONS
++.TP
++.BI \-4
++Use the DHCPv4 protocol to obtain an IPv4 address and configuration
++parameters.
++
++.TP
++.BI \-6
++Use the DHCPv6 protocol to obtain whatever IPv6 addresses are available
++along with configuration parameters.  Information-request is not yet
++supported.
++
++.TP
++.BI \-p\ <port\ number>
++The UDP port number the DHCP client should listen and transmit on.  If
++unspecified,
++.B dhclient
++uses the default port 68.  This option is mostly useful for debugging
++purposes.  If a different port is specified for the client to listen and
++transmit on, the client will also use a different destination port - one
++greater than the specified destination port.
++
++.TP
++.BI \-d
++Force
++.B dhclient
++to run as a foreground process.  This is useful when running the client
++under a debugger, or when running it out of inittab on System V systems.
++
++.TP
++.BI \-e\ VAR=value
++Define additional environment variables for the environment where
++dhclient-script executes.  You may specify multiple
++.B \-e
++options on the command line.
++
++.TP
++.BI \-q
++Suppress all terminal and log output except error messages.
++
++.TP
++.BI \-1
++Try one to get a lease.  On failure, exit with code 2.
++
++.TP
++.BI \-r
++Tell
++.B dhclient
++to release the current lease it has from the server.  This is not required
++by the DHCP protocol, but some ISPs require their clients to notify the
++server if they wish to release an assigned IP address.
++
++.TP
++.BI \-lf\ <lease-file>
++Path to the lease database file.  If unspecified, the default
++.B DBDIR/dhclient.leases
++is used.
++
++.TP
++.BI \-pf\ <pid-file>
++Path to the process ID file.  If unspecified, the default
++.B RUNDIR/dhclient.pid
++is used.
++
++.TP
++.BI \-cf\ <config-file>
++Path to the client configuration file.  If unspecified, the default
++.B ETCDIR/dhclient.conf
++is used.
++
++.TP
++.BI \-sf\ <script-file>
++Path to the network configuration script invoked by
++.B dhclient
++when it gets a lease.  If unspecified, the default
++.B CLIENTBINDIR/dhclient-script
++is used.
++
++.TP
++.BI \-s\ <server>
++Specifiy the server IP address or fully qualified domain name to transmit
++DHCP protocol messages to.  Normally,
++.B dhclient
++transmits these messages to 255.255.255.255 (the IP limited broadcast
++address).  Overriding this is mostly useful for debugging purposes.
++
++.TP
++.BI \-g\ <relay>
++Only for debugging.  Set the giaddr field of all packets the client
++sends to the IP address specified.  This should not be expected to work
++in any consistent or useful way.
++
++.TP
++.BI \-n
++Do not configure any interfaces.  Most useful combined with the
++.B -w
++option.
++
++.TP
++.BI \-nw
++Become a daemon process immediately (nowait) rather than waiting until an IP
++address has been acquired.
++
++.TP
++.BI \-w
++Keep running even if no network interfaces are found.  The
++.B omshell
++program can be used to notify the client when a network interface has been
++added or removed so it can attempt to configure an IP address on that
++interface.
++
++.TP
++.BI \-B
++Set the BOOTP broadcast flag in request packets so servers will always
++broadcast replies.
++
++.TP
++.BI \-I\ <dhcp-client-identifier>
++Specify the dhcp-client-identifier option to send to the DHCP server.
++
++.TP
++.BI \-H\ <host-name>
++Specify the host-name option to send to the DHCP server.  The host-name
++string only contains the client's hostname prefix, to which the server will
++append the ddns-domainname or domain-name options, if any, to derive the
++fully qualified domain name of the client.  The
++.B -H
++option cannot be used with the
++.B -F
++option.
++
++.TP
++.BI \-F\ <fqdn.fqdn>
++Specify the fqdn.fqdn option to send to the DHCP server.  This option cannot
++be used with the
++.B -H
++option.  The fqdn.fqdn option must specify the complete domain name of the
++client host, which the server may use for dynamic DNS updates.
++
++.TP
++.BI \-V\ <vendor-class-identifier>
++Specify the vendor-class-identifier option to send to the DHCP server.
++
++.TP
++.BI \-R\ <option>[,<option>...]
++Specify the list of options the client is to request from the server.  The
++option list must be a single string consisting of option names separated
++by at least one command and optional space characters.  The default option
++list is:
++
++.BR
++    subnet-mask, broadcast-address, time-offset, routers,
++.BR
++    domain-name, domain-name-servers, host-name, nis-domain,
++.BR
++    nis-servers, ntp-servers
++
+ The
+-.B -r
+-flag explicitly releases the current lease, and once the lease has been
+-released, the client exits.
++.B -R
++option does not append options to the default request, it overrides the
++default request list.  Keep this in mind if you want to request an
++additional option besides the default request list.  You will have to
++specify all option names for the
++.B -R
++parameter.
++
++.TP
++.BI \-T\ <timeout>
++Specify the time after which
++.B dhclient
++will decide that no DHCP servers can be contacted when no responses have been
++received.
++
++.TP
++.BI \-v
++Enable verbose log messages.
++
+ .PP
+ If the client is killed by a signal (for example at shutdown or reboot)
+ it won't execute the
+@@ -253,57 +386,7 @@ or
+ it will execute
+ .B dhclient-script (8)
+ at shutdown with the specific reason for calling the script set.
+-.PP
+-The
+-.B -1
+-flag will cause dhclient to try once to get a lease.  If it fails, dhclient
+-exits with exit code two.
+-.PP
+-The DHCP client normally gets its configuration information from
+-.B ETCDIR/dhclient.conf,
+-its lease database from
+-.B DBDIR/dhclient.leases,
+-stores its process ID in a file called
+-.B RUNDIR/dhclient.pid,
+-and configures the network interface using
+-.B CLIENTBINDIR/dhclient-script
+-To specify different names and/or locations for these files, use the
+-.B -cf,
+-.B -lf,
+-.B -pf
+-and
+-.B -sf
+-flags, respectively, followed by the name of the file.   This can be
+-particularly useful if, for example,
+-.B DBDIR
+-or
+-.B RUNDIR
+-has not yet been mounted when the DHCP client is started.
+-.PP
+-The DHCP client normally exits if it isn't able to identify any
+-network interfaces to configure.   On laptop computers and other
+-computers with hot-swappable I/O buses, it is possible that a
+-broadcast interface may be added after system startup.   The
+-.B -w
+-flag can be used to cause the client not to exit when it doesn't find
+-any such interfaces.   The
+-.B omshell (1)
+-program can then be used to notify the client when a network interface
+-has been added or removed, so that the client can attempt to configure an IP
+-address on that interface.
+-.PP
+-The DHCP client can be directed not to attempt to configure any interfaces
+-using the
+-.B -n
+-flag.   This is most likely to be useful in combination with the
+-.B -w
+-flag.
+-.PP
+-The client can also be instructed to become a daemon immediately, rather
+-than waiting until it has acquired an IP address.   This can be done by
+-supplying the
+-.B -nw
+-flag.
++
+ .SH CONFIGURATION
+ The syntax of the dhclient.conf(5) file is discussed separately.
+ .SH OMAPI

dhcp-4.0.0-options.patch:

Index: dhcp-4.0.0-options.patch
===================================================================
RCS file: dhcp-4.0.0-options.patch
diff -N dhcp-4.0.0-options.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ dhcp-4.0.0-options.patch	13 Jan 2008 21:02:47 -0000	1.3
@@ -0,0 +1,401 @@
+diff -up dhcp-4.0.0/common/conflex.c.options dhcp-4.0.0/common/conflex.c
+--- dhcp-4.0.0/common/conflex.c.options	2007-12-29 11:13:51.000000000 -1000
++++ dhcp-4.0.0/common/conflex.c	2007-12-29 11:13:51.000000000 -1000
+@@ -769,6 +769,8 @@ intern(char *atom, enum dhcp_token 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"))
+diff -up dhcp-4.0.0/includes/dhcpd.h.options dhcp-4.0.0/includes/dhcpd.h
+--- dhcp-4.0.0/includes/dhcpd.h.options	2007-12-29 11:13:51.000000000 -1000
++++ dhcp-4.0.0/includes/dhcpd.h	2007-12-29 11:13:51.000000000 -1000
+@@ -1055,6 +1055,9 @@ struct client_config {
+ 	int do_forward_update;		/* If nonzero, and if we have the
+ 					   information we need, update the
+ 					   A record for the address we get. */
++
++	int bootp_broadcast_always;	/* If nonzero, always set the BOOTP_BROADCAST
++					   flag in requests */
+ };
+ 
+ /* Per-interface state used in the dhcp client... */
+diff -up dhcp-4.0.0/includes/dhctoken.h.options dhcp-4.0.0/includes/dhctoken.h
+--- dhcp-4.0.0/includes/dhctoken.h.options	2007-10-31 09:13:33.000000000 -1000
++++ dhcp-4.0.0/includes/dhctoken.h	2007-12-29 11:13:51.000000000 -1000
+@@ -345,7 +345,8 @@ enum dhcp_token {
+ 	RANGE6 = 648,
+ 	WHITESPACE = 649,
+ 	TOKEN_ALSO = 650,
+-	AFTER = 651
++	AFTER = 651,
++	BOOTP_BROADCAST_ALWAYS = 652
+ };
+ 
+ #define is_identifier(x)	((x) >= FIRST_TOKEN &&	\
+diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
+--- dhcp-4.0.0/client/dhclient.c.options	2007-11-30 11:51:42.000000000 -1000
++++ dhcp-4.0.0/client/dhclient.c	2007-12-29 11:14:15.000000000 -1000
+@@ -37,6 +37,12 @@
+ #include <sys/wait.h>
+ #include <limits.h>
+ 
++/*
++ * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define
++ * that when building ISC code.
++ */
++extern int asprintf(char **strp, const char *fmt, ...);
++
+ TIME default_lease_time = 43200; /* 12 hours... */
+ TIME max_lease_time = 86400; /* 24 hours... */
+ 
+@@ -75,6 +81,9 @@ int onetry=0;
+ int quiet=1;
+ int nowait=0;
+ char *mockup_relay = NULL;
++int bootp_broadcast_always = 0;
++
++extern u_int32_t default_requested_options[];
+ 
+ static void usage PROTO ((void));
+ 
+@@ -100,6 +109,15 @@ main(int argc, char **argv) {
+ 	int no_dhclient_script = 0;
+ 	int local_family_set = 0;
+ 	char *s;
++	char *dhcp_client_identifier_arg = NULL;
++	char *dhcp_host_name_arg = NULL;
++	char *dhcp_fqdn_arg = NULL;
++	char *dhcp_vendor_class_identifier_arg = NULL;
++	char *dhclient_request_options = NULL;
++
++	int timeout_arg = 0;
++	char *arg_conf = NULL;
++	int arg_conf_len = 0;
+ 
+ 	/* Initialize client globals. */
+ 	memset(&default_duid, 0, sizeof(default_duid));
+@@ -224,6 +242,88 @@ main(int argc, char **argv) {
+ 		} else if (!strcmp (argv [i], "--version")) {
+ 			log_info ("isc-dhclient-%s", PACKAGE_VERSION);
+ 			exit (0);
++		} else if (!strcmp (argv [i], "-I")) {
++			if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++				usage ();
++				return EXIT_FAILURE;
++			}
++
++			if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
++				log_error("-I option dhcp-client-identifier string \"%s\" is too long - maximum length is: %d",  argv[i], DHCP_MAX_OPTION_LEN-1);
++				exit(1);
++			}
++
++			dhcp_client_identifier_arg = argv[i];
++		} else if (!strcmp (argv [i], "-B")) {
++			bootp_broadcast_always = 1;
++		} else if (!strcmp (argv [i], "-H")) {
++			if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++				usage ();
++				return EXIT_FAILURE;
++			}
++
++			if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
++				log_error("-H option host-name string \"%s\" is too long - maximum length is: %d",  argv[i], DHCP_MAX_OPTION_LEN-1);
++				exit(1);
++			}
++
++			if (dhcp_host_name_arg != NULL) {
++				log_error("The -H <host-name> and -F <fqdn> arguments are mutually exclusive");
++				exit(1);
++			}
++
++			dhcp_host_name_arg = argv[i];
++		} else if (!strcmp (argv [i], "-F")) {
++			if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++				usage ();
++				return EXIT_FAILURE;
++			}
++
++			if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
++				log_error("-F option fqdn.fqdn string \"%s\" is too long - maximum length is: %d",  argv[i], DHCP_MAX_OPTION_LEN-1);
++				exit(1);
++			}
++
++			if (dhcp_fqdn_arg != NULL) {
++				log_error("Only one -F <fqdn> argument can be specified");
++				exit(1);
++			}
++
++			if (dhcp_host_name_arg != NULL) {
++				log_error("The -F <fqdn> and -H <host-name> arguments are mutually exclusive");
++				exit(1);
++			}
++
++			dhcp_fqdn_arg = argv[i];
++		} else if (!strcmp (argv [i], "-T")) {
++			if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++				usage ();
++				return EXIT_FAILURE;
++			}
++
++			if ((timeout_arg = atoi(argv[i])) <= 0) {
++				log_error("-T timeout option must be > 0 - bad value: %s",argv[i]);
++				exit(1);
++			}
++		} else if (!strcmp (argv [i], "-V")) {
++			if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++				usage ();
++				return EXIT_FAILURE;
++			}
++
++			if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
++				log_error("-V option vendor-class-identifier string \"%s\" is too long - maximum length is: %d",  argv[i], DHCP_MAX_OPTION_LEN-1);
++				exit(1);
++			}
++
++			dhcp_vendor_class_identifier_arg = argv[i];
++		} else if (!strcmp (argv [i], "-R")) {
++			if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
++				usage ();
++				return EXIT_FAILURE;
++			}
++
++			dhclient_request_options=argv[i];
+  		} else if (argv [i][0] == '-') {
+  		    usage ();
+ 		} else {
+@@ -370,6 +470,166 @@ main(int argc, char **argv) {
+ 	/* Parse the dhclient.conf file. */
+ 	read_client_conf ();
+ 
++	/* Parse any extra command line configuration arguments: */
++	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);
++
++		if ((arg_conf == 0) || (arg_conf_len <= 0))
++			log_fatal("Unable to send -I option dhcp-client-identifier");
++	}
++
++	if ((dhcp_host_name_arg != NULL) && (*dhcp_host_name_arg != '\0')) {
++		if (arg_conf == 0) {
++			arg_conf_len = asprintf(&arg_conf, "send host-name \"%s\";", dhcp_host_name_arg);
++
++			if ((arg_conf == 0) || (arg_conf_len <= 0))
++				log_fatal("Unable to send -H option host-name");
++		} else {
++			char *last_arg_conf = arg_conf;
++			arg_conf = NULL;
++			arg_conf_len = asprintf( &arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg);
++
++			if ((arg_conf == 0) || (arg_conf_len <= 0))
++				log_fatal("Unable to send -H option host-name");
++
++			free(last_arg_conf);
++		}
++	}
++
++	if ((dhcp_fqdn_arg != NULL) && (*dhcp_fqdn_arg != '\0')) {
++		if (arg_conf == 0) {
++			arg_conf_len = asprintf(&arg_conf,  "send fqdn.fqdn \"%s\";", dhcp_fqdn_arg);
++
++			if ((arg_conf == 0) || (arg_conf_len <= 0))
++				log_fatal("Unable to send -F option fqdn.fqdn");
++		} else {
++			char *last_arg_conf = arg_conf;
++			arg_conf = NULL;
++			arg_conf_len = asprintf( &arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg);
++
++			if ((arg_conf == 0)  || (arg_conf_len <= 0))
++				log_fatal("Unable to send -F option fqdn.fqdn");
++
++			free(last_arg_conf);
++		}
++	}
++
++	if (timeout_arg) {
++		if (arg_conf == 0) {
++			arg_conf_len = asprintf(&arg_conf,  "timeout %d;", timeout_arg);
++
++			if ((arg_conf == 0) || (arg_conf_len <= 0))
++				log_fatal("Unable to process -T timeout argument");
++		} else {
++			char *last_arg_conf = arg_conf;
++			arg_conf = NULL;
++			arg_conf_len = asprintf( &arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
++
++			if ((arg_conf == 0) || (arg_conf_len == 0))
++				log_fatal("Unable to process -T timeout argument");
++
++			free(last_arg_conf);
++		}
++	}
++
++	if ((dhcp_vendor_class_identifier_arg != NULL) && (*dhcp_vendor_class_identifier_arg != '\0')) {
++		if (arg_conf == 0) {
++			arg_conf_len = asprintf(&arg_conf,  "send vendor-class-identifier \"%s\";", dhcp_vendor_class_identifier_arg);
++
++			if ((arg_conf == 0) || (arg_conf_len <= 0))
++				log_fatal("Unable to send -V option vendor-class-identifier");
++		} else {
++			char *last_arg_conf = arg_conf;
++			arg_conf = NULL;
++			arg_conf_len = asprintf(&arg_conf, "%s\nsend vendor-class-identifier \"%s\";", last_arg_conf, dhcp_vendor_class_identifier_arg);
++
++			if ((arg_conf == 0) || (arg_conf_len <= 0))
++				log_fatal("Unable to send -V option vendor-class-identifier");
++
++			free(last_arg_conf);
++		}
++	}
++
++	if (dhclient_request_options != NULL) {
++		if (arg_conf == 0) {
++			arg_conf_len = asprintf(&arg_conf,  "request %s;", dhclient_request_options);
++
++			if ((arg_conf == 0) || (arg_conf_len <= 0))
++				log_fatal("Unable to parse -R <request options list> argument");
++		} else {
++			char *last_arg_conf = arg_conf;
++			arg_conf = NULL;
++			arg_conf_len = asprintf(&arg_conf, "%s\nrequest %s;", last_arg_conf, dhclient_request_options);
++
++			if ((arg_conf == 0)  || (arg_conf_len <= 0))
++				log_fatal("Unable to parse -R <request options list> argument");
++
++			free(last_arg_conf);
++		}
++	}
++
++	if (arg_conf) {
++		if (arg_conf_len == 0)
++			if ((arg_conf_len = strlen(arg_conf)) == 0)
++				/* huh ? cannot happen ! */
++				log_fatal("Unable to process -I/-H/-F/-T/-V/-R configuration arguments");
++
++		/* parse the extra dhclient.conf configuration arguments
++		 * into top level config: */
++		struct parse *cfile = (struct parse *)0;
++		const char *val = NULL;
++		int token;
++
++		status = new_parse (&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-T/-V/-R configuration arguments", 0);
++
++		if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred))
++			log_fatal("Cannot parse -I/-H/-F/-T/-V/-R configuration arguments !");
++		/* more detailed parse failures will be logged */
++
++		do {
++			token = peek_token (&val, (unsigned *)0, cfile);
++			if (token == END_OF_FILE)
++				break;
++
++			parse_client_statement (cfile, (struct interface_info *)0, &top_level_config);
++		} while (1);
++
++		if (cfile -> warnings_occurred)
++			log_fatal ("Cannot parse -I/-H/-F/-T/-V/-R configuration arguments !");
++		end_parse (&cfile);
++
++		if (timeout_arg) {
++			/* we just set the toplevel timeout, but per-client
++			 * timeouts may still be at defaults. Also, it makes no
++			 * sense having the reboot_timeout or backoff_cutoff
++			 * greater than the timeout:
++			 */
++			if ((top_level_config.backoff_cutoff == 15) && (top_level_config.backoff_cutoff > (timeout_arg / 2)))
++				top_level_config.backoff_cutoff = (((unsigned long)(timeout_arg / 2)) == 0) ? timeout_arg : (unsigned long)(timeout_arg / 2);
++
++			for (ip = interfaces; ip; ip = ip -> next) {
++				if (ip->client->config->timeout == 60)
++					ip->client->config->timeout = timeout_arg;
++
++				if ((ip->client->config->reboot_timeout == 10) && (ip->client->config->reboot_timeout > ip->client->config->timeout))
++					ip->client->config->reboot_timeout = ip->client->config->timeout;
++				if ((ip->client->config->backoff_cutoff == 15) && (ip->client->config->backoff_cutoff > top_level_config.backoff_cutoff))
++					ip->client->config->backoff_cutoff = top_level_config.backoff_cutoff;
++			}
++		}
++
++		if ((dhclient_request_options != 0) && (top_level_config.requested_options != default_requested_options)) {
++			for (ip = interfaces; ip; ip = ip -> next) {
++				if (ip->client->config->requested_options == default_requested_options)
++					ip->client->config->requested_options = top_level_config.requested_options;
++			}
++		}
++
++		free(arg_conf);
++		arg_conf = NULL;
++		arg_conf_len = 0;
++	}
++
+ 	/* Parse the lease database. */
+ 	read_client_leases ();
+ 
+@@ -2105,7 +2365,8 @@ void make_discover (client, lease)
+ 	client -> packet.xid = random ();
+ 	client -> packet.secs = 0; /* filled in by send_discover. */
+ 
+-	if (can_receive_unicast_unconfigured (client -> interface))
++	if ((!(bootp_broadcast_always || client->config->bootp_broadcast_always))
++	    && can_receive_unicast_unconfigured(client->interface))
+ 		client -> packet.flags = 0;
+ 	else
+ 		client -> packet.flags = htons (BOOTP_BROADCAST);
+@@ -2189,7 +2450,9 @@ void make_request (client, lease)
+ 	} else {
+ 		memset (&client -> packet.ciaddr, 0,
+ 			sizeof client -> packet.ciaddr);
+-		if (can_receive_unicast_unconfigured (client -> interface))
++		if ((!(bootp_broadcast_always ||
++		    client ->config->bootp_broadcast_always)) &&
++		    can_receive_unicast_unconfigured (client -> interface))
+ 			client -> packet.flags = 0;
+ 		else
+ 			client -> packet.flags = htons (BOOTP_BROADCAST);
+@@ -2248,7 +2511,8 @@ void make_decline (client, lease)
+ 	client -> packet.hops = 0;
+ 	client -> packet.xid = client -> xid;
+ 	client -> packet.secs = 0; /* Filled in by send_request. */
+-	if (can_receive_unicast_unconfigured (client -> interface))
++	if ((!(bootp_broadcast_always || client->config-> bootp_broadcast_always))
++	    && can_receive_unicast_unconfigured (client->interface))
+ 		client -> packet.flags = 0;
+ 	else
+ 		client -> packet.flags = htons (BOOTP_BROADCAST);
+diff -up dhcp-4.0.0/client/clparse.c.options dhcp-4.0.0/client/clparse.c
+--- dhcp-4.0.0/client/clparse.c.options	2007-12-08 09:36:00.000000000 -1000
++++ dhcp-4.0.0/client/clparse.c	2007-12-29 11:13:51.000000000 -1000
+@@ -132,6 +132,7 @@ isc_result_t read_client_conf ()
+ 	/* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache)
+ 	 */
+ 	top_level_config.requested_lease = 7200;
++	top_level_config.bootp_broadcast_always = 0;
+ 
+ 	group_allocate (&top_level_config.on_receipt, MDL);
+ 	if (!top_level_config.on_receipt)
+@@ -295,7 +296,8 @@ void read_client_leases ()
+ 	interface-declaration |
+ 	LEASE client-lease-statement |
+ 	ALIAS client-lease-statement |
+-	KEY key-definition */
++	KEY key-definition |
++	BOOTP_BROADCAST_ALWAYS */
+ 
+ void parse_client_statement (cfile, ip, config)
+ 	struct parse *cfile;
+@@ -685,6 +687,12 @@ void parse_client_statement (cfile, ip, 
+ 		parse_reject_statement (cfile, config);
+ 		return;
+ 
++	      case BOOTP_BROADCAST_ALWAYS:
++		token = next_token(&val, (unsigned*)0, cfile);
++		config -> bootp_broadcast_always = 1;
++		parse_semi (cfile);
++		return;
++
+ 	      default:
+ 		lose = 0;
+ 		stmt = (struct executable_statement *)0;

dhcp-4.0.0-paths.patch:

Index: dhcp-4.0.0-paths.patch
===================================================================
RCS file: dhcp-4.0.0-paths.patch
diff -N dhcp-4.0.0-paths.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ dhcp-4.0.0-paths.patch	13 Jan 2008 21:02:47 -0000	1.3
@@ -0,0 +1,31 @@
+diff -up dhcp-4.0.0/includes/dhcpd.h.paths dhcp-4.0.0/includes/dhcpd.h
+--- dhcp-4.0.0/includes/dhcpd.h.paths	2008-01-01 15:09:21.000000000 -1000
++++ dhcp-4.0.0/includes/dhcpd.h	2008-01-01 15:10:55.000000000 -1000
+@@ -1306,11 +1306,11 @@ typedef unsigned char option_mask [16];
+ #endif /* DEBUG */
+ 
+ #ifndef _PATH_DHCPD_DB
+-#define _PATH_DHCPD_DB		LOCALSTATEDIR"/db/dhcpd.leases"
++#define _PATH_DHCPD_DB		LOCALSTATEDIR"/dhcpd/dhcpd.leases"
+ #endif
+ 
+ #ifndef _PATH_DHCPD6_DB
+-#define _PATH_DHCPD6_DB		LOCALSTATEDIR"/db/dhcpd6.leases"
++#define _PATH_DHCPD6_DB		LOCALSTATEDIR"/dhcpd/dhcpd6.leases"
+ #endif
+ 
+ #ifndef _PATH_DHCPD_PID
+@@ -1340,11 +1340,11 @@ typedef unsigned char option_mask [16];
+ #endif
+ 
+ #ifndef _PATH_DHCLIENT_DB
+-#define _PATH_DHCLIENT_DB	LOCALSTATEDIR"/db/dhclient.leases"
++#define _PATH_DHCLIENT_DB	LOCALSTATEDIR"/dhclient/dhclient.leases"
+ #endif
+ 
+ #ifndef _PATH_DHCLIENT6_DB
+-#define _PATH_DHCLIENT6_DB	LOCALSTATEDIR"/db/dhclient6.leases"
++#define _PATH_DHCLIENT6_DB	LOCALSTATEDIR"/dhclient/dhclient6.leases"
+ #endif
+ 
+ #ifndef _PATH_RESOLV_CONF

dhcp-4.0.0-server-Makefile.patch:

--- NEW FILE dhcp-4.0.0-server-Makefile.patch ---
diff -up dhcp-4.0.0/server/Makefile.am.mf dhcp-4.0.0/server/Makefile.am
--- dhcp-4.0.0/server/Makefile.am.mf	2008-01-12 12:40:59.000000000 -1000
+++ dhcp-4.0.0/server/Makefile.am	2008-01-12 12:41:55.000000000 -1000
@@ -6,10 +6,8 @@ dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c c
 		omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c \
 		dhcpv6.c mdb6.c ldap.c ldap_casa.c
 
-# libomapi.a this is here twice to handle circular library dependencies :(
-dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a ../dst/libdst.a \
-	      ../dhcpctl/libdhcpctl.a ../minires/libres.a \
-	      ../omapip/libomapi.a -lldap
+dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a ../minires/libres.a \
+	      ../dhcpctl/libdhcpctl.a ../dst/libdst.a -lldap
 
 man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
 EXTRA_DIST = $(man_MANS)

dhcp-4.0.0-xen-checksum.patch:

Index: dhcp-4.0.0-xen-checksum.patch
===================================================================
RCS file: dhcp-4.0.0-xen-checksum.patch
diff -N dhcp-4.0.0-xen-checksum.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ dhcp-4.0.0-xen-checksum.patch	13 Jan 2008 21:02:47 -0000	1.3
@@ -0,0 +1,245 @@
+diff -up dhcp-4.0.0/common/nit.c.xen dhcp-4.0.0/common/nit.c
+--- dhcp-4.0.0/common/nit.c.xen	2007-09-05 07:32:10.000000000 -1000
++++ dhcp-4.0.0/common/nit.c	2007-12-29 06:39:16.000000000 -1000
+@@ -366,7 +366,7 @@ ssize_t receive_packet (interface, buf, 
+ 
+ 	/* Decode the IP and UDP headers... */
+ 	offset = decode_udp_ip_header (interface, ibuf, bufix,
+-				       from, length, &paylen);
++				       from, length, &paylen, 0);
+ 
+ 	/* If the IP or UDP checksum was bad, skip the packet... */
+ 	if (offset < 0)
+diff -up dhcp-4.0.0/common/dlpi.c.xen dhcp-4.0.0/common/dlpi.c
+--- dhcp-4.0.0/common/dlpi.c.xen	2007-10-08 04:27:53.000000000 -1000
++++ dhcp-4.0.0/common/dlpi.c	2007-12-29 06:39:13.000000000 -1000
+@@ -689,7 +689,7 @@ ssize_t receive_packet (interface, buf, 
+ 	length -= offset;
+ #endif
+ 	offset = decode_udp_ip_header (interface, dbuf, bufix,
+-				       from, length, &paylen);
++				       from, length, &paylen, 0);
+ 
+ 	/* If the IP or UDP checksum was bad, skip the packet... */
+ 	if (offset < 0) {
+diff -up dhcp-4.0.0/common/upf.c.xen dhcp-4.0.0/common/upf.c
+--- dhcp-4.0.0/common/upf.c.xen	2007-07-12 20:43:42.000000000 -1000
++++ dhcp-4.0.0/common/upf.c	2007-12-29 06:39:24.000000000 -1000
+@@ -317,7 +317,7 @@ ssize_t receive_packet (interface, buf, 
+ 
+ 	/* Decode the IP and UDP headers... */
+ 	offset = decode_udp_ip_header (interface, ibuf, bufix,
+-				       from, length, &paylen);
++				       from, length, &paylen, 0);
+ 
+ 	/* If the IP or UDP checksum was bad, skip the packet... */
+ 	if (offset < 0)
+diff -up dhcp-4.0.0/common/lpf.c.xen dhcp-4.0.0/common/lpf.c
+--- dhcp-4.0.0/common/lpf.c.xen	2007-12-29 06:37:53.000000000 -1000
++++ dhcp-4.0.0/common/lpf.c	2007-12-29 06:43:08.000000000 -1000
+@@ -29,18 +29,33 @@
+ #include "dhcpd.h"
+ #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
+ #include <sys/ioctl.h>
++#include <sys/socket.h>
+ #include <sys/uio.h>
+ #include <errno.h>
+ 
+ #include <asm/types.h>
+ #include <linux/filter.h>
+ #include <linux/if_ether.h>
++#include <linux/if_packet.h>
+ #include <netinet/in_systm.h>
+ #include "includes/netinet/ip.h"
+ #include "includes/netinet/udp.h"
+ #include "includes/netinet/if_ether.h"
+ #include <net/if.h>
+ 
++#ifndef PACKET_AUXDATA
++#define PACKET_AUXDATA 8
++
++struct tpacket_auxdata
++{
++	__u32		tp_status;
++	__u32		tp_len;
++	__u32		tp_snaplen;
++	__u16		tp_mac;
++	__u16		tp_net;
++};
++#endif
++
+ /* Reinitializes the specified interface after an address change.   This
+    is not required for packet-filter APIs. */
+ 
+@@ -66,10 +81,14 @@ int if_register_lpf (info)
+ 	struct interface_info *info;
+ {
+ 	int sock;
+-	struct sockaddr sa;
++	union {
++		struct sockaddr_ll ll;
++		struct sockaddr common;
++	} sa;
++	struct ifreq ifr;
+ 
+ 	/* Make an LPF socket. */
+-	if ((sock = socket(PF_PACKET, SOCK_PACKET,
++	if ((sock = socket(PF_PACKET, SOCK_RAW,
+ 			   htons((short)ETH_P_ALL))) < 0) {
+ 		if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
+ 		    errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
+@@ -84,11 +103,16 @@ int if_register_lpf (info)
+ 		log_fatal ("Open a socket for LPF: %m");
+ 	}
+ 
++	memset (&ifr, 0, sizeof ifr);
++	strncpy (ifr.ifr_name, (const char *)info -> ifp, sizeof ifr.ifr_name);
++	if (ioctl (sock, SIOCGIFINDEX, &ifr))
++		log_fatal ("Failed to get interface index: %m");
++
+ 	/* Bind to the interface name */
+ 	memset (&sa, 0, sizeof sa);
+-	sa.sa_family = AF_PACKET;
+-	strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data);
+-	if (bind (sock, &sa, sizeof sa)) {
++	sa.ll.sll_family = AF_PACKET;
++	sa.ll.sll_ifindex = ifr.ifr_ifindex;
++	if (bind (sock, &sa.common, sizeof sa)) {
+ 		if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
+ 		    errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
+ 		    errno == EAFNOSUPPORT || errno == EINVAL) {
+@@ -170,9 +194,18 @@ static void lpf_gen_filter_setup (struct
+ void if_register_receive (info)
+ 	struct interface_info *info;
+ {
++	int val;
++
+ 	/* Open a LPF device and hang it on this interface... */
+ 	info -> rfdesc = if_register_lpf (info);
+ 
++	val = 1;
++	if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val,
++			sizeof val) < 0) {
++		if (errno != ENOPROTOOPT)
++			log_fatal ("Failed to set auxiliary packet data: %m");
++	}
++
+ #if defined (HAVE_TR_SUPPORT)
+ 	if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
+ 		lpf_tr_filter_setup (info);
+@@ -291,7 +324,6 @@ ssize_t send_packet (interface, packet, 
+ 	double hh [16];
+ 	double ih [1536 / sizeof (double)];
+ 	unsigned char *buf = (unsigned char *)ih;
+-	struct sockaddr sa;
+ 	int result;
+ 	int fudge;
+ 
+@@ -309,15 +341,7 @@ ssize_t send_packet (interface, packet, 
+ 				(unsigned char *)raw, len);
+ 	memcpy (buf + ibufp, raw, len);
+ 
+-	/* For some reason, SOCK_PACKET sockets can't be connected,
+-	   so we have to do a sentdo every time. */
+-	memset (&sa, 0, sizeof sa);
+-	sa.sa_family = AF_PACKET;
+-	strncpy (sa.sa_data,
+-		 (const char *)interface -> ifp, sizeof sa.sa_data);
+-
+-	result = sendto (interface -> wfdesc,
+-			 buf + fudge, ibufp + len - fudge, 0, &sa, sizeof sa);
++	result = write (interface -> wfdesc, buf + fudge, ibufp + len - fudge);
+ 	if (result < 0)
+ 		log_error ("send_packet: %m");
+ 	return result;
+@@ -334,14 +358,35 @@ ssize_t receive_packet (interface, buf, 
+ {
+ 	int length = 0;
+ 	int offset = 0;
++	int nocsum = 0;
+ 	unsigned char ibuf [1536];
+ 	unsigned bufix = 0;
+ 	unsigned paylen;
++	unsigned char cmsgbuf[CMSG_LEN(sizeof(struct tpacket_auxdata))];
++	struct iovec iov = {
++		.iov_base = ibuf,
++		.iov_len = sizeof ibuf,
++	};
++	struct msghdr msg = {
++		.msg_iov = &iov,
++		.msg_iovlen = 1,
++		.msg_control = cmsgbuf,
++		.msg_controllen = sizeof(cmsgbuf),
++	};
++	struct cmsghdr *cmsg;
+ 
+-	length = read (interface -> rfdesc, ibuf, sizeof ibuf);
++	length = recvmsg (interface -> rfdesc, &msg, 0);
+ 	if (length <= 0)
+ 		return length;
+ 
++	for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
++		if (cmsg->cmsg_level == SOL_PACKET &&
++		    cmsg->cmsg_type == PACKET_AUXDATA) {
++			struct tpacket_auxdata *aux = (void *)CMSG_DATA(cmsg);
++			nocsum = aux->tp_status & TP_STATUS_CSUMNOTREADY;
++		}
++	}
++
+ 	bufix = 0;
+ 	/* Decode the physical header... */
+ 	offset = decode_hw_header (interface, ibuf, bufix, hfrom);
+@@ -358,7 +403,7 @@ ssize_t receive_packet (interface, buf, 
+ 
+ 	/* Decode the IP and UDP headers... */
+ 	offset = decode_udp_ip_header (interface, ibuf, bufix, from,
+-				       (unsigned)length, &paylen);
++				       (unsigned)length, &paylen, nocsum);
+ 
+ 	/* If the IP or UDP checksum was bad, skip the packet... */
+ 	if (offset < 0)
+diff -up dhcp-4.0.0/common/bpf.c.xen dhcp-4.0.0/common/bpf.c
+--- dhcp-4.0.0/common/bpf.c.xen	2007-08-22 23:49:51.000000000 -1000
++++ dhcp-4.0.0/common/bpf.c	2007-12-29 06:39:09.000000000 -1000
+@@ -482,7 +482,7 @@ ssize_t receive_packet (interface, buf, 
+ 		offset = decode_udp_ip_header (interface,
+ 					       interface -> rbuf,
+ 					       interface -> rbuf_offset,
+-  					       from, hdr.bh_caplen, &paylen);
++  					       from, hdr.bh_caplen, &paylen, 0);
+ 
+ 		/* If the IP or UDP checksum was bad, skip the packet... */
+ 		if (offset < 0) {
+diff -up dhcp-4.0.0/common/packet.c.xen dhcp-4.0.0/common/packet.c
+--- dhcp-4.0.0/common/packet.c.xen	2007-12-29 06:37:53.000000000 -1000
++++ dhcp-4.0.0/common/packet.c	2007-12-29 06:39:20.000000000 -1000
+@@ -210,7 +210,7 @@ ssize_t
+ decode_udp_ip_header(struct interface_info *interface,
+ 		     unsigned char *buf, unsigned bufix,
+ 		     struct sockaddr_in *from, unsigned buflen,
+-		     unsigned *rbuflen)
++		     unsigned *rbuflen, int nocsum)
+ {
+   unsigned char *data;
+   struct ip ip;
+@@ -321,7 +321,7 @@ decode_udp_ip_header(struct interface_in
+ 					   8, IPPROTO_UDP + ulen))));
+ 
+   udp_packets_seen++;
+-  if (usum && usum != sum) {
++  if (!nocsum && usum && usum != sum) {
+ 	  udp_packets_bad_checksum++;
+ 	  if (udp_packets_seen > 4 &&
+ 	      (udp_packets_seen / udp_packets_bad_checksum) < 2) {
+diff -up dhcp-4.0.0/includes/dhcpd.h.xen dhcp-4.0.0/includes/dhcpd.h
+--- dhcp-4.0.0/includes/dhcpd.h.xen	2007-12-29 06:37:53.000000000 -1000
++++ dhcp-4.0.0/includes/dhcpd.h	2007-12-29 06:39:27.000000000 -1000
+@@ -2561,7 +2561,7 @@ ssize_t decode_hw_header PROTO ((struct 
+ 				 unsigned, struct hardware *));
+ ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
+ 				     unsigned, struct sockaddr_in *,
+-				     unsigned, unsigned *));
++				     unsigned, unsigned *, int));
+ 
+ /* ethernet.c */
+ void assemble_ethernet_header PROTO ((struct interface_info *, unsigned char *,


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/.cvsignore,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- .cvsignore	11 Jan 2008 00:19:03 -0000	1.21
+++ .cvsignore	13 Jan 2008 21:02:47 -0000	1.22
@@ -1 +1 @@
-dhcp-3.1.0.tar.gz
+dhcp-4.0.0.tar.gz


Index: dhcp.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcp.spec,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -r1.191 -r1.192
--- dhcp.spec	11 Jan 2008 00:49:46 -0000	1.191
+++ dhcp.spec	13 Jan 2008 21:02:47 -0000	1.192
@@ -1,19 +1,10 @@
-# Use 64-bit pointers on POWER and z/Series
-%ifarch ppc64 s390x
-%define bigptrs -DPTRSIZE_64BIT
-%endif
-
-# The workdir is used in the build system for ISC dhcp, we set it to this
-# value to avoid any problems guessing what it might be during installation.
-%define workdir work.linux-2.2
-
-# The vendor name to append to the version number
+# vendor string (e.g., Fedora, EL)
 %define vvendor Fedora
 
 Summary:  DHCP (Dynamic Host Configuration Protocol) server and relay agent
 Name:     dhcp
-Version:  3.1.0
-Release:  12%{?dist}
+Version:  4.0.0
+Release:  1%{?dist}
 # NEVER CHANGE THE EPOCH on this package.  The previous maintainer made
 # incorrect use of the epoch and that's why it is at 12 now.  It should have
 # never been used, but it was.  So we are stuck with it.
@@ -22,49 +13,40 @@
 Group:    System Environment/Daemons
 URL:      http://isc.org/products/DHCP/
 Source0:  ftp://ftp.isc.org/isc/%{name}/%{name}-%{version}.tar.gz
-Source1:  dhcpd.conf.sample
-Source2:  dhcpd.init
-Source3:  dhcrelay.init
-Source4:  dhcpd.conf
-Source5:  libdhcp4client.pc
-Source6:  README.ldap
-Source7:  draft-ietf-dhc-ldap-schema-01.txt
-Source8:  dhcpd-conf-to-ldap
-Source9:  linux
-Source10: Makefile.libdhcp4client
-Source11: dhcp4client.h
-Source12: libdhcp_control.h
-Source13: dhcp.schema
-Source14: dhclient-script.8
-Source15: dhclient.8
-Source16: dhclient.conf.5
-Source17: dhcp-options.5
-Source18: dhcpctl.3
-Source19: dhcpd.conf.5
-Source20: get-ldap-patch.sh
-
-Patch0:   %{name}-3.0.5-Makefile.patch
-Patch1:   %{name}-3.0.5-errwarn-message.patch
-Patch2:   %{name}-3.1.0-ldap-configuration.patch
-Patch3:   %{name}-3.0.6-memory.patch
-Patch4:   %{name}-3.1.0-options.patch
-Patch5:   %{name}-3.0.5-release-by-ifup.patch
-Patch6:   %{name}-3.0.5-dhclient-decline-backoff.patch
-Patch7:   %{name}-3.0.5-enable-timeout-functions.patch
-Patch8:   %{name}-3.0.5-inherit-leases.patch
-Patch9:   %{name}-3.0.5-unicast-bootp.patch
-Patch10:  %{name}-3.0.5-fast-timeout.patch
-Patch11:  %{name}-3.0.5-failover-ports.patch
-Patch12:  %{name}-3.1.0-dhclient-usage.patch
-Patch13:  %{name}-3.0.5-default-requested-options.patch
-Patch14:  %{name}-3.0.5-prototypes.patch
-Patch15:  %{name}-3.1.0-libdhcp4client.patch
-Patch16:  %{name}-3.1.0-xen-checksum.patch
-Patch17:  %{name}-3.1.0-dhclient-anycast.patch
-Patch18:  %{name}-3.0.6-ignore-hyphen-x.patch
-Patch19:  %{name}-3.1.0-warnings.patch
+Source1:  dhcpd.init
+Source2:  dhcrelay.init
+Source3:  libdhcp4client.pc
+Source5:  README.ldap
+Source6:  draft-ietf-dhc-ldap-schema-01.txt
+Source7:  dhcpd-conf-to-ldap
+Source8:  linux
+Source9:  dhcp4client.h
+Source10: libdhcp_control.h
+Source11: dhcp.schema
+Source12: get-ldap-patch.sh
+
+Patch0:   %{name}-3.0.5-errwarn-message.patch
+Patch1:   %{name}-4.0.0-ldap-configuration.patch
+Patch2:   %{name}-3.0.6-memory.patch
+Patch3:   %{name}-4.0.0-options.patch
+Patch4:   %{name}-3.0.5-release-by-ifup.patch
+Patch5:   %{name}-3.0.5-dhclient-decline-backoff.patch
+Patch6:   %{name}-3.0.5-enable-timeout-functions.patch
+Patch7:   %{name}-3.0.5-unicast-bootp.patch
+Patch8:   %{name}-4.0.0-fast-timeout.patch
+Patch9:   %{name}-3.0.5-failover-ports.patch
+Patch10:  %{name}-4.0.0-dhclient-usage.patch
+Patch11:  %{name}-4.0.0-default-requested-options.patch
+Patch12:  %{name}-4.0.0-xen-checksum.patch
+Patch13:  %{name}-4.0.0-dhclient-anycast.patch
+Patch14:  %{name}-4.0.0-manpages.patch
+Patch15:  %{name}-4.0.0-paths.patch
+Patch16:  %{name}-4.0.0-libdhcp4client.patch
+Patch17:  %{name}-4.0.0-server-Makefile.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires: autoconf
+BuildRequires: automake
 BuildRequires: groff
 BuildRequires: openldap-devel
 
@@ -136,221 +118,198 @@
 Dynamic Host Configuration Protocol (DHCP) Internet Protocol version 4 (IPv4)
 client library.
 
-%package -n libdhcp4client-static
-Summary: Static archive for libdhcp4client
-Group: Development/Libraries
-Requires: libdhcp4client-devel = %{epoch}:%{version}-%{release}
-
-%description -n libdhcp4client-static
-The libdhcp4client-static package contains the static archive for
-libdhcp4client.
-
 %prep
 %setup -q
 
-# Add vendor to the version number
-%{__sed} -e 's|V%{version}|V%{version}-%{vvendor}|g' includes/version.h > includes/version.h.new
-%{__mv} includes/version.h.new includes/version.h
-
-# Use $(MAKE) and $(CC) in the Makefiles
-%patch0 -p1 -b .Makefile
-
 # 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
 # reported through bugzilla.redhat.com
-%patch1 -p1 -b .message
+%patch0 -p1
 
 # Add support for dhcpd.conf data in LDAP
-%patch2 -p1 -b .ldap
+# NOTE: Use get-ldap-patch.sh to pull down latest LDAP patch and then modify
+# it for this package.
+%patch1 -p1
 
 # Fix memory alignment and initialization problems in common/packet.c
 # Fix buffer overflow in minires library
 # Init struct sock_prog in common/lpf.c to NULL
-%patch3 -p1 -b .memory
+%patch2 -p1
 
 # Add more dhclient options (-I, -B, -H, -F, -T, -V, and -R)
-%patch4 -p1 -b .options
+%patch3 -p1
 
 # Handle releasing interfaces requested by /sbin/ifup
 # pid file is assumed to be /var/run/dhclient-$interface.pid
-%patch5 -p1 -b .release
+%patch4 -p1
 
 # If we receive a DHCP offer in dhclient and it's DECLINEd in dhclient-script,
 # backoff for an amount of time before trying again
-%patch6 -p1 -b .decline
+%patch5 -p1
 
 # Enable cancel_all_timeouts() and relinquish_timeouts() regardless of
 # the DEBUG_MEMORY_LEAKAGE_ON_EXIT macro
-%patch7 -p1 -b .etf
-
-# Inherit active leases
-%patch8 -p1 -b .inherit
+%patch6 -p1
 
 # Support unicast BOOTP for IBM pSeries systems (and maybe others)
-%patch9 -p1 -b .unicast
+%patch7 -p1
 
 # Fast timeout for dhclient
-%patch10 -p1 -b .fast
+%patch8 -p1
 
 # Use the following IANA-registered failover ports:
 # dhcp-failover 647/tcp
 # dhcp-failover 647/udp
 # dhcp-failover 847/tcp
 # dhcp-failover 847/udp
-%patch11 -p1 -b .failover
+%patch9 -p1
 
 # Update the usage screen for dhclient(8) indicating new options
 # Use printf() rather than log_info() to display the information
 # Also, return EXIT_FAILURE when the usage() screen is displayed (stop parsing)
-%patch12 -p1 -b .usage
+%patch10 -p1
 
 # Add NIS domain, NIS servers, and NTP servers to the list of default
 # requested DHCP options
-%patch13 -p1 -b .dho
-
-# Add missing prototypes to take care of gcc warnings
-# in dst/dst_api.c: add b64_pton() and b64_ntop()
-# in includes/minires/minires.h: remove macro for b64_pton
-# in minires/res_mkupdate.c: add b64_pton() and dn_comp()
-# in minires/res_comp.c: add ns_name_uncompress(), ns_name_compress(), and
-#                        ns_name_skip()
-# in minires/res_init.c: add res_randomid()
-%patch14 -p1 -b .prototypes
-
-# Add the libdhcp4client target (library version of dhclient)
-%patch15 -p1 -b .libdhcp4client
+%patch11 -p1
 
 # Handle Xen partial UDP checksums
-%patch16 -p1 -b .xen
+%patch12 -p1
 
 # Add anycast support to dhclient (for OLPC)
-%patch17 -p1 -b .anycast
+%patch13 -p1
 
-# Ignore the old extended new option info command line switch (-x)
-%patch18 -p1 -b .enoi
+# Patch man page contents
+%patch14 -p1
 
-# Fix up anything that fails -Wall -Werror
-%patch19 -p1 -b .warnings
+# Change paths to conform to our standards
+%patch15 -p1
+
+# Add the libdhcp4client target (library version of dhclient)
+%patch16 -p1
+
+# Modify LDADD in server/Makefile.am
+%patch17 -p1
 
 # Copy in documentation and example scripts for LDAP patch to dhcpd
-%{__install} -p -m 0644 %{SOURCE6} .
-%{__install} -p -m 0644 %{SOURCE7} doc/
-%{__install} -p -m 0755 %{SOURCE8} contrib/
+%{__install} -p -m 0644 %{SOURCE5} .
+%{__install} -p -m 0644 %{SOURCE6} doc/
+%{__install} -p -m 0755 %{SOURCE7} contrib/
 
 # Copy in the Fedora/RHEL dhclient script
-%{__install} -p -m 0755 %{SOURCE9} client/scripts/
+%{__install} -p -m 0755 %{SOURCE8} client/scripts/
 
 # Copy in the libdhcp4client headers and Makefile.dist
-%{__mkdir} -p libdhcp4client
-%{__install} -p -m 0644 %{SOURCE10} libdhcp4client/Makefile.dist
-%{__install} -p -m 0644 %{SOURCE11} libdhcp4client/
+%{__install} -p -m 0644 %{SOURCE9} includes/
 
 # Copy in libdhcp_control.h to the isc-dhcp includes directory
-%{__install} -p -m 0644 %{SOURCE12} includes/isc-dhcp/
+%{__install} -p -m 0644 %{SOURCE10} includes/isc-dhcp/
 
 # Ensure we don't pick up Perl as a dependency from the scripts and modules
 # in the contrib directory (we copy this to /usr/share/doc in the final
 # package).
 %{__cp} -a contrib __fedora_contrib
-%{__chmod} -x __fedora_contrib/3.0b1-lease-convert
-%{__chmod} -x __fedora_contrib/dhcpd-conf-to-ldap
-%{__mv} __fedora_contrib/ms2isc/Registry.pm __fedora_contrib/ms2isc/Registry.perlmodule
-%{__rm} -f __fedora_contrib/dhcp.spec
+pushd __fedora_contrib
+%{__chmod} -x 3.0b1-lease-convert dhclient-tz-exithook.sh dhcpd-conf-to-ldap
+%{__chmod} -x sethostname.sh solaris.init
+%{__mv} ms2isc/Registry.pm ms2isc/Registry.perlmodule
+%{__rm} -f dhcp.spec
 
 # We want UNIX-style line endings
-%{__sed} -i -e 's/\r//' __fedora_contrib/ms2isc/readme.txt
-%{__sed} -i -e 's/\r//' __fedora_contrib/ms2isc/Registry.perlmodule
-%{__sed} -i -e 's/\r//' __fedora_contrib/ms2isc/ms2isc.pl
-
-# Copy in our modified man pages
-%{__install} -p -m 0644 %{SOURCE14} client/dhclient-script.8
-%{__install} -p -m 0644 %{SOURCE15} client/dhclient.8
-%{__install} -p -m 0644 %{SOURCE16} client/dhclient.conf.5
-%{__install} -p -m 0644 %{SOURCE17} common/dhcp-options.5
-%{__install} -p -m 0644 %{SOURCE18} dhcpctl/dhcpctl.3
-%{__install} -p -m 0644 %{SOURCE19} server/dhcpd.conf.5
+%{__sed} -i -e 's/\r//' ms2isc/readme.txt
+%{__sed} -i -e 's/\r//' ms2isc/Registry.perlmodule
+%{__sed} -i -e 's/\r//' ms2isc/ms2isc.pl
+popd
 
-# Replace @PRODUCTNAME@ in dhcp-options.5
+# Replace @PRODUCTNAME@
 %{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' common/dhcp-options.5
+%{__sed} -i -e 's|@PRODUCTNAME@|%{vvendor}|g' configure.ac
 
-%build
-%{__cp} %{SOURCE1} .
-%{__cat} <<EOF > site.conf
-VARDB=%{_localstatedir}/lib/dhcpd
-ADMMANDIR=%{_mandir}/man8
-FFMANDIR=%{_mandir}/man5
-LIBMANDIR=%{_mandir}/man3
-USRMANDIR=%{_mandir}/man1
-LIBDIR=%{_libdir}
-INCDIR=%{_includedir}
-EOF
-%{__cat} <<EOF >> includes/site.h
-#define _PATH_DHCPD_DB    "%{_localstatedir}/lib/dhcpd/dhcpd.leases"
-#define _PATH_DHCLIENT_DB "%{_localstatedir}/lib/dhclient/dhclient.leases"
-EOF
+aclocal
+libtoolize --copy --force
+autoconf
+autoheader
+automake --foreign --add-missing --copy
 
-# Disable gcc's strict aliasing since ISC code tends to cast a lot.
-##
-## Use -fvisibility=hidden for libdhcp4client.  The way that library is
-## constructed, we need to follow the hide-by-default/expose-what-we-need
-## plan for the library API.
-#COPTS="-fPIC -Werror -Dlint -fno-strict-aliasing -fvisibility=hidden"
-COPTS="-fPIC -Werror -Dlint -fno-strict-aliasing"
-
-# DO NOT use the %%configure macro because this configure script is not autognu
-CC="%{__cc}" ./configure \
-   --copts "$RPM_OPT_FLAGS $COPTS %{?bigptrs}" \
-   --work-dir %{workdir}
+%build
+%configure \
+    --enable-dhcpv6 \
+    --with-srv-lease-file=%{_localstatedir}/lib/dhcpd/dhcpd.leases \
+    --with-cli-lease-file=%{_localstatedir}/lib/dhclient/dhclient.leases \
+    --with-srv-pid-file=%{_localstatedir}/run/dhcpd.pid \
+    --with-cli-pid-file=%{_localstatedir}/run/dhclient.pid \
+    --with-relay-pid-file=%{_localstatedir}/run/dhcrelay.pid
+%{__make} %{?_smp_mflags}
 
-%{__sed} 's/@DHCP_VERSION@/%{version}/' < %{SOURCE5} > libdhcp4client.pc
-%{__make} %{?_smp_mflags} CC="%{__cc}"
+%{__sed} 's/@DHCP_VERSION@/%{version}/' < %{SOURCE3} > libdhcp4client.pc
 
 %install
 %{__rm} -rf %{buildroot}
-%{__mkdir} -p %{buildroot}%{_sysconfdir}/sysconfig
-
 %{__make} install DESTDIR=%{buildroot}
-%{__install} -p -m 0644 %{SOURCE12} %{buildroot}%{_includedir}/isc-dhcp/
 
+# Remove files we don't want
+%{__rm} -rf %{buildroot}%{_libdir}/libdhcp4client.a
+%{__rm} -rf %{buildroot}%{_libdir}/libdhcp4client.la
+%{__rm} %{buildroot}%{_sysconfdir}/dhclient.conf
+
+# Install correct dhclient-script
+%{__mkdir} -p %{buildroot}/sbin
+%{__mv} %{buildroot}%{_sbindir}/dhclient %{buildroot}/sbin/dhclient
+%{__install} -p -m 0755 client/scripts/linux %{buildroot}/sbin/dhclient-script
+
+# Install pkg-config file
+%{__install} -p -m 0644 %{SOURCE10} %{buildroot}%{_includedir}/isc-dhcp/
+%{__install} -p -m 0644 -D libdhcp4client.pc %{buildroot}%{_libdir}/pkgconfig/libdhcp4client.pc
+
+# Install headers for libdhcp4client-devel
+%{__mkdir} -p %{buildroot}%{_includedir}/dhcp4client/minires
+%{__install} -p -m 0644 %{SOURCE9} %{buildroot}%{_includedir}/dhcp4client
+for hdr in cdefs.h ctrace.h dhcp.h dhcp6.h dhcpd.h dhctoken.h failover.h \
+           heap.h inet.h minires/minires.h minires/res_update.h \
+           minires/resolv.h osdep.h site.h statement.h tree.h ; do
+    %{__install} -p -m 0644 includes/${hdr} %{buildroot}%{_includedir}/dhcp4client/${hdr}
+done
+
+# Install init scripts
 %{__mkdir} -p %{buildroot}%{_initrddir}
-%{__install} -p -m 0755 %{SOURCE2} %{buildroot}%{_initrddir}/dhcpd
+%{__install} -p -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/dhcpd
+%{__install} -p -m 0755 %{SOURCE2} %{buildroot}%{_initrddir}/dhcrelay
 
+# Start empty lease databases
+%{__mkdir} -p %{buildroot}%{_localstatedir}/lib/dhcpd/
 touch %{buildroot}%{_localstatedir}/lib/dhcpd/dhcpd.leases
 %{__mkdir} -p %{buildroot}%{_localstatedir}/lib/dhclient/
-%{__cat} <<EOF > %{buildroot}%{_sysconfdir}/sysconfig/dhcpd
-# Command line options here
-DHCPDARGS=
-EOF
 
-%{__install} -p -m 0755 %{SOURCE3} %{buildroot}%{_initrddir}/dhcrelay
+# Create default sysconfig files for dhcpd and dhcrelay
+%{__mkdir} -p %{buildroot}%{_sysconfdir}/sysconfig
 
-%{__cat} <<EOF > %{buildroot}%{_sysconfdir}/sysconfig/dhcrelay
+%{__cat} << EOF > %{buildroot}%{_sysconfdir}/sysconfig/dhcrelay
 # Command line options here
 INTERFACES=""
 DHCPSERVERS=""
 EOF
 
-# Copy sample dhclient.conf file into position
+%{__cat} <<EOF > %{buildroot}%{_sysconfdir}/sysconfig/dhcpd
+# Command line options here
+DHCPDARGS=
+EOF
+
+# Copy sample conf files into position (called by doc macro)
 %{__cp} -p client/dhclient.conf dhclient.conf.sample
-%{__chmod} 0755 %{buildroot}/sbin/dhclient-script
+%{__cp} -p server/dhcpd.conf dhcpd.conf.sample
 
 # Install default (empty) dhcpd.conf:
-%{__cp} -fp %{SOURCE4} %{buildroot}%{_sysconfdir}
+%{__cat} << EOF > %{buildroot}%{_sysconfdir}/dhcpd.conf
+#
+# DHCP Server Configuration file.
+#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
+#   see 'man 5 dhcpd.conf'
+#
+EOF
 
 # Install dhcp.schema for LDAP configuration
 %{__mkdir} -p %{buildroot}%{_sysconfdir}/openldap/schema
-%{__install} -p -m 0644 -D %{SOURCE13} %{buildroot}%{_sysconfdir}/openldap/schema
-
-%{__install} -p -m 0644 -D libdhcp4client.pc %{buildroot}%{_libdir}/pkgconfig/libdhcp4client.pc
-
-# Sources files can't be symlinks for debuginfo package generation
-find %{workdir} -type l |
-while read f; do
-    %{__rm} -f linkderef
-    %{__cp} $f linkderef
-    %{__rm} -f $f
-    %{__mv} linkderef $f
-done
+%{__install} -p -m 0644 -D %{SOURCE11} %{buildroot}%{_sysconfdir}/openldap/schema
 
 %clean
 %{__rm} -rf %{buildroot}
@@ -387,7 +346,7 @@
 
 %files
 %defattr(-,root,root,-)
-%doc README README.ldap RELNOTES dhcpd.conf.sample doc/IANA-arp-parameters
+%doc LICENSE README README.ldap RELNOTES dhcpd.conf.sample
 %doc doc/IANA-arp-parameters doc/api+protocol doc/*.txt __fedora_contrib/*
 %dir %{_localstatedir}/lib/dhcpd
 %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/dhcpd/dhcpd.leases
@@ -423,18 +382,18 @@
 
 %files devel
 %defattr(-,root,root,-)
-%{_includedir}/dhcpctl.h
+%{_includedir}/dhcpctl
 %{_includedir}/isc-dhcp
 %{_includedir}/omapip
 %{_libdir}/libdhcpctl.a
 %{_libdir}/libomapi.a
-%attr(0644,root,root) %{_mandir}/man3/omshell.3.gz
+%{_libdir}/libdst.a
 %attr(0644,root,root) %{_mandir}/man3/dhcpctl.3.gz
 %attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
 
 %files -n libdhcp4client
 %defattr(0755,root,root,0755)
-%{_libdir}/libdhcp4client-%{version}.so.*
+%{_libdir}/libdhcp4client-*.*.so.*
 
 %files -n libdhcp4client-devel
 %defattr(0644,root,root,0755)
@@ -442,11 +401,13 @@
 %{_libdir}/pkgconfig/libdhcp4client.pc
 %{_libdir}/libdhcp4client.so
 
-%files -n libdhcp4client-static
-%defattr(0644,root,root,0755)
-%{_libdir}/libdhcp4client.a
-
 %changelog
+* Sun Jan 13 2008 David Cantrell <dcantrell at redhat.com> - 12:4.0.0-1
+- Upgrade to ISC dhcp-4.0.0 (#426634)
+     - first ISC release to incorporate DHCPv6 protocol support
+     - source tree now uses GNU autoconf/automake
+- Removed the libdhcp4client-static package
+
 * Tue Dec 04 2007 David Cantrell <dcantrell at redhat.com> - 12:3.1.0-12
 - Requires line fixes
 


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/sources,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- sources	11 Jan 2008 00:14:20 -0000	1.22
+++ sources	13 Jan 2008 21:02:47 -0000	1.23
@@ -1 +1 @@
-27d179a3c3fbef576566b456a1168246  dhcp-3.1.0.tar.gz
+31d79b27ce4a94089a0b9ce7f72307fa  dhcp-4.0.0.tar.gz


--- Makefile.libdhcp4client DELETED ---


--- dhclient-script.8 DELETED ---


--- dhclient.8 DELETED ---


--- dhclient.conf.5 DELETED ---


--- dhcp-3.0.5-Makefile.patch DELETED ---


--- dhcp-3.0.5-default-requested-options.patch DELETED ---


--- dhcp-3.0.5-fast-timeout.patch DELETED ---


--- dhcp-3.0.5-inherit-leases.patch DELETED ---


--- dhcp-3.0.5-prototypes.patch DELETED ---


--- dhcp-3.0.6-ignore-hyphen-x.patch DELETED ---


--- dhcp-3.1.0-dhclient-anycast.patch DELETED ---


--- dhcp-3.1.0-dhclient-usage.patch DELETED ---


--- dhcp-3.1.0-ldap-configuration.patch DELETED ---


--- dhcp-3.1.0-libdhcp4client.patch DELETED ---


--- dhcp-3.1.0-options.patch DELETED ---


--- dhcp-3.1.0-warnings.patch DELETED ---


--- dhcp-3.1.0-xen-checksum.patch DELETED ---


--- dhcp-options.5 DELETED ---


--- dhcpctl.3 DELETED ---


--- dhcpd.conf DELETED ---


--- dhcpd.conf.5 DELETED ---


--- dhcpd.conf.sample DELETED ---




More information about the fedora-extras-commits mailing list