rpms/dhcp/devel dhcp-3.0.5-fix-warnings.patch, NONE, 1.1 dhcp-3.0.5-libdhcp4client.patch, NONE, 1.1 dhcp-3.0.5-mkdep.patch, NONE, 1.1 dhcp-3.0.5-timeouts.patch, NONE, 1.1 dhcp.spec, 1.120, 1.121 libdhcp4client.pc, 1.2, 1.3 dhcp-3.0.4-lib-makefile.patch, 1.2, NONE dhcp-3.0.4-libdhcp4client.patch, 1.6, NONE dhcp-3.0.4-timeouts.patch, 1.3, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Nov 9 21:09:48 UTC 2006


Author: dcantrel

Update of /cvs/dist/rpms/dhcp/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv25894

Modified Files:
	dhcp.spec libdhcp4client.pc 
Added Files:
	dhcp-3.0.5-fix-warnings.patch dhcp-3.0.5-libdhcp4client.patch 
	dhcp-3.0.5-mkdep.patch dhcp-3.0.5-timeouts.patch 
Removed Files:
	dhcp-3.0.4-lib-makefile.patch dhcp-3.0.4-libdhcp4client.patch 
	dhcp-3.0.4-timeouts.patch 
Log Message:
- Change the way libdhcp4client is compiled (patch main source, create new
  Makefile rather than copy and patch code after main patches)
- Fix up problems generating compiler warnings
- Use 'gcc' for making dependencies


dhcp-3.0.5-fix-warnings.patch:
 client/clparse.c       |   15 +--------------
 client/dhclient.c      |   29 ++---------------------------
 common/alloc.c         |   10 ----------
 common/comapi.c        |   26 ++------------------------
 common/discover.c      |    9 +--------
 common/dns.c           |    5 -----
 common/execute.c       |   10 ----------
 common/icmp.c          |    5 -----
 common/inet.c          |    2 +-
 common/lpf.c           |    3 ---
 common/memory.c        |    4 +---
 common/options.c       |   21 +--------------------
 common/parse.c         |   27 +++------------------------
 common/print.c         |    2 --
 common/resolv.c        |    5 -----
 common/socket.c        |    2 --
 common/tree.c          |   17 +++--------------
 dhcpctl/callback.c     |    3 ---
 dhcpctl/cltest.c       |    5 ++---
 dhcpctl/dhcpctl.c      |    6 ------
 dhcpctl/omshell.c      |    5 +----
 dhcpctl/remote.c       |    2 --
 dst/prandom.c          |    2 +-
 minires/res_mkupdate.c |    2 +-
 minires/res_update.c   |    2 +-
 omapip/alloc.c         |    1 -
 omapip/array.c         |    2 --
 omapip/buffer.c        |    3 ---
 omapip/connection.c    |    6 ------
 omapip/convert.c       |    2 +-
 omapip/generic.c       |    1 -
 omapip/handle.c        |    2 --
 omapip/hash.c          |    3 ---
 omapip/listener.c      |    8 --------
 omapip/message.c       |    4 ----
 omapip/mrtrace.c       |    2 --
 omapip/protocol.c      |    5 -----
 omapip/support.c       |   11 -----------
 omapip/trace.c         |    4 +---
 relay/dhcrelay.c       |    2 +-
 server/confpars.c      |   14 +-------------
 server/db.c            |    5 -----
 server/ddns.c          |    2 --
 server/dhcp.c          |   15 ++-------------
 server/dhcpd.c         |    4 ----
 server/failover.c      |   21 +--------------------
 server/mdb.c           |   10 +---------
 server/omapi.c         |   26 +-------------------------
 48 files changed, 30 insertions(+), 342 deletions(-)

--- NEW FILE dhcp-3.0.5-fix-warnings.patch ---
--- dhcp-3.0.5/client/dhclient.c.warnings	2006-11-09 15:07:59.000000000 -0500
+++ dhcp-3.0.5/client/dhclient.c	2006-11-09 15:07:59.000000000 -0500
@@ -98,8 +98,6 @@
 {
     struct timeval tv={0,0}, *tvp;
     isc_result_t status;
-    struct interface_info *ip;
-    struct client_state *client;
 
     /* Wait for a packet, or a timeout, or libdhcp being finished */
     do {
@@ -156,7 +154,6 @@
 	omapi_object_t *listener;
 	isc_result_t result;
 	int persist = 0;
-	int omapi_port;
 	int no_dhclient_conf = 0;
 	int no_dhclient_db = 0;
 	int no_dhclient_pid = 0;
@@ -1276,7 +1273,6 @@
 			picked = lp;
 			picked -> next = (struct client_lease *)0;
 		} else {
-		      freeit:
 			destroy_client_lease (lp);
 		}
 	}
@@ -1334,7 +1330,6 @@
 	struct client_lease *lease;
 	struct option_cache *oc;
 	struct data_string ds;
-	int i;
 	
 	/* If we're not receptive to an offer right now, or if the offer
 	   has an unrecognizable transaction id, then just drop it. */
