rpms/dhcpv6/devel Makefile.libdhcp6client, NONE, 1.1 dhc6_alloc.c, NONE, 1.1 dhc6_alloc.h, NONE, 1.1 dhcp6client.h, NONE, 1.1 dhcpv6-0.10-libdhcp6client.patch, 1.11, 1.12 dhcpv6.spec, 1.66, 1.67 libdhcp6client.pc, 1.1, 1.2

David Cantrell (dcantrel) fedora-extras-commits at redhat.com
Thu Oct 25 20:46:52 UTC 2007


Author: dcantrel

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

Modified Files:
	dhcpv6-0.10-libdhcp6client.patch dhcpv6.spec libdhcp6client.pc 
Added Files:
	Makefile.libdhcp6client dhc6_alloc.c dhc6_alloc.h 
	dhcp6client.h 
Log Message:
* Wed Oct 24 2007 David Cantrell <dcantrell at redhat.com> - 0.10-52
- Remove DHCPv6.Cflags variable from libdhcp6client.pc
- Install dhcpv6 headers for libdhcp6client to /usr/include/dhcp6client
- Remove the libdhcp_control.h header file
- Extract full files from libdhcp6client patch and store as Sources
- Require dhcp-devel >= 12:3.1.0 for libdhcp_control.h



--- NEW FILE Makefile.libdhcp6client ---
#
# Makefile for libdhcp6client
#
# Copyright (C) 2006, 2007  Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
# source code or documentation are not subject to the GNU General Public
# License and may only be used or replicated with the express permission of
# Red Hat, Inc.
#
# Red Hat Author(s): Jason Vas Dias
#                    David Cantrell <dcantrell at redhat.com>
#

include ../Makefile.inc

# Version of dhcpv6
VER = 0.10

PROGS = libdhcp6client.a libdhcp6client-$(VER).so.0

# Source files
SRCS = dhcp6c.c common.c config.c timer.c client6_addr.c hash.c \
       lease.c netlink.c lease_token.c client6_parse.c client6_token.c \
       dad_token.c ra_token.c resolv_token.c radvd_token.c strlcpy.c \
       dhc6_alloc.c
OBJS = $(SRCS:.c=.o)

# Files to link so that debuginfo is generated correctly
LINKS = client6_parse.y client6_token.l dad_token.l lease_token.l lex.cpyy.c \
        lex.ifyy.c lex.lyy.c lex.rayy.c lex.rdyy.c lex.rvyy.c ra_token.l \
        radvd_token.l resolv_token.l y.tab.c y.tab.h

CFLAGS += -I. -I.. -DLIBDHCP

all: links $(PROGS)

links:
	@for f in $(LINKS) ; do \
		if [ ! -r $$f ]; then \
			ln ../$$f $$f ; \
		fi ; \
	done

$(SRCS):
	@if [ ! -r $@ ]; then \
		if [ -r ../$@ ]; then \
			ln ../$@ $@ ; \
		fi ; \
	fi

%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $<

libdhcp6client.a: $(OBJS)
	$(AR) crus $@ $(OBJS)

libdhcp6client-$(VER).so.0: $(OBJS)
	$(CC) -shared -o $@ -Wl,-soname,$@ $(OBJS) $(LIBS)

install: $(PROGS)
	$(INSTALL) -m 0755 -D -o $(INSTALL_USER) -g $(INSTALL_GROUP) libdhcp6client-$(VER).so.0 $(DESTDIR)$(LIBDIR)/libdhcp6client-$(VER).so.0
	$(INSTALL) -m 0644 -D -o $(INSTALL_USER) -g $(INSTALL_GROUP) libdhcp6client.a $(DESTDIR)$(LIBDIR)/libdhcp6client.a
	mkdir -p $(DESTDIR)$(INCLUDEDIR)/dhcp6client
	$(INSTALL) -m 644 -o $(INSTALL_USER) -g $(INSTALL_GROUP) dhcp6client.h $(DESTDIR)$(INCLUDEDIR)/dhcp6client/dhcp6client.h
	$(INSTALL) -m 644 -o $(INSTALL_USER) -g $(INSTALL_GROUP) dhc6_alloc.h $(DESTDIR)$(INCLUDEDIR)/dhcp6client/dhc6_alloc.h
	for header in common.h config.h cp.tab.h dhcp6.h hash.h lease.h timer.h ; do \
		$(INSTALL) -m 644 -o $(INSTALL_USER) -g $(INSTALL_GROUP) ../$$header $(DESTDIR)$(INCLUDEDIR)/dhcp6client/$$header ; \
	done
	$(INSTALL) -m 644 -D -o $(INSTALL_USER) -g $(INSTALL_GROUP) ../libdhcp6client.pc $(DESTDIR)$(PKGCFGDIR)/libdhcp6client.pc
	( cd $(DESTDIR)$(LIBDIR) ; rm -f libdhcp6client.so )
	( cd $(DESTDIR)$(LIBDIR) ; ln -sf libdhcp6client-$(VER).so.0 libdhcp6client.so )

clean:
	-rm -f libdhcp6client.a libdhcp6client-$(VER).so.0
	-rm -f $(OBJS)


--- NEW FILE dhc6_alloc.c ---
/*
 * dhc6_alloc.c
 *
 * Copyright (C) 2006, 2007  Red Hat, Inc. All rights reserved.
 *
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions of
 * the GNU General Public License v.2, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY expressed or implied, including the implied warranties of
 * MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE.  See the GNU General
 * Public License for more details.  You should have received a copy of the
 * GNU General Public License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
 * source code or documentation are not subject to the GNU General Public
 * License and may only be used or replicated with the express permission of
 * Red Hat, Inc.
 *
 * Red Hat Author(s): Jason Vas Dias
 *                    David Cantrell <dcantrell at redhat.com>
 */

#include <malloc.h>
#include <search.h>
#include <string.h>

extern void tdestroy (void *root, void (*free_node)(void *nodep));
void *ifp_ptr;

static void *ptr_tree = NULL;

static int ptr_comparator(const void *p1, const void *p2) {
    return ((p1 == p2) ? 0 : ((p1 > p2) ? 1 : -1));
}

void *dhc6_alloc(size_t s) {
    void *ptr = malloc(s);
    if (ptr != 0)
        tsearch(ptr, &(ptr_tree), ptr_comparator);
    return ptr;
}

void *dhc6_realloc(void *ptr, size_t s) {
    void *ptr2 = realloc(ptr, s);
    if (ptr2 != 0) {
        if (ptr != 0)
            tdelete(ptr,&(ptr_tree), ptr_comparator);
        tsearch(ptr2, &(ptr_tree), ptr_comparator);
    }
    return ptr2;
}

void *dhc6_calloc(size_t n, size_t s) {
    void *ptr = calloc(n, s);
    if (ptr != 0)
        tsearch(ptr, &(ptr_tree), ptr_comparator);
    return ptr;
}

char *dhc6_strdup(char *str) {
    char *ptr = strdup(str);
    if (ptr != 0)
        tsearch(ptr, &(ptr_tree), ptr_comparator);
    return ptr;
}

void dhc6_free(void *ptr) {
    free(ptr);
    tdelete(ptr, &(ptr_tree), ptr_comparator);
}

void dhc6_free_all_pointers(void) {
    if (ptr_tree != NULL)
        tdestroy(ptr_tree, free);
    ptr_tree = NULL;
}


--- NEW FILE dhc6_alloc.h ---
/*
 * dhc6_alloc.h
 *
 * Copyright (C) 2006, 2007  Red Hat, Inc. All rights reserved.
 *
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions of
 * the GNU General Public License v.2, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY expressed or implied, including the implied warranties of
 * MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE.  See the GNU General
 * Public License for more details.  You should have received a copy of the
 * GNU General Public License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
 * source code or documentation are not subject to the GNU General Public
 * License and may only be used or replicated with the express permission of
 * Red Hat, Inc.
 *
 * Red Hat Author(s): Jason Vas Dias
 *                    David Cantrell <dcantrell at redhat.com>
 */

extern void *dhc6_alloc(size_t);
extern void *dhc6_realloc(void *, size_t);
extern void *dhc6_calloc(size_t, size_t);
extern char *dhc6_strdup(char *str);
extern void dhc6_free(void *);
extern void dhc6_free_all_pointers(void);

#undef malloc
#define malloc(size) dhc6_alloc(size)
#undef realloc
#define realloc(ptr, size) dhc6_realloc(ptr, size)
#undef calloc
#define calloc(n, size) dhc6_calloc(n, size)
#undef free
#define free(ptr) dhc6_free(ptr)
#undef strdup
#define strdup(str) dhc6_strdup(str)


--- NEW FILE dhcp6client.h ---
/* dhcp6client.h
 *
 * Interface to the DHCPv6 client libdhcp6client library.
 *
 * Copyright (C) 2006  Red Hat, Inc. All rights reserved.
 *
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions of
 * the GNU General Public License v.2, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY expressed or implied, including the implied warranties of
 * MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE.  See the GNU General
 * Public License for more details.  You should have received a copy of the
 * GNU General Public License along with this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
 * source code or documentation are not subject to the GNU General Public
 * License and may only be used or replicated with the express permission of
 * Red Hat, Inc.
 *
 * Red Hat Author(s): Jason Vas Dias
 *                    David Cantrell <dcantrell at redhat.com>
 */

/* include libdhcp.h for this */
extern struct libdhcp_control_s;

/* the DHCPv6 client main() function */
extern int dhcpv6_client(struct libdhcp_control_s *dhc_ctl,
                         int argc, char **argv, char **envp);

dhcpv6-0.10-libdhcp6client.patch:

Index: dhcpv6-0.10-libdhcp6client.patch
===================================================================
RCS file: /cvs/pkgs/rpms/dhcpv6/devel/dhcpv6-0.10-libdhcp6client.patch,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- dhcpv6-0.10-libdhcp6client.patch	26 Mar 2007 15:01:23 -0000	1.11
+++ dhcpv6-0.10-libdhcp6client.patch	25 Oct 2007 20:46:49 -0000	1.12
@@ -1,98 +1,17 @@
---- dhcp-0.10/client6_addr.c.libdhcp6client	2007-03-26 10:43:55.000000000 -0400
-+++ dhcp-0.10/client6_addr.c	2007-03-26 10:43:55.000000000 -0400
-@@ -56,6 +56,10 @@
- #include "timer.h"
- #include "lease.h"
- 
-+#ifdef LIBDHCP
-+#include "libdhcp_control.h"
-+#endif
-+
- static int dhcp6_update_lease __P((struct dhcp6_addr *, struct dhcp6_lease *));
- static int dhcp6_add_lease __P((struct dhcp6_addr *));
- struct dhcp6_lease *dhcp6_find_lease __P((struct dhcp6_iaidaddr *, 
-@@ -231,14 +235,23 @@
- 	if (sp->lease_addr.type == IAPD) {
- 		dprintf(LOG_INFO, "request prefix is %s/%d", 
- 			in6addr2str(&sp->lease_addr.addr, 0), sp->lease_addr.plen);
--	} else if (client6_ifaddrconf(IFADDRCONF_ADD, addr) != 0) {
--		dprintf(LOG_ERR, "%s" "adding address failed: %s",
--		    FNAME, in6addr2str(&addr->addr, 0));
--		if (sp->timer)
--			dhcp6_remove_timer(sp->timer);
--		free(sp);
--		return (-1);
-+#ifdef LIBDHCP
-+	} else if (libdhcp_control && (libdhcp_control->capability & DHCP_CONFIGURE_ADDRESSES)) {
-+#else
-+	} else
-+#endif
-+		if (client6_ifaddrconf(IFADDRCONF_ADD, addr) != 0) {
-+			dprintf(LOG_ERR, "%s" "adding address failed: %s",
-+			        FNAME, in6addr2str(&addr->addr, 0));
-+			if (sp->timer)
-+				dhcp6_remove_timer(sp->timer);
-+			free(sp);
-+			return (-1);
-+		}
-+#ifdef LIBDHCP
- 	}
-+#endif
-+
- 	TAILQ_INSERT_TAIL(&client6_iaidaddr.lease_list, sp, link);
- 	/* for infinite lifetime don't do any timer */
- 	if (sp->lease_addr.validlifetime == DHCP6_DURATITION_INFINITE || 
-@@ -285,6 +298,9 @@
- 	dprintf(LOG_DEBUG, "%s" "removing address %s", FNAME,
- 		in6addr2str(&sp->lease_addr.addr, 0));
- 	sp->state = INVALID;
-+#ifdef LIBDHCP
-+	if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE))
-+#endif
- 	if (write_lease(sp, client6_lease_file) != 0) {
- 		dprintf(LOG_INFO, "%s" 
- 			"failed to write removed lease address %s to lease file", 
-@@ -296,10 +312,13 @@
- 		dprintf(LOG_INFO, "request prefix is %s/%d", 
- 			in6addr2str(&sp->lease_addr.addr, 0), sp->lease_addr.plen);
- 		/* XXX: remove from the update prefix list */
--
--	} else if (client6_ifaddrconf(IFADDRCONF_REMOVE, &sp->lease_addr) != 0) {
--			dprintf(LOG_INFO, "%s" "removing address %s failed",
--		    		FNAME, in6addr2str(&sp->lease_addr.addr, 0));
-+	} else
-+#ifdef LIBDHCP
-+	if (libdhcp_control && (libdhcp_control->capability & DHCP_CONFIGURE_ADDRESSES))
-+#endif
-+	if (client6_ifaddrconf(IFADDRCONF_REMOVE, &sp->lease_addr) != 0) {
-+		dprintf(LOG_INFO, "%s" "removing address %s failed",
-+		        FNAME, in6addr2str(&sp->lease_addr.addr, 0));
- 	}
- 	/* remove expired timer for this lease. */
- 	if (sp->timer)
-@@ -453,6 +472,9 @@
- 	memcpy(&sp->lease_addr, addr, sizeof(sp->lease_addr));
- 	sp->state = ACTIVE;
- 	time(&sp->start_date);
-+#ifdef LIBDHCP
-+	if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE))
-+#endif
- 	if (write_lease(sp, client6_lease_file) != 0) {
- 		dprintf(LOG_ERR, "%s" 
- 			"failed to write an updated lease address %s to lease file", 
---- dhcp-0.10/dhcp6c.c.libdhcp6client	2007-03-26 10:43:55.000000000 -0400
-+++ dhcp-0.10/dhcp6c.c	2007-03-26 10:43:55.000000000 -0400
+diff -up dhcp-0.10/dhcp6c.c.libdhcp6client dhcp-0.10/dhcp6c.c
+--- dhcp-0.10/dhcp6c.c.libdhcp6client	2007-10-25 15:21:51.000000000 -0400
++++ dhcp-0.10/dhcp6c.c	2007-10-25 15:22:46.000000000 -0400
 @@ -73,6 +73,9 @@
  #include "common.h"
  #include "timer.h"
  #include "lease.h"
 +#ifdef LIBDHCP
-+#include "libdhcp_control.h"
++#include <isc-dhcp/libdhcp_control.h>
 +#endif
  
  static int debug = 0;
  static u_long sig_flags = 0;
-@@ -136,7 +139,9 @@
+@@ -136,7 +139,9 @@ static int client6_recvadvert __P((struc
  				   ssize_t, struct dhcp6_optinfo *));
  static int client6_recvreply __P((struct dhcp6_if *, struct dhcp6 *,
  				  ssize_t, struct dhcp6_optinfo *));
@@ -102,7 +21,7 @@
  static struct dhcp6_event *find_event_withid __P((struct dhcp6_if *,
  						  u_int32_t));
  static struct dhcp6_timer *check_lease_file_timo __P((void *));
-@@ -155,20 +160,36 @@
+@@ -155,20 +160,36 @@ extern int dad_parse(const char *file);
  #define DUID_FILE "/var/lib/dhcpv6/dhcp6c_duid"
  
  static int pid;
@@ -140,7 +59,7 @@
  
  	pid = getpid();
  	srandom(time(NULL) & pid);
-@@ -286,12 +307,18 @@
+@@ -286,12 +307,18 @@ main(argc, argv)
  	}
  	setloglevel(debug);
  
@@ -159,7 +78,7 @@
  	ifinit(device);
  	setup_interface(device);
  
-@@ -303,7 +330,57 @@
+@@ -303,7 +330,57 @@ main(argc, argv)
  	client6_init(device);
  	client6_ifinit(device);
  	client6_mainloop();
@@ -218,7 +137,7 @@
  }
  
  static void