@@ -1503,8 +1498,6 @@
 void bind_lease (client)
 	struct client_state *client;
 {
-	struct interface_info *ip = client -> interface;
-
 	/* Remember the medium. */
 	client -> new -> medium = client -> medium;
 
@@ -1573,7 +1566,6 @@
 	void *cpp;
 {
 	struct client_state *client = cpp;
-	int i;
 	struct option_cache *oc;
 	struct data_string ds;
 
@@ -1616,7 +1608,6 @@
 	void *cpp;
 {
 	struct client_state *client = cpp;
-	int i;
 
 	/* Cancel all timeouts. */
 	cancel_timeout (state_selecting, client);
@@ -1729,8 +1720,6 @@
 	int i;
 	int stop_selecting;
 	const char *name = packet -> packet_type ? "DHCPOFFER" : "BOOTREPLY";
-	struct iaddrlist *ap;
-	struct option_cache *oc;
 	char obuf [1024];
 	
 #ifdef DEBUG_PACKET
@@ -2553,7 +2542,6 @@
 	struct client_lease *lease;
 {
 	unsigned char discover = DHCPDISCOVER;
-	int i;
 	struct option_state *options = (struct option_state *)0;
 
 	memset (&client -> packet, 0, sizeof (client -> packet));
@@ -2618,9 +2606,6 @@
 	struct client_lease *lease;
 {
 	unsigned char request = DHCPREQUEST;
-	int i, j;
-	unsigned char *tmp, *digest;
-	unsigned char *old_digest_loc;
 	struct option_cache *oc;
 
 	memset (&client -> packet, 0, sizeof (client -> packet));
@@ -2709,7 +2694,6 @@
 	struct client_lease *lease;
 {
 	unsigned char decline = DHCPDECLINE;
-	int i;
 	struct option_cache *oc;
 
 	struct option_state *options = (struct option_state *)0;
@@ -2766,7 +2750,6 @@
 	struct client_lease *lease;
 {
 	unsigned char request = DHCPRELEASE;
-	int i;
 	struct option_cache *oc;
 
 	struct option_state *options = (struct option_state *)0;
@@ -2823,8 +2806,6 @@
 void destroy_client_lease (lease)
 	struct client_lease *lease;
 {
-	int i;
-
 	if (lease -> server_name)
 		dfree (lease -> server_name, MDL);
 	if (lease -> filename)
@@ -2889,8 +2870,6 @@
 {
 	const char *name, *dot;
 	struct data_string ds;
-	int status;
-	struct client_state *client;
 
 	memset (&ds, 0, sizeof ds);
 
@@ -2921,9 +2900,7 @@
 	int i;
 	struct tm *t;
 	static int leases_written;
-	struct option_cache *oc;
 	struct data_string ds;
-	pair *hash;
 	int errors = 0;
 	char *s;
 
@@ -3204,8 +3181,6 @@
 	int i;
 	struct data_string data;
 	struct option_cache *oc;
-	pair *hash;
-	char *s, *t;
 	struct envadd_state es;
 
 	es.client = client;
@@ -3410,7 +3385,7 @@
 {
 	char spbuf [1024];
 	char *s;
-	unsigned len, i;
+	unsigned len;
 	struct string_list *val;
 	va_list list;
 
@@ -3850,7 +3825,7 @@
 
 isc_result_t client_dns_update (struct client_state *client, int addp, int ttl)
 {
-	struct data_string ddns_fqdn, ddns_fwd_name,
+	struct data_string ddns_fwd_name,
 	       ddns_dhcid, client_identifier;
 	struct option_cache *oc;
 	int ignorep;
--- dhcp-3.0.5/client/clparse.c.warnings	2006-11-09 15:07:59.000000000 -0500
+++ dhcp-3.0.5/client/clparse.c	2006-11-09 15:07:59.000000000 -0500
@@ -39,8 +39,6 @@
 
 #include "dhcpd.h"
 
-static TIME parsed_time;
-
 struct client_config top_level_config;
 
 u_int32_t default_requested_options [] = {
@@ -65,7 +63,6 @@
 isc_result_t read_client_conf ()
 {
 	struct client_config *config;
-	struct client_state *state;
 	struct interface_info *ip;
 	isc_result_t status;
 
@@ -246,11 +243,9 @@
 	int token;
 	const char *val;
 	struct option *option;
-	struct executable_statement *stmt, **p;
-	enum statement_op op;
+	struct executable_statement *stmt;
 	int lose;
 	char *name;
-	struct data_string key_id;
 	enum policy policy;
 	int known;
 	int tmp, i;
@@ -979,11 +974,9 @@
 {
 	int token;
 	const char *val;
-	char *t, *n;
 	struct interface_info *ip;
 	struct option_cache *oc;
 	struct client_state *client = (struct client_state *)0;
-	struct data_string key_id;
[...1650 lines suppressed...]
@@ -378,7 +377,6 @@
 isc_result_t dhcp_lease_destroy (omapi_object_t *h, const char *file, int line)
 {
 	struct lease *lease;
-	isc_result_t status;
 
 	if (h -> type != dhcp_type_lease)
 		return ISC_R_INVALIDARG;
@@ -455,7 +453,6 @@
 {
 	struct lease *lease;
 	isc_result_t status;
-	int updatep = 0;
 
 	if (h -> type != dhcp_type_lease)
 		return ISC_R_INVALIDARG;
@@ -876,9 +873,8 @@
 				   omapi_data_string_t *name,
 				   omapi_typed_data_t *value)
 {
-	struct host_decl *host, *hp;
+	struct host_decl *host;
 	isc_result_t status;
-	int foo;
 
 	if (h -> type != dhcp_type_host)
 		return ISC_R_INVALIDARG;
@@ -1137,7 +1133,6 @@
 isc_result_t dhcp_host_destroy (omapi_object_t *h, const char *file, int line)
 {
 	struct host_decl *host;
-	isc_result_t status;
 
 	if (h -> type != dhcp_type_host)
 		return ISC_R_INVALIDARG;
@@ -1558,7 +1553,6 @@
 {
 	struct pool *pool;
 	isc_result_t status;
-	int foo;
 
 	if (h -> type != dhcp_type_pool)
 		return ISC_R_INVALIDARG;
@@ -1604,8 +1598,6 @@
 isc_result_t dhcp_pool_destroy (omapi_object_t *h, const char *file, int line)
 {
 	struct pool *pool;
-	isc_result_t status;
-	struct permit *pc, *pn;
 
 	if (h -> type != dhcp_type_pool)
 		return ISC_R_INVALIDARG;
@@ -1702,10 +1694,6 @@
 isc_result_t dhcp_pool_lookup (omapi_object_t **lp,
 			       omapi_object_t *id, omapi_object_t *ref)
 {
-	omapi_value_t *tv = (omapi_value_t *)0;
-	isc_result_t status;
-	struct pool *pool;
-
 	/* Can't look up pools yet. */
 
 	/* If we get to here without finding a pool, no valid key was
@@ -1734,7 +1722,6 @@
 {
 	struct class *class;
 	isc_result_t status;
-	int foo;
 
 	if (h -> type != dhcp_type_class)
 		return ISC_R_INVALIDARG;
@@ -1780,8 +1767,6 @@
 isc_result_t dhcp_class_destroy (omapi_object_t *h, const char *file, int line)
 {
 	struct class *class;
-	isc_result_t status;
-	int i;
 
 	if (h -> type != dhcp_type_class && h -> type != dhcp_type_subclass)
 		return ISC_R_INVALIDARG;
@@ -1881,10 +1866,6 @@
 isc_result_t dhcp_class_lookup (omapi_object_t **lp,
 				omapi_object_t *id, omapi_object_t *ref)
 {
-	omapi_value_t *tv = (omapi_value_t *)0;
-	isc_result_t status;
-	struct class *class;
-
 	/* Can't look up classs yet. */
 
 	/* If we get to here without finding a class, no valid key was
@@ -1913,7 +1894,6 @@
 {
 	struct subclass *subclass;
 	isc_result_t status;
-	int foo;
 
 	if (h -> type != dhcp_type_subclass)
 		return ISC_R_INVALIDARG;
@@ -2008,10 +1988,6 @@
 isc_result_t dhcp_subclass_lookup (omapi_object_t **lp,
 				   omapi_object_t *id, omapi_object_t *ref)
 {
-	omapi_value_t *tv = (omapi_value_t *)0;
-	isc_result_t status;
-	struct subclass *subclass;
-
 	/* Can't look up subclasss yet. */
 
 	/* If we get to here without finding a subclass, no valid key was
--- dhcp-3.0.5/server/mdb.c.warnings	2006-07-18 14:16:25.000000000 -0400
+++ dhcp-3.0.5/server/mdb.c	2006-11-09 15:07:59.000000000 -0500
@@ -238,7 +238,6 @@
 	struct host_decl *hp = (struct host_decl *)0;
 	struct host_decl *np = (struct host_decl *)0;
 	struct host_decl *foo;
-	struct executable_statement *esp;
 	int hw_head = 0, uid_head = 1;
 
 	/* Don't need to do it twice. */
@@ -373,7 +372,6 @@
 			 const unsigned char *haddr, unsigned hlen,
 			 const char *file, int line)
 {
-	struct host_decl *foo;
 	struct hardware h;
 
 	h.hlen = hlen + 1;
@@ -403,7 +401,6 @@
 			   struct iaddr *addr, struct shared_network *share)
 {
 	int i;
-	struct subnet *subnet;
 	struct iaddr ip_address;
 	struct host_decl *hp;
 	struct data_string fixed_addr;
@@ -453,12 +450,11 @@
 	struct pool *pool;
 	struct lease **lpchain;
 {
-	struct lease *address_range, *lp, *plp;
+	struct lease *address_range;
 	struct iaddr net;
 	unsigned min, max, i;
 	char lowbuf [16], highbuf [16], netbuf [16];
 	struct shared_network *share = subnet -> shared_network;
-	isc_result_t status;
 	struct lease *lt = (struct lease *)0;
 
 	/* All subnets should have attached shared network structures. */
@@ -745,7 +741,6 @@
 	struct lease *lease;
 {
 	struct lease *comp = (struct lease *)0;
-	isc_result_t status;
 
 	if (find_lease_by_ip_addr (&comp, lease -> ip_addr, MDL)) {
 		if (!comp -> pool) {
@@ -795,7 +790,6 @@
 	int enter_uid = 0;
 	int enter_hwaddr = 0;
 	struct lease *lp, **lq, *prev;
-	TIME lp_next_state;
 
 #if defined (FAILOVER_PROTOCOL)
 	/* We must commit leases before sending updates regarding them
@@ -1475,7 +1469,6 @@
 	void *vpool;
 {
 	struct pool *pool;
-	struct lease *lt = (struct lease *)0;
 	struct lease *next = (struct lease *)0;
 	struct lease *lease = (struct lease *)0;
 	struct lease **lptr [5];
@@ -2013,7 +2006,6 @@
 {
 	struct shared_network *s;
 	struct pool *p;
-	struct hash_bucket *hb;
 	int i;
 	struct lease *l;
 	struct lease **lptr [5];
--- dhcp-3.0.5/server/ddns.c.warnings	2005-03-03 11:55:24.000000000 -0500
+++ dhcp-3.0.5/server/ddns.c	2006-11-09 15:07:59.000000000 -0500
@@ -224,7 +224,6 @@
 	struct data_string ddns_fwd_name;
 	struct data_string ddns_rev_name;
 	struct data_string ddns_dhcid;
-	unsigned len;
 	struct data_string d1;
 	struct option_cache *oc;
 	int s1, s2;
@@ -659,7 +658,6 @@
 	struct data_string ddns_rev_name;
 	struct data_string ddns_dhcid;
 	isc_result_t rcode;
-	struct binding *binding;
 	int result = 0;
 	int client_updated = 0;
 

dhcp-3.0.5-libdhcp4client.patch:
 Makefile.dist                    |    2 
 client/dhclient.c                |  284 ++++++++++++++++++++++++++++++++++++---
 common/alloc.c                   |    6 
 common/discover.c                |   17 +-
 common/lpf.c                     |    1 
 configure                        |    2 
 dst/hmac_link.c                  |   32 +++-
 libdhcp4client/Makefile.dist     |   86 +++++++++++
 libdhcp4client/dhcp4client.h     |   24 +++
 libdhcp4client/libdhcp_control.h |  102 ++++++++++++++
 omapip/alloc.c                   |   42 +++++
 omapip/dispatch.c                |    2 
 omapip/errwarn.c                 |   50 ++++++
 13 files changed, 617 insertions(+), 33 deletions(-)

--- NEW FILE dhcp-3.0.5-libdhcp4client.patch ---
--- dhcp-3.0.5/client/dhclient.c.libdhcp4client	2006-11-09 16:02:36.000000000 -0500
+++ dhcp-3.0.5/client/dhclient.c	2006-11-09 16:02:36.000000000 -0500
@@ -78,7 +78,9 @@
 int extended_option_environment = 0;
 #endif
 int bootp_broadcast_always = 0;
-
+#ifdef LIBDHCP
+FILE *leaseFile=0;
+#endif
 static void usage PROTO ((void));
 
 void do_release(struct client_state *);
@@ -89,10 +91,59 @@
 
 extern u_int32_t default_requested_options[];
 
-int main (argc, argv, envp)
+#ifdef LIBDHCP
+#include "libdhcp_control.h"
+LIBDHCP_Control *libdhcp_control;
+static void libdhcp_dispatch(void)
+{
+    struct timeval tv={0,0}, *tvp;
+    isc_result_t status;
+    struct interface_info *ip;
+    struct client_state *client;
+
+    /* 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(0L) >= 
+	           ( libdhcp_control->timeout 
+	            +libdhcp_control->now
+	           )
+	         )
+	       )
+	     )
+	   )
+	{
+	    if( libdhcp_control -> callback )
+		libdhcp_control -> callback
+		    ( libdhcp_control, DHC_TIMEDOUT, 0L );
+	    break;
+	}
+    } while 
+      ( (status != ISC_R_TIMEDOUT) 
+      &&( (!libdhcp_control)
+        ||(!(libdhcp_control->finished))
+	)
+      );
+}
+
+extern void omapi_free_all_pointers(void);
+int dhcpv4_client
+(libdhcp_ctl, argc, argv, envp)
+LIBDHCP_Control *libdhcp_ctl;
+#else
+int main
+(argc, argv, envp)
+#endif
 	int argc;
 	char **argv, **envp;
 {
+#ifdef LIBDHCP
+        libdhcp_control = libdhcp_ctl;
+#endif
 	int i;
 	struct servent *ent;
 	struct interface_info *ip;
@@ -119,7 +170,7 @@
 	int timeout_arg = 0;
 	char *arg_conf = 0L;
 	int arg_conf_len=0;
-
+#ifndef LIBDHCP
 	/* Make sure we have stdin, stdout and stderr. */
 	i = open ("/dev/null", O_RDWR);
 	if (i == 0)
@@ -140,7 +191,7 @@
 #if !(defined (DEBUG) || defined (SYSLOG_4_2) || defined (__CYGWIN32__))
 	setlogmask (LOG_UPTO (LOG_INFO));
 #endif	
-
+#endif
 	/* Set up the OMAPI. */
 	status = omapi_init ();
 	if (status != ISC_R_SUCCESS)
@@ -475,9 +526,12 @@
 		log_fatal("dhclient(%u) is already running - exiting. ", dhcpid);
 		return(1);
 	    }	    
-	}	
+	}
+#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, DHCP_VERSION);
 		log_info (copyright);
@@ -486,7 +540,7 @@
 		log_info ("%s", "");
 	} else
 		log_perror = 0;
-
+#endif
 	/* If we're given a relay agent address to insert, for testing
 	   purposes, figure out what it is. */
 	if (relay) {
@@ -773,12 +827,18 @@
 		arg_conf_len = 0L;
 	}
 		
+#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); */
 
@@ -796,7 +856,7 @@
 		if (!persist) {
 			/* Nothing more to do. */
 			log_info ("No broadcast interfaces found - exiting.");
-			exit (0);
+			return (0);
 		}
 	} else if (!release_mode) {
 		/* Call the script with the list of interfaces. */
@@ -891,7 +951,7 @@
 	dmalloc_longterm = dmalloc_outstanding;
 	dmalloc_outstanding = 0;
 #endif
-
+#ifndef LIBDHCP
 	/* If we're not supposed to wait before getting the address,
 	   don't. */
 	if (nowait)
@@ -904,7 +964,123 @@
 
 	/* Start dispatching packets and timeouts... */
 	dispatch ();
+#else
+	if (  libdhcp_control )
+	{
+	   if ( libdhcp_control->timeout ) 
+	       libdhcp_control->now = time(0L);
+	   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;
+	extended_option_environment = 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;
+	new_option_info_tree = 0;
+	log_isc_blurb = 0;
+	log_perror = 1;
+	global_scope = 0L;
+	root_group = 0L;
+	group_name_hash = 0L;
+	interfaces = 0L;
+	dummy_interfaces = 0L;
+	fallback_interface = 0L;
+extern int have_setup_fallback;
+        have_setup_fallback=0;
+	quiet_interface_discovery=1;
+	timeouts = 0L;
+	dhcp_type_interface=0L;
+	interface_vector = 0L;
+	interface_count =0;
+	interface_max = 0;
+	name_servers = 0;
+	domains = 0;
+	dhcp_type_interface=0L;
+	dhcp_type_group=0L;
+	dhcp_type_shared_network=0L;
+	dhcp_type_control=0L;
+	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=0L;
+extern struct dhcp_packet *dhcp_free_list;
+	dhcp_free_list = 0L;
+extern struct packet *packet_free_list;
+	packet_free_list = 0L;
+extern struct binding_value *free_binding_values;
+	free_binding_values=0L;
+extern struct expression *free_expressions;
+	free_expressions=0L;
+extern struct option_cache *free_option_caches;
+	free_option_caches=0L;
+extern  struct packet *free_packets;
+	free_packets=0L;
+extern  pair free_pairs;
+	free_pairs=0L;
+extern omapi_io_object_t omapi_io_states;
+        memset(&omapi_io_states, '\0', sizeof(omapi_io_states));
+	dhcp_control_object=0L;
+	unlink(current_pid_file);
+#endif
 	/*NOTREACHED*/
 	return 0;
 }
@@ -1301,8 +1477,25 @@
 	client -> new -> rebind += cur_time;
 	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)
@@ -1340,6 +1533,9 @@
 		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);
 
@@ -1441,13 +1637,13 @@
 {
 	return 0;
 }
-
+#ifndef LIBDHCP
 int write_lease (lease)
 	struct lease *lease;
 {
 	return 0;
 }
-
+#endif
 int write_host (host)
 	struct host_decl *host;
 {
@@ -2020,6 +2216,10 @@
 	   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.");
@@ -2631,7 +2831,9 @@
 	free_client_lease (lease, MDL);
 }
 
+#ifndef LIBDHCP
 FILE *leaseFile;
+#endif
 
 void rewrite_client_leases ()
 {
@@ -3079,16 +3281,60 @@
 int script_go (client)
 	struct client_state *client;
 {
-	int rval;
+    struct string_list *sp;
+
+#ifdef LIBDHCP
+    if ( libdhcp_control && libdhcp_control->callback )
+    {
+	char *reason="";
+	for (sp = client->env; sp; sp = sp -> next) 
+	    if( strncmp(sp->string, "reason=", 7) == 0 )
+	    {
+		reason = sp->string + 7;
+		break;
+	    }
+	(*libdhcp_control->callback) 
+	(   libdhcp_control, 
+	     (strcmp(reason,"NBI")==0)
+	     ? DHC4_NBI
+	     :(strcmp(reason,"PREINIT")==0)
+	      ? DHC4_PREINIT
+	      :(strcmp(reason,"BOUND")==0)
+	       ? DHC4_BOUND
+	       :(strcmp(reason,"RENEW")==0)
+	        ? DHC4_RENEW
+	        :(strcmp(reason,"REBOOT")==0)
+	         ? DHC4_REBOOT
+	         :(strcmp(reason,"REBIND")==0)
+	          ? DHC4_REBIND
+	          :(strcmp(reason,"STOP")==0)
+	           ? DHC4_STOP
+	           :(strcmp(reason,"MEDIUM")==0)
+	            ? DHC4_MEDIUM
+	            :(strcmp(reason,"TIMEOUT")==0)
+	             ? DHC4_TIMEOUT
+	             :(strcmp(reason,"FAIL")==0)
+	              ? DHC4_FAIL
+	              :(strcmp(reason,"EXPIRE")==0)
+	               ? DHC4_EXPIRE
+	               :(strcmp(reason,"RELEASE")==0)
+			? DHC4_RELEASE
+	                : DHC4_NBI,	                
+	    client
+	);
+	if ( libdhcp_control->decline )
+	    return 1;
+    }
+    return 0;
+#else
 	char *scriptName;
 	char *argv [2];
 	char **envp;
-	char *epp [3];
 	char reason [] = "REASON=NBI";
 	static char client_path [] = CLIENT_PATH;
 	int i;
-	struct string_list *sp, *next;
 	int pid, wpid, wstatus;
+	struct string_list *next;
 
 	if (client)
 		scriptName = client -> config -> script_name;
@@ -3154,6 +3400,7 @@
 	GET_TIME (&cur_time);
 	return (WIFEXITED (wstatus) ?
 		WEXITSTATUS (wstatus) : -WTERMSIG (wstatus));
+#endif
 }
 
 void client_envadd (struct client_state *client,
@@ -3244,6 +3491,9 @@
 
 	/* 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;
 	}
@@ -3252,7 +3502,9 @@
 	if (state)
 		return;
 	state = 1;
-
+#ifdef LIBDHCP
+	return;
+#endif
 	/* Stop logging to stderr... */
 	log_perror = 0;
 
--- dhcp-3.0.5/common/alloc.c.libdhcp4client	2006-11-09 16:02:36.000000000 -0500
+++ dhcp-3.0.5/common/alloc.c	2006-11-09 16:02:36.000000000 -0500
@@ -1016,9 +1016,11 @@
 	rc_register (file, line, ptr, bp, bp -> refcnt, 0, RC_MISC);
 	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)
 void relinquish_free_packets ()
--- dhcp-3.0.5/common/discover.c.libdhcp4client	2006-11-09 16:02:36.000000000 -0500
+++ dhcp-3.0.5/common/discover.c	2006-11-09 16:02:36.000000000 -0500
@@ -120,7 +120,9 @@
    For each interface that's of type INET and not the loopback interface,
    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 (state)
 	int state;
 {
@@ -140,8 +142,10 @@
 #ifdef ALIAS_NAMES_PERMUTED
 	char *s;
 #endif
-	isc_result_t status;
+#ifndef LIBDHCP
 	static int setup_fallback = 0;
+#endif
+	isc_result_t status;
 	int wifcount = 0;
 
 	/* Create an unbound datagram socket to do the SIOCGIFADDR ioctl on. */
@@ -694,12 +698,17 @@
 		log_info ("%s", "");
 		log_fatal ("Not configured to listen on any interfaces!");
 	}
-
+#ifdef LIBDHCP
+	if (!have_setup_fallback) {
+		have_setup_fallback = 1;
+		maybe_setup_fallback ();
+	}
+#else
 	if (!setup_fallback) {
 		setup_fallback = 1;
 		maybe_setup_fallback ();
 	}
-
+#endif
 #if defined (HAVE_SETFD)
 	if (fallback_interface) {
 	    if (fcntl (fallback_interface -> rfdesc, F_SETFD, 1) < 0)
--- dhcp-3.0.5/common/lpf.c.libdhcp4client	2004-11-24 12:39:15.000000000 -0500
+++ dhcp-3.0.5/common/lpf.c	2006-11-09 16:02:36.000000000 -0500
@@ -216,6 +216,7 @@
 	struct interface_info *info;
 {
 	struct sock_fprog p;
+	memset(&p,'\0', sizeof(struct sock_fprog));
 
 	/* Set up the bpf filter program structure.    This is defined in
 	   bpf.c */
--- dhcp-3.0.5/dst/hmac_link.c.libdhcp4client	2001-02-22 02:22:08.000000000 -0500
+++ dhcp-3.0.5/dst/hmac_link.c	2006-11-09 16:02:36.000000000 -0500
@@ -38,6 +38,10 @@
 
 #include "dst_internal.h"
 
+#ifdef LIBDHCP
+extern void* dmalloc(size_t,char *,int);
+#endif
+
 #ifdef USE_MD5
 # include "md5.h"
 # ifndef _MD5_H_
@@ -86,7 +90,11 @@
 	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) 
@@ -153,7 +161,11 @@
 	MD5_CTX *ctx = NULL;
 
 	if (mode & SIG_MODE_INIT) 
-		ctx = (MD5_CTX *) malloc(sizeof(*ctx));
+#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) 
@@ -217,8 +229,11 @@
 
 	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));
@@ -347,7 +362,11 @@
 	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 */
@@ -439,8 +458,11 @@
 		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 */
@@ -463,7 +485,11 @@
 {
 	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));
--- dhcp-3.0.5/omapip/alloc.c.libdhcp4client	2006-02-22 17:43:27.000000000 -0500
+++ dhcp-3.0.5/omapip/alloc.c	2006-11-09 16:02:36.000000000 -0500
@@ -40,6 +40,41 @@
 
 #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 != 0L )
+	tdestroy(all_pointers, free);
+    all_pointers = 0L;
+}
+#endif
+
 #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
 		defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
 struct dmalloc_preamble *dmalloc_list;
@@ -78,7 +113,9 @@
 		return (VOIDPTR)0;
 
 	foo = malloc(len);
-
+#ifdef LIBDHCP
+	record_pointer(foo);
+#endif
 	if (!foo)
 		return (VOIDPTR)0;
 	bar = (VOIDPTR)(foo + DMDOFFSET);
@@ -200,6 +237,9 @@
 		     0, (unsigned char *)ptr + DMDOFFSET, 0, 1, RC_MALLOC);
 #endif
 	free (ptr);
+#ifdef LIBDHCP
+	forget_pointer(ptr);
+#endif
 }
 
 #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
--- dhcp-3.0.5/omapip/dispatch.c.libdhcp4client	2006-11-09 16:02:36.000000000 -0500
+++ dhcp-3.0.5/omapip/dispatch.c	2006-11-09 16:02:36.000000000 -0500
@@ -34,7 +34,7 @@
 
 #include <omapip/omapip_p.h>
 
-static omapi_io_object_t omapi_io_states;
+omapi_io_object_t omapi_io_states;
 TIME cur_time;
 
 OMAPI_OBJECT_ALLOC (omapi_io,
--- dhcp-3.0.5/omapip/errwarn.c.libdhcp4client	2006-11-09 16:02:36.000000000 -0500
+++ dhcp-3.0.5/omapip/errwarn.c	2006-11-09 16:02:36.000000000 -0500
@@ -39,6 +39,11 @@
 #include <omapip/omapip_p.h>
 #include <errno.h>
 
+#ifdef LIBDHCP
+#include <libdhcp_control.h>
+extern LIBDHCP_Control *libdhcp_control;
+#endif
+
 #ifdef DEBUG
 int log_perror = -1;
 #else
@@ -50,7 +55,9 @@
 void (*log_cleanup) (void);
 
 #define CVT_BUF_MAX 1023
+#ifndef LIBDHCP
 static char mbuf [CVT_BUF_MAX + 1];
+#endif
 static char fbuf [CVT_BUF_MAX + 1];
 
 /* Log an error message, then exit... */
@@ -60,6 +67,17 @@
   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.
@@ -108,6 +126,7 @@
   if (log_cleanup)
 	  (*log_cleanup) ();
   exit (1);
+#endif
 }
 
 /* Log an error message... */
@@ -118,6 +137,14 @@
 
   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.
    */
@@ -134,7 +161,7 @@
 	  r=write (STDERR_FILENO, mbuf, strlen (mbuf));
 	  r=write (STDERR_FILENO, "\n", 1);
   }
-
+#endif
   return 0;
 }
 
@@ -146,6 +173,14 @@
 
   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.
    */
@@ -162,7 +197,7 @@
 	  r=write (STDERR_FILENO, mbuf, strlen (mbuf));
 	  r=write (STDERR_FILENO, "\n", 1);
   }
-
+#endif
   return 0;
 }
 
@@ -173,7 +208,14 @@
   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.
    */
@@ -190,7 +232,7 @@
 	  r=write (STDERR_FILENO, mbuf, strlen (mbuf));
 	  r=write (STDERR_FILENO, "\n", 1);
   }
-
+#endif
   return 0;
 }
 
--- dhcp-3.0.5/configure.libdhcp4client	2004-09-10 17:02:30.000000000 -0400
+++ dhcp-3.0.5/configure	2006-11-09 16:02:36.000000000 -0500
@@ -246,7 +246,7 @@
 fi
 
 if [ x"$dirs" = x ]; then
-  dirs=". client server relay common omapip dhcpctl minires dst"
+  dirs=". client server relay common omapip dhcpctl minires dst libdhcp4client"
 fi
 
 for foo in $dirs; do
--- /dev/null	2006-11-09 08:39:48.641391297 -0500
+++ dhcp-3.0.5/libdhcp4client/Makefile.dist	2006-11-09 16:03:42.000000000 -0500
@@ -0,0 +1,86 @@
+# Makefile.dist for libdhcp4client
+#
+# We get the libdhcp4client library from the patched ISC source code.  We
+# rebuild key C files with -DLIBDHCP to turn on the library features we
+# need.  Normal build results in standard ISC code (i.e., not LIBDHCP
+# stuff enabled).  We then link together a static library and a shared
+# library with the new resulting objects.
+#
+# David Cantrell <dcantrell at redhat.com>
+
+PROGS = libdhcp4client.a libdhcp4client.so.1
+HDRS  = dhcp4client.h libdhcp_control.h
+SRCS  = client_dhclient.c common_alloc.c common_discover.c dst_hmac_link.c \
+        omapip_alloc.c omapip_errwarn.c
+OBJS  = client_dhclient.o common_alloc.o common_discover.o dst_hmac_link.o \
+        omapip_alloc.o omapip_errwarn.o
+
+INCLUDES = -I$(TOP)/includes -I.
+CFLAGS   = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS) \
+           -DCLIENT_PATH=${CLIENT_PATH} -DLIBDHCP
+
+all: $(PROGS)
+
+install: all
+	install -p -m 0755 -D libdhcp4client.so.1 $(DESTDIR)$(LIBDIR)/libdhcp4client.so.1
+	ln -sf libdhcp4client.so.1 $(DESTDIR)/$(LIBDIR)/libdhcp4client.so
+	install -p -m 0644 -D libdhcp4client.a $(DESTDIR)$(LIBDIR)/libdhcp4client.a
+	install -p -m 0644 -D dhcp4client.h $(DESTDIR)$(INCDIR)/dhcp4client/dhcp4client.h
+	install -p -m 0644 -D libdhcp_control.h $(DESTDIR)$(INCDIR)/dhcp4client/libdhcp_control.h
+	( cd $(TOP)/includes ; \
+	  find . -name "*.h" -type f | while read h ; do \
+	      install -p -m 0644 -D $$h $(DESTDIR)$(INCDIR)/dhcp4client/isc_dhcp/$$h ; \
+	  done ; \
+	)
+
+depend:
+	$(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRCS)
+
+clean:
+	-rm -f $(OBJS)
+
+realclean: clean
+	-rm -f $(PROG) *~ #*
+
+distclean: realclean
+	-rm -f Makefile
+
+# This isn't the cleanest way to set up links, but I prefer this so I don't
+# need object targets for each subdirectory.  The idea is simple.  Since
+# libdhcp4client is a linked together wad of objects from across the source
+# tree, we change / to _ when linking source files here.  Follow this example:
+#
+# We need to use client/dhclient.c, so we make this link:
+#     rm -f client_dhclient.c
+#     ln -s $(TOP)/client/dhclient.c client_dhclient.c
+#
+# Simple.  Given the way the ISC build system works, this is the easiest to
+# maintain and least invasive.
+#
+# David Cantrell <dcantrell at redhat.com>
+links:
+	@for target in $(SRCS); do \
+		source="`echo $$target | sed -e 's|_|/|'`"; \
+		if [ ! -b $$target ]; then \
+			rm -f $$target; \
+		fi; \
+		ln -s $(TOP)/$$source $$target; \
+	done; \
+	for hdr in $(HDRS); do \
+		if [ ! -b $$hdr ]; then \
+			rm -f $$hdr; \
+		fi; \
+		ln -s $(TOP)/libdhcp4client/$$hdr $$hdr; \
+	done
+
+# minires/res_query.o contains an undefined symbol __h_errno_set, is not
+# used by any dhcp code, and is optimized out by the linker when producing
+# the dhclient executable or a shared library
+
+libdhcp4client.a: $(OBJS)
+	$(AR) crus $@ $(OBJS)
+
+libdhcp4client.so.1: $(OBJS)
+	$(CC) -shared -o $@ -Wl,-soname,$@ $^
+
+# Dependencies (semi-automatically-generated)
--- /dev/null	2006-11-09 08:39:48.641391297 -0500
+++ dhcp-3.0.5/libdhcp4client/dhcp4client.h	2006-11-09 16:02:36.000000000 -0500
@@ -0,0 +1,24 @@
+/* dhcp4client.h
+ *
+ *  Interface to the ISC dhcp IPv4 client libdhcp4client library.
+ *
+ *
+ *  Copyright(C) Jason Vas Dias <jvdias at redhat.com> Red Hat Inc. May 2006
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation at 
+ *           http://www.fsf.org/licensing/licenses/gpl.txt
+ *  and included in this software distribution as the "LICENSE" file.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ */
+
+struct libdhcp_control_s;  /* include libdhcp_control.h or libdhcp.h for this */
+
+extern int dhcpv4_client( struct libdhcp_control_s *dhc_ctl, int argc, char **argv, char **envp);
+    /* The ISC IPv4 DHCP client main() function .
+     */
--- /dev/null	2006-11-09 08:39:48.641391297 -0500
+++ dhcp-3.0.5/libdhcp4client/libdhcp_control.h	2006-11-09 16:02:36.000000000 -0500
@@ -0,0 +1,102 @@
+/* libdhcp_control.h
+ *
+ *  DHCP client control API for libdhcp, a minimal interface to the
+ *  ISC dhcp IPv4 client libdhcp4client library,
+ *  and to the dhcpv6 DHCPv6 client libdhcp6client library.
+ *
+ *  Each DHCP client library must include this file to be controlled
+ *  by libdhcp.
+ *
+ *  Copyright(C) Jason Vas Dias <jvdias at redhat.com> Red Hat Inc. May 2006
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation at 
+ *           http://www.fsf.org/licensing/licenses/gpl.txt
+ *  and included in this software distribution as the "LICENSE" file.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ */
+#ifndef LIBDHCP_CONTROL_H
+#define LIBDHCP_CONTROL_H
+
+#include <stdint.h>
+
+#define  LOG_FATAL 8
+
+typedef enum dhcp_state_e
+{
+
+    /* DHCPv4 client states - third callback arg will be a 'struct client_state *'    */
+    DHC4_NBI,         		/* failed: no broadcast interfaces found              */
+    DHC4_PREINIT, 		/* configuration started - bring the interface "UP"   */
+    DHC4_BOUND, 		/* lease obtained                                     */
+    DHC4_RENEW, 		/* lease renewed                                      */
+    DHC4_REBOOT,	        /* have valid lease, but now obtained a different one */
+    DHC4_REBIND, 		/* new, different lease                               */
+    DHC4_STOP,  		/* remove old lease                                   */
+    DHC4_MEDIUM, 		/* media selection begun                              */
+    DHC4_TIMEOUT, 		/* timed out contacting DHCP server                   */
+    DHC4_FAIL, 			/* all attempts to contact server timed out, sleeping */
+    DHC4_EXPIRE, 		/* lease has expired, renewing                        */
+    DHC4_RELEASE, 		/* releasing lease                                    */
+    /* This state raised by both clients: */
+    DHC_TIMEDOUT,               /* libdhcp_control timeout has been exceeded          */
+    /* DHCPv6 client states:    */
+    DHC6_BOUND,                 /* new lease obtained             - arg is optinfo *  */
+    DHC6_REBIND,                /* existing expired lease rebound - arg is optinfo *  */
+    DHC6_RELEASE                /* existing lease expired         - arg is dhcp6_iaidaddr*/
+} DHCP_State;
+
+struct libdhcp_control_s;
+
+typedef
+int ( *LIBDHCP_Error_Handler )
+    ( struct libdhcp_control_s *ctl,
+      int priority,  /* ala syslog(3): LOG_EMERG=0 - LOG_DEBUG=7 (+ LOG_FATAL=8 : finished -> 1)   */
+      const char *fmt,
+      va_list ap
+    );
+
+typedef 
+int ( *LIBDHCP_Callback ) ( struct libdhcp_control_s *control, enum dhcp_state_e, void* );
+    /* The DHCP clients will call the users' callback on important state change events,
+     * with the second arg set to the client DHCP_State, and the third arg set to
+     * a client specific pointer as described below.
+     */
+
+typedef 
+struct libdhcp_control_s
+{
+    LIBDHCP_Callback    callback;    	/* the DHCP clients' main loop calls this on state changes */
+    uint16_t            capability;     /* LIBDHCP_Capability bits to enable                       */
+    uint8_t             finished;       /* set to one to make clients exit their main loop         */
+    uint8_t             decline;        /* set to one to decline the lease (DHCPv4 only)           */
+    time_t              timeout;        /* (timeout+now) == time after which clients MUST return   */
+    time_t              now;            /* clients set this to time(0) on entering main loop       */
+    void               *arg;            /* user data pointer                                       */
+    LIBDHCP_Error_Handler eh;
+} LIBDHCP_Control;
+
+typedef enum libdhcp_capability_e
+{/* DHCP client "capabilities" */ 
+    DHCP_USE_LEASE_DATABASE   = 1,  	/* use / do not use persistent lease database files */
+    DHCP_USE_PID_FILE         = 2,  	/* use / do not use pid file                        */
+ /*
+  * DHCPv6 supports these capabilities in process, 
+  * while the DHCPv4 client will fork and exec the dhclient-script to implement them if these
+  * bits are set - otherwise, if no bits are set, the callback is called and the script is 
+  * not run.
+  */
+    DHCP_CONFIGURE_INTERFACES = 4,  	/* configure interfaces UP/DOWN as required         */
+    DHCP_CONFIGURE_ADDRESSES  = 8,  	/* configure interface addresses as required        */
+    DHCP_CONFIGURE_ROUTES     =16,  	/* configure routes as required                     */
+    DHCP_CONFIGURE_RESOLVER   =32,  	/* configure resolv.conf as required                */
+    /* DHCPv6 only: */
+    DHCP_CONFIGURE_RADVD      =64,  	/* configure radvd.conf & restart radvd as required */
+} LIBDHCP_Capability;
+
+#endif
--- dhcp-3.0.5/Makefile.dist.libdhcp4client	2004-06-10 13:59:10.000000000 -0400
+++ dhcp-3.0.5/Makefile.dist	2006-11-09 16:02:36.000000000 -0500
@@ -22,7 +22,7 @@
 #   http://www.isc.org/
 
 
-SUBDIRS=	common $(MINIRES) dst omapip server client relay dhcpctl
+SUBDIRS=	common $(MINIRES) dst omapip server client relay dhcpctl libdhcp4client
 
 all:
 	@for dir in ${SUBDIRS}; do \

dhcp-3.0.5-mkdep.patch:
 Makefile.conf |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE dhcp-3.0.5-mkdep.patch ---
--- dhcp-3.0.5/Makefile.conf.mkdep	2005-06-16 15:39:35.000000000 -0400
+++ dhcp-3.0.5/Makefile.conf	2006-11-09 13:34:41.000000000 -0500
@@ -49,7 +49,7 @@
 DEBUG = -g
 #WARNERR = -Werror
 RANLIB = ranlib
-MKDEP = mkdep
+MKDEP = $(CC)
 CLIENT_PATH = '"PATH=/usr/ucb:/usr/bin:/usr/sbin:/bin:/sbin"'
 
 BINDLIB = ../minires/libres.a

dhcp-3.0.5-timeouts.patch:
 client/dhclient.c |    2 
 common/dispatch.c |  169 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 includes/dhcpd.h  |    9 --
 3 files changed, 164 insertions(+), 16 deletions(-)

--- NEW FILE dhcp-3.0.5-timeouts.patch ---
--- dhcp-3.0.5/client/dhclient.c.timeouts	2006-11-09 09:50:49.000000000 -0500
+++ dhcp-3.0.5/client/dhclient.c	2006-11-09 09:52:15.000000000 -0500
@@ -1041,7 +1041,9 @@
 extern int have_setup_fallback;
         have_setup_fallback=0;
 	quiet_interface_discovery=1;
+#ifndef LIBDHCP
 	timeouts = 0L;
+#endif
 	dhcp_type_interface=0L;
 	interface_vector = 0L;
 	interface_count =0;
--- dhcp-3.0.5/common/dispatch.c.timeouts	2006-02-22 17:43:27.000000000 -0500
+++ dhcp-3.0.5/common/dispatch.c	2006-11-09 10:21:02.000000000 -0500
@@ -39,8 +39,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)
 {
@@ -53,10 +69,42 @@
 
 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. */
       another:
+#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
 	if (timeouts) {
 		struct timeout *t;
 		if (timeouts -> when <= cur_time) {
@@ -73,9 +121,15 @@
 			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
@@ -104,13 +158,28 @@
 	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
@@ -119,7 +188,29 @@
 		}
 		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) {
@@ -128,7 +219,7 @@
 			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!");
 		}
@@ -158,22 +249,62 @@
 		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));
+#else
 	t = (struct timeout *)0;
 	for (q = timeouts; q; q = q -> next) {
 		if (q -> func == where && q -> what == what) {
@@ -185,19 +316,38 @@
 		}
 		t = q;
 	}
+#endif
+
+#ifdef LIBDHCP
+			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
 	/* If we found the timeout, put it on the free list. */
 	if (q) {
 		if (q -> unref)
 			(*q -> unref) (&q -> what, MDL);
 		q -> next = free_timeouts;
 		free_timeouts = q;
+#endif
 	}
 }
 
-#if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
 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;
@@ -206,14 +356,19 @@
 		t -> next = free_timeouts;
 		free_timeouts = t;
 	}
+#endif
 }
 
 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
+}
--- dhcp-3.0.5/includes/dhcpd.h.timeouts	2006-11-09 09:50:49.000000000 -0500
+++ dhcp-3.0.5/includes/dhcpd.h	2006-11-09 09:51:20.000000000 -0500
@@ -817,14 +817,6 @@
 
 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;
@@ -1751,7 +1743,6 @@
 					    struct dhcp_packet *, unsigned,
 					    unsigned int,
 					    struct iaddr, struct hardware *));