-@@ -322,7 +399,9 @@
+@@ -322,7 +399,9 @@ client6_init(device)
  	char *device;
  {
  	struct addrinfo hints, *res;
@@ -228,7 +147,7 @@
  	int error, on = 1;
  	struct dhcp6_if *ifp;
  	int ifidx;
-@@ -335,19 +414,19 @@
+@@ -335,19 +414,19 @@ client6_init(device)
  	ifidx = if_nametoindex(device);
  	if (ifidx == 0) {
  		dprintf(LOG_ERR, "if_nametoindex(%s)", device);
@@ -252,7 +171,7 @@
  	}
  	dprintf(LOG_DEBUG, "link local addr is %s", linklocal);
  	
-@@ -360,12 +439,12 @@
+@@ -360,12 +439,12 @@ client6_init(device)
  	if (error) {
  		dprintf(LOG_ERR, "%s" "getaddrinfo: %s",
  			FNAME, strerror(error));
@@ -267,7 +186,7 @@
  	}
  #ifdef IPV6_RECVPKTINFO
  	if (setsockopt(insock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on,
-@@ -373,7 +452,7 @@
+@@ -373,7 +452,7 @@ client6_init(device)
  		dprintf(LOG_ERR, "%s"
  			"setsockopt(inbound, IPV6_RECVPKTINFO): %s",
  			FNAME, strerror(errno));
@@ -276,7 +195,7 @@
  	}
  #else
  	if (setsockopt(insock, IPPROTO_IPV6, IPV6_PKTINFO, &on,
-@@ -381,7 +460,7 @@
+@@ -381,7 +460,7 @@ client6_init(device)
  		dprintf(LOG_ERR, "%s"
  			"setsockopt(inbound, IPV6_PKTINFO): %s",
  			FNAME, strerror(errno));
@@ -285,7 +204,7 @@
  	}
  #endif
  	((struct sockaddr_in6 *)(res->ai_addr))->sin6_scope_id = ifidx;
-@@ -410,7 +489,7 @@
+@@ -410,7 +489,7 @@ client6_init(device)
  
  	if (bound < 0) {
  		dprintf(LOG_ERR, "%s" "bind(inbound): %s", FNAME, strerror(-bound));
@@ -294,7 +213,7 @@
  	}
  
  	freeaddrinfo(res);
-@@ -420,26 +499,26 @@
+@@ -420,26 +499,26 @@ client6_init(device)
  	if (error) {
  		dprintf(LOG_ERR, "%s" "getaddrinfo: %s",
  			FNAME, gai_strerror(error));
@@ -325,7 +244,7 @@
  	}
  	freeaddrinfo(res);
  	memset(&hints, 0, sizeof(hints));
-@@ -450,7 +529,7 @@
+@@ -450,7 +529,7 @@ client6_init(device)
  	if (error) {
  		dprintf(LOG_ERR, "%s" "getaddrinfo: %s",
  			FNAME, gai_strerror(error));
@@ -334,7 +253,7 @@
  	}
  	memcpy(&sa6_allagent_storage, res->ai_addr, res->ai_addrlen);
  	sa6_allagent = (const struct sockaddr_in6 *)&sa6_allagent_storage;
-@@ -461,25 +540,27 @@
+@@ -461,25 +540,27 @@ client6_init(device)
  	if ((ifp = find_ifconfbyname(device)) == NULL) {
  		dprintf(LOG_ERR, "%s" "interface %s not configured",
  			FNAME, device);
@@ -366,7 +285,7 @@
  }
  
  static void
-@@ -493,13 +574,13 @@
+@@ -493,13 +574,13 @@ client6_ifinit(char *device)
  	/* get iaid for each interface */
  	if (num_device == 0) {
  		if ((num_device = create_iaid(&iaidtab[0], num_device)) < 0)
@@ -382,7 +301,7 @@
  		}
  		dprintf(LOG_DEBUG, "%s" "interface %s iaid is %u", 
  			FNAME, ifp->ifname, ifp->iaidinfo.iaid);
-@@ -508,6 +589,9 @@
+@@ -508,6 +589,9 @@ client6_ifinit(char *device)
  	memcpy(&client6_iaidaddr.client6_info.iaidinfo, &ifp->iaidinfo, 
  			sizeof(client6_iaidaddr.client6_info.iaidinfo));
  	duidcpy(&client6_iaidaddr.client6_info.clientid, &client_duid);
@@ -392,7 +311,7 @@
  	/* parse the lease file */
  	strcpy(leasename, PATH_CLIENT6_LEASE);
  	sprintf(iaidstr, "%u", ifp->iaidinfo.iaid);
-@@ -515,14 +599,17 @@
+@@ -515,14 +599,17 @@ client6_ifinit(char *device)
  	if ((client6_lease_file = 
  		init_leases(leasename)) == NULL) {
  			dprintf(LOG_ERR, "%s" "failed to parse lease file", FNAME);
@@ -412,7 +331,7 @@
  	if (!TAILQ_EMPTY(&client6_iaidaddr.lease_list)) {
  //		struct dhcp6_lease *cl;
  		struct dhcp6_listval *lv;
-@@ -531,7 +618,7 @@
+@@ -531,7 +618,7 @@ client6_ifinit(char *device)
  			client6_request_flag |= CLIENT6_CONFIRM_ADDR;
  		if (TAILQ_EMPTY(&request_list)) {
  			if (create_request_list(1) < 0) 
@@ -421,7 +340,7 @@
  		} else if (client6_request_flag & CLIENT6_RELEASE_ADDR) {
  			for (lv = TAILQ_FIRST(&request_list); lv; 
  					lv = TAILQ_NEXT(lv, link)) {
-@@ -540,13 +627,13 @@
+@@ -540,13 +627,13 @@ client6_ifinit(char *device)
  					dprintf(LOG_INFO, "this address %s is not"
  						" leased by this client", 
  					    in6addr2str(&lv->val_dhcp6addr.addr,0));
@@ -437,7 +356,7 @@
  	}
  	ifp->link_flag |= IFF_RUNNING;
  
-@@ -557,11 +644,11 @@
+@@ -557,11 +644,11 @@ client6_ifinit(char *device)
  	if ((ifp->link_timer =
  	    dhcp6_add_timer(check_link_timo, ifp)) < 0) {
  		dprintf(LOG_ERR, "%s" "failed to create a timer", FNAME);
@@ -451,7 +370,7 @@
  	}
  	/* DAD timer set up after getting the address */
  	ifp->dad_timer = NULL;
-@@ -569,7 +656,7 @@
+@@ -569,7 +656,7 @@ client6_ifinit(char *device)
  	if ((ev = dhcp6_create_event(ifp, DHCP6S_INIT)) == NULL) {
  		dprintf(LOG_ERR, "%s" "failed to create an event",
  			FNAME);
@@ -460,7 +379,7 @@
  	}
  	ifp->servers = NULL;
  	ev->ifp->current_server = NULL;
-@@ -577,7 +664,7 @@
+@@ -577,7 +664,7 @@ client6_ifinit(char *device)
  	if ((ev->timer = dhcp6_add_timer(client6_timo, ev)) == NULL) {
  		dprintf(LOG_ERR, "%s" "failed to add a timer for %s",
  			FNAME, ifp->ifname);
@@ -469,7 +388,7 @@
  	}
  	dhcp6_reset_timer(ev);
  }
-@@ -594,6 +681,9 @@
+@@ -594,6 +681,9 @@ free_resources(struct dhcp6_if *ifp)
  	else {
  		for (sp = TAILQ_FIRST(&client6_iaidaddr.lease_list); sp; sp = sp_next) { 
  			sp_next = TAILQ_NEXT(sp, link);
@@ -479,7 +398,7 @@
  			if (client6_ifaddrconf(IFADDRCONF_REMOVE, &sp->lease_addr) != 0) 
  				dprintf(LOG_INFO, "%s" "deconfiging address %s failed",
  					FNAME, in6addr2str(&sp->lease_addr.addr, 0));
-@@ -605,6 +695,9 @@
+@@ -605,6 +695,9 @@ free_resources(struct dhcp6_if *ifp)
  		ev_next = TAILQ_NEXT(ev, link);
  		dhcp6_remove_event(ev);
  	}
@@ -489,7 +408,7 @@
  	/* XXX: check the last dhcpv6 client daemon to restore the original file */
  	{
  		/* restore /etc/radv.conf.bak back to /etc/radvd.conf */
-@@ -627,7 +720,7 @@
+@@ -627,7 +720,7 @@ process_signals()
  		dprintf(LOG_INFO, FNAME "exiting");
  		free_resources(dhcp6_if);
  		unlink(DHCP6C_PIDFILE);
@@ -498,7 +417,7 @@
  	}
  	if ((sig_flags & SIGF_HUP)) {
  		dprintf(LOG_INFO, FNAME "restarting");
-@@ -636,7 +729,7 @@
+@@ -636,7 +729,7 @@ process_signals()
  	}
  	if ((sig_flags & SIGF_CLEAN)) {
  		free_resources(dhcp6_if);
@@ -507,7 +426,7 @@
  	}
  	sig_flags = 0;
  }
-@@ -648,11 +741,39 @@
+@@ -648,11 +741,39 @@ client6_mainloop()
  	int ret;
  	fd_set r;
  
@@ -547,7 +466,7 @@
  		FD_ZERO(&r);
  		FD_SET(insock, &r);
  
-@@ -662,7 +783,7 @@
+@@ -662,7 +783,7 @@ client6_mainloop()
  			if (errno != EINTR) {
  				dprintf(LOG_ERR, "%s" "select: %s",
  				    FNAME, strerror(errno));
@@ -556,7 +475,7 @@
  			}
  			break;
  		case 0:	/* timeout */
-@@ -670,6 +791,19 @@
+@@ -670,6 +791,19 @@ client6_mainloop()
  		default: /* received a packet */
  			client6_recv();
  		}
@@ -576,7 +495,7 @@
  	}
  }
  
-@@ -741,7 +875,7 @@
+@@ -741,7 +875,7 @@ client6_timo(arg)
  				/* this should not happen! */
  				dprintf(LOG_ERR, "%s" "can't find a server",
  					FNAME);
@@ -585,7 +504,7 @@
  			}
  			/* if get the address assginment break */
  			if (!TAILQ_EMPTY(&client6_iaidaddr.lease_list)) {
-@@ -800,6 +934,7 @@
+@@ -800,6 +934,7 @@ select_server(ifp)
  	return (NULL);
  }
  
@@ -593,7 +512,7 @@
  static void
  client6_signal(sig)
  	int sig;
-@@ -822,6 +957,7 @@
+@@ -822,6 +957,7 @@ client6_signal(sig)
  		break;
  	}
  }
@@ -601,7 +520,7 @@
  
  void
  client6_send(ev)
-@@ -848,21 +984,21 @@
+@@ -848,21 +984,21 @@ client6_send(ev)
  	case DHCP6S_REQUEST:
  		if (ifp->current_server == NULL) {
  			dprintf(LOG_ERR, "%s" "assumption failure", FNAME);
@@ -626,7 +545,7 @@
  		}
  		dh6->dh6_msgtype = DH6_DECLINE;
  		break;
-@@ -880,7 +1016,7 @@
+@@ -880,7 +1016,7 @@ client6_send(ev)
  		break;
  	default:
  		dprintf(LOG_ERR, "%s" "unexpected state %d", FNAME, ev->state);
@@ -635,7 +554,7 @@
  	}
  	/*
  	 * construct options
-@@ -922,7 +1058,7 @@
+@@ -920,7 +1056,7 @@ client6_send(ev)
  	case DHCP6S_RENEW:
  	case DHCP6S_DECLINE:
  		if (&ifp->current_server->optinfo == NULL)
@@ -644,7 +563,7 @@
  		dprintf(LOG_DEBUG, "current server ID %s",
  			duidstr(&ifp->current_server->optinfo.serverID));
  		if (duidcpy(&optinfo.serverID,
-@@ -1012,17 +1148,28 @@
+@@ -1010,17 +1146,28 @@ client6_send(ev)
  		} else {
  			if (ev->state == DHCP6S_RELEASE) {
  				dprintf(LOG_INFO, "release empty address list");
@@ -675,7 +594,7 @@
  		}
  		break;
  	default:
-@@ -1061,7 +1208,7 @@
+@@ -1059,7 +1206,7 @@ client6_send(ev)
  			if (error) {
  				dprintf(LOG_ERR, "%s" "getaddrinfo: %s",
  					FNAME, gai_strerror(error));
@@ -684,7 +603,7 @@
  			}
  			memcpy(&dst, res->ai_addr, res->ai_addrlen);
  			salen = res->ai_addrlen;
-@@ -1283,8 +1430,16 @@
+@@ -1281,8 +1428,16 @@ client6_recvadvert(ifp, dh6, len, optinf
  	}
  	/* if the client send preferred addresses reqeust in SOLICIT */
  	/* XXX: client might have some local policy to select the addresses */
@@ -702,7 +621,7 @@
  	return 0;
  }
  