-extern struct timeout *timeouts;
 extern omapi_object_type_t *dhcp_type_interface;
 #if defined (TRACING)
 trace_type_t *interface_trace;


Index: dhcp.spec
===================================================================
RCS file: /cvs/dist/rpms/dhcp/devel/dhcp.spec,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- dhcp.spec	7 Nov 2006 15:49:44 -0000	1.120
+++ dhcp.spec	9 Nov 2006 21:09:46 -0000	1.121
@@ -1,7 +1,14 @@
+# Use 64-bit pointers on POWER and z/Series
+%ifarch ppc64 s390x
+%define bigptrs -DPTRSIZE_64BIT
+%endif
+
+%define workdir work.linux-2.2
+
 Summary: DHCP (Dynamic Host Configuration Protocol) server and relay agent.
 Name:    dhcp
 Version: 3.0.5
-Release: 1%{?dist}
+Release: 2%{?dist}
 Epoch:   12
 License: distributable
 Group:   System Environment/Daemons
@@ -24,11 +31,10 @@
 Patch7:  dhcp-3.0.5-omapip.patch
 Patch8:  dhcp-3.0.5-relay.patch
 Patch9:  dhcp-3.0.5-server.patch
-Patch10: dhcp-3.0.4-lib-makefile.patch
-
-# patches that _must_ go after the split (in %%build)
-Patch500: dhcp-3.0.4-libdhcp4client.patch
-Patch501: dhcp-3.0.4-timeouts.patch
+Patch10: dhcp-3.0.5-libdhcp4client.patch
+Patch11: dhcp-3.0.5-timeouts.patch
+Patch12: dhcp-3.0.5-mkdep.patch
+Patch13: dhcp-3.0.5-fix-warnings.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 Requires(post): chkconfig, coreutils
@@ -74,7 +80,7 @@
 Libraries for interfacing with the ISC DHCP server.
 
 %package -n libdhcp4client
-Summary: The ISC DHCP IPv4 client in a library for invocation from other programs
+Summary: ISC DHCP IPv4 client in a library for invocation from other programs
 Group: Development/Libraries
 
 %description -n libdhcp4client
@@ -103,8 +109,12 @@
 %patch7 -p1 -b .omapip
 %patch8 -p1 -b .relay
 %patch9 -p1 -b .server
-%patch10 -p1 -b .lib-makefile
+%patch10 -p1 -b .libdhcp4client
+%patch11 -p1 -b .timeouts
+%patch12 -p1 -b .mkdep
+%patch13 -p1 -b .warnings
 
+%build
 cp %SOURCE1 .
 cat <<EOF >site.conf
 VARDB=%{_localstatedir}/lib/dhcpd
@@ -120,50 +130,35 @@
 #define _PATH_DHCLIENT_DB "%{_localstatedir}/lib/dhclient/dhclient.leases"
 EOF
 
-FLAGS="-Dlint -Werror -Wno-unused -DEXTENDED_NEW_OPTION_INFO"
-
-%ifarch ppc64 s390x
-FLAGS="$FLAGS -DPTRSIZE_64BIT"
-%endif
-
-%ifarch s390 s390x
-FLAGS="$FLAGS -fPIE"
-%else
-FLAGS="$FLAGS -fpie"
-%endif
-
-RPM_OPT_FLAGS="$RPM_OPT_FLAGS $FLAGS"
-CC="%{__cc}" ./configure --copts "$RPM_OPT_FLAGS"
+RPM_OPT_FLAGS="$RPM_OPT_FLAGS -Werror -Dlint -DEXTENDED_NEW_OPTION_INFO"
 