-@@ -1427,6 +1582,9 @@
+@@ -1425,6 +1580,9 @@ client6_recvreply(ifp, dh6, len, optinfo
  
  	if (!TAILQ_EMPTY(&optinfo->dns_list.addrlist) || 
  	    optinfo->dns_list.domainlist != NULL) {
@@ -712,7 +631,7 @@
  		resolv_parse(&optinfo->dns_list);
  	}
  	/*
-@@ -1500,14 +1658,21 @@
+@@ -1498,14 +1656,21 @@ client6_recvreply(ifp, dh6, len, optinfo
  			if (!TAILQ_EMPTY(&optinfo->addr_list)) {
  				(void)get_if_rainfo(ifp);
  				dhcp6_add_iaidaddr(optinfo);
@@ -736,7 +655,7 @@
  			}
  			break;
  		}
-@@ -1523,6 +1688,10 @@
+@@ -1521,6 +1686,10 @@ client6_recvreply(ifp, dh6, len, optinfo
  			dprintf(LOG_DEBUG, "%s" 
  			    	  "got a NoBinding reply, sending request.", FNAME);
  			dhcp6_remove_iaidaddr(&client6_iaidaddr);
@@ -747,7 +666,7 @@
  			break;
  		case DH6OPT_STCODE_NOADDRAVAIL:
  		case DH6OPT_STCODE_NOPREFIXAVAIL:
-@@ -1533,7 +1702,14 @@
+@@ -1531,7 +1700,14 @@ client6_recvreply(ifp, dh6, len, optinfo
  		default:
  			dhcp6_update_iaidaddr(optinfo, ADDR_UPDATE);
  			if (optinfo->type == IAPD)
@@ -762,7 +681,7 @@
  			break;
  		}
  		break;
-@@ -1680,6 +1856,9 @@
+@@ -1678,6 +1854,9 @@ create_request_list(int reboot)
  		/* config the interface for reboot */
  		if (reboot && client6_iaidaddr.client6_info.type != IAPD && 
  		    (client6_request_flag & CLIENT6_CONFIRM_ADDR)) {
@@ -772,7 +691,7 @@
  			if (client6_ifaddrconf(IFADDRCONF_ADD, &cl->lease_addr) != 0) {
  				dprintf(LOG_INFO, "config address failed: %s",
  					in6addr2str(&cl->lease_addr.addr, 0));
-@@ -1690,6 +1869,9 @@
+@@ -1688,6 +1867,9 @@ create_request_list(int reboot)
  	/* update radvd.conf for prefix delegation */
  	if (reboot && client6_iaidaddr.client6_info.type == IAPD &&
  	    (client6_request_flag & CLIENT6_CONFIRM_ADDR))
@@ -782,7 +701,7 @@
  		radvd_parse(&client6_iaidaddr, ADDR_UPDATE);
  	return (0);
  }
-@@ -1830,7 +2012,7 @@
+@@ -1828,7 +2010,7 @@ setup_interface(char *ifname)
  	/* open a socket to watch the off-on link for confirm messages */
  	if ((nlsock == -1) && ((nlsock = socket(AF_INET, SOCK_DGRAM, 0)) < 0)) {
  		dprintf(LOG_ERR, "%s" "open a socket: %s", FNAME, strerror(errno));
@@ -791,7 +710,7 @@
  	}
  
  	memset(&ifr,'\0', sizeof(struct ifreq));
-@@ -1838,13 +2020,13 @@
+@@ -1836,13 +2018,13 @@ setup_interface(char *ifname)
  
  	if (ioctl(nlsock, SIOCGIFFLAGS, &ifr) < 0) {
  		dprintf(LOG_ERR, "ioctl SIOCGIFFLAGS failed");
@@ -807,7 +726,7 @@
  		}
  
  		memset(&ifr, '\0', sizeof(struct ifreq));
-@@ -1852,7 +2034,7 @@
+@@ -1850,7 +2032,7 @@ setup_interface(char *ifname)
  		ifr.ifr_flags |= (IFF_UP | IFF_RUNNING) ;
  		if (ioctl(nlsock, SIOCSIFFLAGS, &ifr) < 0) {
  			dprintf(LOG_ERR, "ioctl SIOCSIFFLAGS failed");
@@ -816,7 +735,7 @@
  		}
  
  		/*
-@@ -1865,7 +2047,7 @@
+@@ -1863,7 +2045,7 @@ setup_interface(char *ifname)
  		strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
  		if (ioctl(nlsock, SIOCGIFFLAGS, &ifr) < 0) {
  			dprintf(LOG_ERR, "ioctl SIOCGIFFLAGS failed");
@@ -825,14 +744,44 @@
  		}
  	}
  
---- dhcp-0.10/common.c.libdhcp6client	2007-03-26 10:43:55.000000000 -0400
-+++ dhcp-0.10/common.c	2007-03-26 10:45:57.000000000 -0400
+diff -up dhcp-0.10/dhcp6.h.libdhcp6client dhcp-0.10/dhcp6.h
+--- dhcp-0.10/dhcp6.h.libdhcp6client	2007-10-25 15:21:51.000000000 -0400
++++ dhcp-0.10/dhcp6.h	2007-10-25 15:23:57.000000000 -0400
+@@ -116,9 +116,24 @@ char radvd_dhcpv6_file[254];
+ 
+ typedef enum { IANA, IATA, IAPD} iatype_t;
+ 
+-typedef enum { ACTIVE, RENEW,
++#ifdef LIBDHCP
++typedef enum { DHCP6_ACTIVE=1, DHCP6_RENEW,
++               DHCP6_REBIND, DHCP6_EXPIRED,
++               DHCP6_INVALID } state_t;
++
++#define ACTIVE DHCP6_ACTIVE
++#define RENEW DHCP6_RENEW
++#define REBIND DHCP6_REBIND
++#define EXPIRED DHCP6_EXPIRED
++#define INVALID DHCP6_INVALID
++#include <isc-dhcp/libdhcp_control.h>
++extern LIBDHCP_Control *libdhcp_control;
++#include <dhc6_alloc.h>
++#else
++typedef enum { ACTIVE=1, RENEW,
+ 	       REBIND, EXPIRED,
+ 	       INVALID } state_t;
++#endif
+ /* Internal data structure */
+ 
+ struct duid {
+diff -up dhcp-0.10/common.c.libdhcp6client dhcp-0.10/common.c
+--- dhcp-0.10/common.c.libdhcp6client	2007-10-25 15:21:51.000000000 -0400
++++ dhcp-0.10/common.c	2007-10-25 15:22:35.000000000 -0400
 @@ -79,11 +79,19 @@
  #include "timer.h"
  #include "lease.h"
  
 +#ifdef LIBDHCP
-+#include "libdhcp_control.h"
++#include <isc-dhcp/libdhcp_control.h>
 +#endif
 +
  int foreground;
@@ -847,7 +796,7 @@
  static int in6_matchflags __P((struct sockaddr *, size_t, char *, int));
  ssize_t gethwid __P((unsigned char *, int, const char *, u_int16_t *));
  static int get_assigned_ipv6addrs __P((unsigned char *, unsigned char *,
-@@ -148,7 +156,7 @@
+@@ -148,7 +156,7 @@ ifinit(const char *ifname)
  
  	TAILQ_INIT(&ifp->event_list);
  
@@ -856,7 +805,7 @@
  		dprintf(LOG_ERR, "%s" "failed to copy ifname", FNAME);
  		goto die;
  	}
-@@ -719,6 +727,9 @@
+@@ -719,6 +727,9 @@ get_duid(const 	char *idfile, const char
  	struct dhcp6_duid_type1 *dp; /* we only support the type1 DUID */
  	unsigned char tmpbuf[256];	/* DUID should be no more than 256 bytes */
  
@@ -866,7 +815,7 @@
  	if ((fp = fopen(idfile, "r")) == NULL && errno != ENOENT)
  		dprintf(LOG_NOTICE, "%s" "failed to open DUID file: %s",
  		    FNAME, idfile);
-@@ -773,6 +784,9 @@
+@@ -773,6 +784,9 @@ get_duid(const 	char *idfile, const char
  	}
  
  	/* save the (new) ID to the file for next time */
@@ -876,7 +825,7 @@
  	if (!fp) {
  		if ((fp = fopen(idfile, "w+")) == NULL) {
  			dprintf(LOG_ERR, "%s"
-@@ -2032,8 +2046,16 @@
+@@ -2032,8 +2046,16 @@ dprintf(int level, const char *fmt, ...)
  	va_list ap;
  	char logbuf[LINE_MAX];
  
@@ -893,337 +842,86 @@
  
  	if (foreground && debug_thresh >= level) {
  		time_t now;
---- dhcp-0.10/dhcp6.h.libdhcp6client	2007-03-26 10:43:55.000000000 -0400
-+++ dhcp-0.10/dhcp6.h	2007-03-26 10:43:55.000000000 -0400
-@@ -116,9 +116,24 @@
- 
- typedef enum { IANA, IATA, IAPD} iatype_t;
+diff -up dhcp-0.10/client6_addr.c.libdhcp6client dhcp-0.10/client6_addr.c
+--- dhcp-0.10/client6_addr.c.libdhcp6client	2007-10-25 15:21:51.000000000 -0400
++++ dhcp-0.10/client6_addr.c	2007-10-25 15:22:17.000000000 -0400
+@@ -56,6 +56,10 @@
+ #include "timer.h"
+ #include "lease.h"
  
--typedef enum { ACTIVE, RENEW,
 +#ifdef LIBDHCP
-+typedef enum { DHCP6_ACTIVE=1, DHCP6_RENEW,
-+               DHCP6_REBIND, DHCP6_EXPIRED,
-+               DHCP6_INVALID } state_t;
++#include <isc-dhcp/libdhcp_control.h>
++#endif
 +
-+#define ACTIVE DHCP6_ACTIVE
-+#define RENEW DHCP6_RENEW
-+#define REBIND DHCP6_REBIND
-+#define EXPIRED DHCP6_EXPIRED
-+#define INVALID DHCP6_INVALID
-+#include <libdhcp_control.h>
-+extern LIBDHCP_Control *libdhcp_control;
-+#include <dhc6_alloc.h>
+ static int dhcp6_update_lease __P((struct dhcp6_addr *, struct dhcp6_lease *));
+ static int dhcp6_add_lease __P((struct dhcp6_addr *));
+ struct dhcp6_lease *dhcp6_find_lease __P((struct dhcp6_iaidaddr *, 
+@@ -230,14 +234,23 @@ dhcp6_add_lease(addr)
+ 	if (sp->lease_addr.type == IAPD) {
+ 		dprintf(LOG_INFO, "request prefix is %s/%d", 
+ 			in6addr2str(&sp->lease_addr.addr, 0), sp->lease_addr.plen);
+-	} else if (client6_ifaddrconf(IFADDRCONF_ADD, addr) != 0) {
+-		dprintf(LOG_ERR, "%s" "adding address failed: %s",
+-		    FNAME, in6addr2str(&addr->addr, 0));
+-		if (sp->timer)
+-			dhcp6_remove_timer(sp->timer);
+-		free(sp);
+-		return (-1);
++#ifdef LIBDHCP
++	} else if (libdhcp_control && (libdhcp_control->capability & DHCP_CONFIGURE_ADDRESSES)) {
 +#else
-+typedef enum { ACTIVE=1, RENEW,
- 	       REBIND, EXPIRED,
- 	       INVALID } state_t;
++	} else
 +#endif
- /* Internal data structure */
- 
- struct duid {
---- /dev/null	2007-03-21 18:57:18.434748430 -0400
-+++ dhcp-0.10/libdhcp6client/libdhcp_control.h	2007-03-26 10:43:55.000000000 -0400
-@@ -0,0 +1,128 @@
-+/* 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>
-+#include <stdarg.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, const char *fmt,
-+                                      va_list ap);
-+
-+/*
-+ * 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 int (*LIBDHCP_Callback) (struct libdhcp_control_s *control,
-+                                 enum dhcp_state_e, void*);
-+
-+typedef struct libdhcp_control_s {
-+    /* the DHCP clients' main loop calls this on state changes */
-+    LIBDHCP_Callback callback;
-+
-+    /* LIBDHCP_Capability bits to enable */
-+    uint16_t capability;
-+
-+    /* set to one to make clients exit their main loop */
-+    uint8_t finished;
-+
-+    /* set to one to decline the lease (DHCPv4 only) */
-+    uint8_t decline;
-+
-+    /* (timeout+now) == time after which clients MUST return */
-+    time_t timeout;
-+
-+    /* clients set this to time(0) on entering main loop */
-+    time_t now;
-+
-+    /* user data pointer */
-+    void *arg;
-+
-+    LIBDHCP_Error_Handler eh;
-+} LIBDHCP_Control;
-+
-+/* DHCP client "capabilities" */ 
-+typedef enum libdhcp_capability_e {
-+    /* use / do not use persistent lease database files */
-+    DHCP_USE_LEASE_DATABASE = 1,
-+
-+    /* use / do not use pid file */
-+    DHCP_USE_PID_FILE = 2,
-+
-+    /*
-+     * 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.
-+     */
-+
-+    /* configure interfaces UP/DOWN as required */
-+    DHCP_CONFIGURE_INTERFACES = 4,
-+
-+    /* configure interface addresses as required */
-+    DHCP_CONFIGURE_ADDRESSES = 8,
-+
-+    /* configure routes as required */
-+    DHCP_CONFIGURE_ROUTES = 16,
-+
-+          /* configure resolv.conf as required */
-+    DHCP_CONFIGURE_RESOLVER = 32,
-+
-+    /* DHCPv6 only: */
-+    /* configure radvd.conf & restart radvd as required */
-+    DHCP_CONFIGURE_RADVD = 64,
-+} LIBDHCP_Capability;
-+
++		if (client6_ifaddrconf(IFADDRCONF_ADD, addr) != 0) {
++			dprintf(LOG_ERR, "%s" "adding address failed: %s",
++			        FNAME, in6addr2str(&addr->addr, 0));
++			if (sp->timer)
++				dhcp6_remove_timer(sp->timer);
++			free(sp);
++			return (-1);
++		}
++#ifdef LIBDHCP
+ 	}
 +#endif
---- /dev/null	2007-03-21 18:57:18.434748430 -0400
-+++ dhcp-0.10/libdhcp6client/dhc6_alloc.h	2007-03-26 10:43:55.000000000 -0400
-@@ -0,0 +1,16 @@
-+extern void *dhc6_alloc(size_t);
-+extern void *dhc6_realloc(void *, size_t);
-+extern void *dhc6_calloc(size_t, size_t);
-+extern char *dhc6_strdup(char *str);
-+extern void dhc6_free(void *);
-+extern void dhc6_free_all_pointers(void);
-+#undef malloc
-+#define malloc(size) dhc6_alloc(size)
-+#undef realloc
-+#define realloc(ptr, size) dhc6_realloc(ptr, size)
-+#undef calloc
-+#define calloc(n, size) dhc6_calloc(n, size)
-+#undef free
-+#define free(ptr) dhc6_free(ptr)
-+#undef strdup
-+#define strdup(str) dhc6_strdup(str)
---- /dev/null	2007-03-21 18:57:18.434748430 -0400
-+++ dhcp-0.10/libdhcp6client/dhc6_alloc.c	2007-03-26 10:43:55.000000000 -0400
-@@ -0,0 +1,54 @@
-+#include <malloc.h>
-+#include <search.h>
-+#include <string.h>
-+
-+extern void tdestroy (void *root, void (*free_node)(void *nodep));
-+void *ifp_ptr;
-+
-+static void *ptr_tree = NULL;
-+
-+static int ptr_comparator(const void *p1, const void *p2) {
-+    return ((p1 == p2) ? 0 : ((p1 > p2) ? 1 : -1));
-+}
-+
-+void *dhc6_alloc(size_t s) {
-+    void *ptr = malloc(s);
-+    if (ptr != 0)
-+		tsearch(ptr, &(ptr_tree), ptr_comparator);
-+    return ptr;
-+}
 +
-+void *dhc6_realloc(void *ptr, size_t s) {
-+    void *ptr2 = realloc(ptr, s);
-+    if (ptr2 != 0) {
-+		if (ptr != 0)
-+			tdelete(ptr,&(ptr_tree), ptr_comparator);
-+		tsearch(ptr2, &(ptr_tree), ptr_comparator);
-+    }
-+    return ptr2;
-+}
-+
-+void *dhc6_calloc(size_t n, size_t s) {
-+    void *ptr = calloc(n, s);
-+    if (ptr != 0)
-+		tsearch(ptr, &(ptr_tree), ptr_comparator);
-+    return ptr;
-+}
-+
-+char *dhc6_strdup(char *str) {
-+    char *ptr = strdup(str);
-+    if (ptr != 0)
-+		tsearch(ptr, &(ptr_tree), ptr_comparator);
-+    return ptr;
-+}
-+
-+void dhc6_free(void *ptr) {
-+    free(ptr);
-+    tdelete(ptr, &(ptr_tree), ptr_comparator);
-+}
-+
-+void dhc6_free_all_pointers(void) {
-+    if (ptr_tree != NULL)
-+		tdestroy(ptr_tree, free);
-+    ptr_tree = NULL;
-+}
---- /dev/null	2007-03-21 18:57:18.434748430 -0400
-+++ dhcp-0.10/libdhcp6client/dhcp6client.h	2007-03-26 10:43:55.000000000 -0400
-@@ -0,0 +1,25 @@
-+/* dhcp6client.h
-+ *
-+ *  Interface to the DHCPv6 client libdhcp6client 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.
-+ */
-+
-+/* include libdhcp_control.h or libdhcp.h for this */
-+struct libdhcp_control_s;
-+
-+/* the DHCPv6 client main() function */
-+extern int dhcpv6_client(struct libdhcp_control_s *dhc_ctl,
-+                         int argc, char **argv, char **envp);
---- /dev/null	2007-03-21 18:57:18.434748430 -0400
-+++ dhcp-0.10/libdhcp6client/Makefile	2007-03-26 10:43:55.000000000 -0400
-@@ -0,0 +1,68 @@
-+#
-+# Makefile for libdhcp6client
-+# dcantrell at redhat.com
-+#
-+
-+include ../Makefile.inc
-+
-+# Version of dhcpv6
-+VER = 0.10
-+
-+PROGS = libdhcp6client.a libdhcp6client-$(VER).so.0
-+
-+# Source files
-+SRCS = dhcp6c.c common.c config.c timer.c client6_addr.c hash.c \
-+       lease.c netlink.c lease_token.c client6_parse.c client6_token.c \
-+       dad_token.c ra_token.c resolv_token.c radvd_token.c strlcpy.c \
-+       dhc6_alloc.c
-+OBJS = $(SRCS:.c=.o)
-+
-+# Files to link so that debuginfo is generated correctly
-+LINKS = client6_parse.y client6_token.l dad_token.l lease_token.l lex.cpyy.c \
-+        lex.ifyy.c lex.lyy.c lex.rayy.c lex.rdyy.c lex.rvyy.c ra_token.l \
-+        radvd_token.l resolv_token.l y.tab.c y.tab.h
-+
-+CFLAGS += -I. -I.. -DLIBDHCP
-+
-+all: links $(PROGS)
-+
-+links:
-+	@for f in $(LINKS) ; do \
-+		if [ ! -r $$f ]; then \
-+			ln ../$$f $$f ; \
-+		fi ; \
-+	done
-+
-+$(SRCS):
-+	@if [ ! -r $@ ]; then \
-+		if [ -r ../$@ ]; then \
-+			ln ../$@ $@ ; \
-+		fi ; \
-+	fi
-+
-+%.o: %.c
-+	$(CC) $(CFLAGS) -c -o $@ $<
-+
-+libdhcp6client.a: $(OBJS)
-+	$(AR) crus $@ $(OBJS)
-+
-+libdhcp6client-$(VER).so.0: $(OBJS)
-+	$(CC) -shared -o $@ -Wl,-soname,$@ $(OBJS) $(LIBS)
-+
-+install: $(PROGS)
-+	$(INSTALL) -m 0755 -D -o $(INSTALL_USER) -g $(INSTALL_GROUP) libdhcp6client-$(VER).so.0 $(DESTDIR)$(LIBDIR)/libdhcp6client-$(VER).so.0
-+	$(INSTALL) -m 0644 -D -o $(INSTALL_USER) -g $(INSTALL_GROUP) libdhcp6client.a $(DESTDIR)$(LIBDIR)/libdhcp6client.a
-+	mkdir -p $(DESTDIR)$(INCLUDEDIR)/dhcp6client/dhcpv6
-+	$(INSTALL) -m 644 -o $(INSTALL_USER) -g $(INSTALL_GROUP) dhcp6client.h $(DESTDIR)$(INCLUDEDIR)/dhcp6client/dhcp6client.h
-+	$(INSTALL) -m 644 -o $(INSTALL_USER) -g $(INSTALL_GROUP) libdhcp_control.h $(DESTDIR)$(INCLUDEDIR)/dhcp6client/libdhcp_control.h
-+	$(INSTALL) -m 644 -o $(INSTALL_USER) -g $(INSTALL_GROUP) dhc6_alloc.h $(DESTDIR)$(INCLUDEDIR)/dhcp6client/dhcpv6/dhc6_alloc.h
-+	for header in common.h config.h cp.tab.h dhcp6.h hash.h lease.h timer.h ; do \
-+		$(INSTALL) -m 644 -o $(INSTALL_USER) -g $(INSTALL_GROUP) ../$$header $(DESTDIR)$(INCLUDEDIR)/dhcp6client/dhcpv6/$$header ; \
-+	done
-+	$(INSTALL) -m 644 -D -o $(INSTALL_USER) -g $(INSTALL_GROUP) ../libdhcp6client.pc $(DESTDIR)$(PKGCFGDIR)/libdhcp6client.pc
-+	( cd $(DESTDIR)$(LIBDIR) ; rm -f libdhcp6client.so )
-+	( cd $(DESTDIR)$(LIBDIR) ; ln -sf libdhcp6client-$(VER).so.0 libdhcp6client.so )
-+
-+clean:
-+	-rm -f libdhcp6client.a libdhcp6client-$(VER).so.0
-+	-rm -f $(OBJS)
+ 	TAILQ_INSERT_TAIL(&client6_iaidaddr.lease_list, sp, link);
+ 	/* for infinite lifetime don't do any timer */
+ 	if (sp->lease_addr.validlifetime == DHCP6_DURATITION_INFINITE || 
+@@ -284,6 +297,9 @@ dhcp6_remove_lease(struct dhcp6_lease *s
+ 	dprintf(LOG_DEBUG, "%s" "removing address %s", FNAME,
+ 		in6addr2str(&sp->lease_addr.addr, 0));
+ 	sp->state = INVALID;
++#ifdef LIBDHCP
++	if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE))
++#endif
+ 	if (write_lease(sp, client6_lease_file) != 0) {
+ 		dprintf(LOG_INFO, "%s" 
+ 			"failed to write removed lease address %s to lease file", 
+@@ -295,10 +311,13 @@ dhcp6_remove_lease(struct dhcp6_lease *s
+ 		dprintf(LOG_INFO, "request prefix is %s/%d", 
+ 			in6addr2str(&sp->lease_addr.addr, 0), sp->lease_addr.plen);
+ 		/* XXX: remove from the update prefix list */
+-
+-	} else if (client6_ifaddrconf(IFADDRCONF_REMOVE, &sp->lease_addr) != 0) {
+-			dprintf(LOG_INFO, "%s" "removing address %s failed",
+-		    		FNAME, in6addr2str(&sp->lease_addr.addr, 0));
++	} else
++#ifdef LIBDHCP
++	if (libdhcp_control && (libdhcp_control->capability & DHCP_CONFIGURE_ADDRESSES))
++#endif
++	if (client6_ifaddrconf(IFADDRCONF_REMOVE, &sp->lease_addr) != 0) {
++		dprintf(LOG_INFO, "%s" "removing address %s failed",
++		        FNAME, in6addr2str(&sp->lease_addr.addr, 0));
+ 	}
+ 	/* remove expired timer for this lease. */
+ 	if (sp->timer)
+@@ -454,6 +473,9 @@ dhcp6_update_lease(struct dhcp6_addr *ad
+ 	memcpy(&sp->lease_addr, addr, sizeof(sp->lease_addr));
+ 	sp->state = ACTIVE;
+ 	time(&sp->start_date);
++#ifdef LIBDHCP
++	if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE))
++#endif
+ 	if (write_lease(sp, client6_lease_file) != 0) {
+ 		dprintf(LOG_ERR, "%s" 
+ 			"failed to write an updated lease address %s to lease file", 


Index: dhcpv6.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dhcpv6/devel/dhcpv6.spec,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- dhcpv6.spec	9 Oct 2007 14:30:58 -0000	1.66
+++ dhcpv6.spec	25 Oct 2007 20:46:49 -0000	1.67
@@ -1,13 +1,20 @@
+# we require dhcp-devel to build for libdhcp_control.h
+%define dhcpdevelver 12:3.1.0
+
 Summary: DHCPv6 - DHCP server and client for IPv6
 Name:    dhcpv6
 Version: 0.10
-Release: 51%{?dist}
+Release: 52%{?dist}
 License: BSD
 Group:   System Environment/Daemons
 URL:     http://dhcpv6.sourceforge.net/
 Source0: ftp://ftp.sourceforge.net/pub/sourceforge/d/dh/dhcp/dhcp-%{version}.tgz
 Source1: libdhcp6client.pc
 Source2: rfc3315.txt
+Source3: Makefile.libdhcp6client
+Source4: dhc6_alloc.c
+Source5: dhc6_alloc.h
+Source6: dhcp6client.h
 
 Patch0:  %{name}-0.10-redhat.patch
 Patch1:  %{name}-0.10-relay.patch
@@ -24,11 +31,16 @@
 Patch12: %{name}-0.10-retransmit-confirm.patch
 Patch13: %{name}-0.10-elapsed-time.patch
 Patch14: %{name}-0.10-reassign-global.patch
-
-Patch99: %{name}-0.10-libdhcp6client.patch
+Patch15: %{name}-0.10-libdhcp6client.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: flex, bison, openssl-devel, autoconf, automake, libtool
+BuildRequires: flex
+BuildRequires: bison
+BuildRequires: openssl-devel
+BuildRequires: autoconf
+BuildRequires: automake
+BuildRequires: libtool
+BuildRequires: dhcp-devel >= %{dhcpdevelver}
 Requires(post): chkconfig
 Requires(preun): chkconfig initscripts
 Requires(postun): initscripts
@@ -64,7 +76,8 @@
 %package -n libdhcp6client-devel
 Summary:  Header files for development with the DHCPv6 client library
 Group:    Development/Libraries
-Requires: pkgconfig, libdhcp6client = %{version}-%{release}
+Requires: pkgconfig
+Requires: libdhcp6client = %{version}-%{release}
 
 %description -n libdhcp6client-devel
 Header files for development with the DHCPv6 client library.
@@ -95,8 +108,12 @@
 %patch12 -p1 -b .retransmit
 %patch13 -p1 -b .elapsed
 %patch14 -p1 -b .reassign
+%patch15 -p1 -b .libdhcp6client
 
-%patch99 -p1 -b .libdhcp6client
+# copy in libdhcp6client-specific sources
+%{__mkdir} -p libdhcp6client
+%{__cp} -p %{SOURCE3} libdhcp6client/Makefile
+%{__cp} -p %{SOURCE4} %{SOURCE5} %{SOURCE6} libdhcp6client/
 
 %{__cp} -fp %{SOURCE2} docs
 
@@ -189,6 +206,13 @@
 %{_libdir}/libdhcp6client.a
 
 %changelog
+* Wed Oct 24 2007 David Cantrell <dcantrell at redhat.com> - 0.10-52
+- Remove DHCPv6.Cflags variable from libdhcp6client.pc
+- Install dhcpv6 headers for libdhcp6client to /usr/include/dhcp6client
+- Remove the libdhcp_control.h header file
+- Extract full files from libdhcp6client patch and store as Sources
+- Require dhcp-devel >= 12:3.1.0 for libdhcp_control.h
+
 * Tue Sep 11 2007 David Cantrell <dcantrell at redhat.com> - 0.10-51
 - Fix chkconfig lines in init scripts
 - Obsolete dhcpv6_client (not nvr specific) in dhcpv6-client (#324901)


Index: libdhcp6client.pc
===================================================================
RCS file: /cvs/pkgs/rpms/dhcpv6/devel/libdhcp6client.pc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- libdhcp6client.pc	15 May 2006 14:54:08 -0000	1.1
+++ libdhcp6client.pc	25 Oct 2007 20:46:49 -0000	1.2
@@ -1,7 +1,6 @@
-Name:		libdhcp6client
-Description:	The DHCPv6 IPv6 DHCP client library
-Version:	@DHCPV6_VERSION@
-Libs:		-ldhcp6client
-Libs.private:	-lresolv -lcrypto
-Cflags:		-I/usr/include/dhcp6client
-DHCPv6.Cflags=  -I/usr/include/dhcp6client/dhcpv6
+Name: libdhcp6client
+Description: The DHCPv6 IPv6 DHCP client library
+Version: @DHCPV6_VERSION@
+Libs: -ldhcp6client
+Libs.private: -lresolv -lcrypto
+Cflags: -I/usr/include/dhcp6client




More information about the fedora-extras-commits mailing list