-sed 's/@DHCP_VERSION@/'%{version}'/' < %SOURCE5 >libdhcp4client.pc
-make -f libdhcp4client.Makefile CC="%{__cc}" libdhcp4client/.
-%patch500 -p1 -b .lib
-%patch501 -p1 -b .timeouts
+# DO NOT use the %%configure macro because this configure script is not autognu
+CC="%{__cc}" ./configure \
+   --copts "${RPM_OPT_FLAGS} %{?bigptrs}" \
+   --work-dir %{workdir}
 
-%build
-make %{?_smp_mflags} CC="%{__cc}"
-sed 's/@DHCP_VERSION@/'%{version}'/' < %SOURCE5 >libdhcp4client.pc
-make -f libdhcp4client.Makefile CC="%{__cc}"
+sed 's/@DHCP_VERSION@/'%{version}'/' < %SOURCE5 > libdhcp4client.pc
+%{__make} %{?_smp_mflags} CC="%{__cc}"
 
 %install
-rm -rf %{buildroot}
-mkdir -p %{buildroot}/etc/sysconfig
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
 
-make install DESTDIR=%{buildroot}
+make install DESTDIR=$RPM_BUILD_ROOT
 
-mkdir -p %{buildroot}/etc/rc.d/init.d
+mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
 install -m 0755 %SOURCE2 %{buildroot}/etc/rc.d/init.d/dhcpd
 
-touch %{buildroot}%{_localstatedir}/lib/dhcpd/dhcpd.leases
-mkdir -p  %{buildroot}%{_localstatedir}/lib/dhclient/
-cat <<EOF > %{buildroot}/etc/sysconfig/dhcpd
+touch $RPM_BUILD_ROOT%{_localstatedir}/lib/dhcpd/dhcpd.leases
+mkdir -p  $RPM_BUILD_ROOT%{_localstatedir}/lib/dhclient/
+cat <<EOF > $RPM_BUILD_ROOT/etc/sysconfig/dhcpd
 # Command line options here
 DHCPDARGS=
 EOF
 
-install -m0755 %SOURCE3 %{buildroot}/etc/rc.d/init.d/dhcrelay
+install -m0755 %SOURCE3 $RPM_BUILD_ROOT/etc/rc.d/init.d/dhcrelay
 
-cat <<EOF > %{buildroot}/etc/sysconfig/dhcrelay
+cat <<EOF > $RPM_BUILD_ROOT/etc/sysconfig/dhcrelay
 # Command line options here
 INTERFACES=""
 DHCPSERVERS=""
@@ -171,15 +166,15 @@
 
 # Copy sample dhclient.conf file into position
 cp client/dhclient.conf dhclient.conf.sample
-chmod 755 %{buildroot}/sbin/dhclient-script
+chmod 755 $RPM_BUILD_ROOT/sbin/dhclient-script
 
 # Create per-package copies of dhcp-options and dhcp-eval common man-pages:
-cp -fp ${RPM_BUILD_ROOT}%{_mandir}/man5/dhcp-options.5 ${RPM_BUILD_ROOT}%{_mandir}/man5/dhcpd-options.5
-cp -fp ${RPM_BUILD_ROOT}%{_mandir}/man5/dhcp-options.5 ${RPM_BUILD_ROOT}%{_mandir}/man5/dhclient-options.5
-cp -fp ${RPM_BUILD_ROOT}%{_mandir}/man5/dhcp-eval.5 ${RPM_BUILD_ROOT}%{_mandir}/man5/dhcpd-eval.5
-cp -fp ${RPM_BUILD_ROOT}%{_mandir}/man5/dhcp-eval.5 ${RPM_BUILD_ROOT}%{_mandir}/man5/dhclient-eval.5
+cp -fp $RPM_BUILD_ROOT%{_mandir}/man5/dhcp-options.5 $RPM_BUILD_ROOT%{_mandir}/man5/dhcpd-options.5
+cp -fp $RPM_BUILD_ROOT%{_mandir}/man5/dhcp-options.5 $RPM_BUILD_ROOT%{_mandir}/man5/dhclient-options.5
+cp -fp $RPM_BUILD_ROOT%{_mandir}/man5/dhcp-eval.5 $RPM_BUILD_ROOT%{_mandir}/man5/dhcpd-eval.5
+cp -fp $RPM_BUILD_ROOT%{_mandir}/man5/dhcp-eval.5 $RPM_BUILD_ROOT%{_mandir}/man5/dhclient-eval.5
 
-# Why not ship the doc/ documentation ? Some of it is quite useful.
+# Why not ship the doc/ documentation?  Some of it is quite useful.
 # Also generate DHCP options tables for C, perl, python:
 /usr/bin/perl %SOURCE6 > doc/dhcp_options.h
 /usr/bin/perl %SOURCE6 -pe > doc/dhcp_options.pl
@@ -187,20 +182,18 @@
 /usr/bin/perl %SOURCE6 -d  > doc/dhcp_options.txt
 
 # Install default (empty) dhcpd.conf:
-cp -fp %SOURCE4 %{buildroot}/etc
+cp -fp %SOURCE4 $RPM_BUILD_ROOT/etc
 
-# libdhcp4client install
-sed 's/@DHCP_VERSION@/'%{version}'/' < %SOURCE5 >libdhcp4client.pc
-make -f libdhcp4client.Makefile install DESTDIR=$RPM_BUILD_ROOT LIBDIR=%{_libdir}
-
-# Fix debuginfo files list - don't ship links to .c files in the buildroot :-)
-work=work.`./configure --print-sysname`;
-find $work -type l -a -name '*.c' |
-while read f; do 
-   rm -f $f; 
-   cp -fp ${f#$work/} $f; 
+install -p -m 0644 -D libdhcp4client.pc $RPM_BUILD_ROOT%{_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
-:;
 
 %clean
 rm -rf %{buildroot}
@@ -325,6 +318,12 @@
 %{_libdir}/libdhcp4client.so
 
 %changelog
+* Thu Nov 09 2006 David Cantrell <dcantrell at redhat.com> - 12:3.0.5-2
+- Change the way libdhcp4client is compiled (patch main source, create new
+  Makefile rather than copy and patch code after main patches)
+- Fix up problems generating compiler warnings
+- Use 'gcc' for making dependencies
+
 * Tue Nov 07 2006 David Cantrell <dcantrell at redhat.com> - 12:3.0.5-1
 - Upgrade to ISC dhcp-3.0.5
 


Index: libdhcp4client.pc
===================================================================
RCS file: /cvs/dist/rpms/dhcp/devel/libdhcp4client.pc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- libdhcp4client.pc	20 May 2006 00:53:18 -0000	1.2
+++ libdhcp4client.pc	9 Nov 2006 21:09:46 -0000	1.3
@@ -1,6 +1,7 @@
-Name:		libdhcp4client
-Description:	ISC DHCP IPv4 client library
-Version:	@DHCP_VERSION@
-Libs:		-ldhcp4client
-Cflags:		-I/usr/include/dhcp4client
-ISC.Cflags=	-I/usr/include/dhcp4client/isc_dhcp
+ISC.Cflags=-I/usr/include/dhcp4client/isc_dhcp
+
+Name: libdhcp4client
+Description: ISC DHCP IPv4 client library
+Version: @DHCP_VERSION@
+Libs: -ldhcp4client
+Cflags: -I/usr/include/dhcp4client


--- dhcp-3.0.4-lib-makefile.patch DELETED ---


--- dhcp-3.0.4-libdhcp4client.patch DELETED ---


--- dhcp-3.0.4-timeouts.patch DELETED ---




More information about the fedora-cvs-commits mailing list