rpms/dhcpv6/devel dhcpv6-0.99.0-libdhcp6client.patch, NONE, 1.1 .cvsignore, 1.2, 1.3 dhcpv6.spec, 1.68, 1.69 sources, 1.2, 1.3 dhcpv6-0.10-IA_NA-ignore.patch, 1.1, NONE dhcpv6-0.10-device-names.patch, 1.1, NONE dhcpv6-0.10-elapsed-time.patch, 1.1, NONE dhcpv6-0.10-file-checks.patch, 1.1, NONE dhcpv6-0.10-gethwid.patch, 1.1, NONE dhcpv6-0.10-initscripts.patch, 1.4, NONE dhcpv6-0.10-libdhcp6client.patch, 1.12, NONE dhcpv6-0.10-lsb.patch, 1.2, NONE dhcpv6-0.10-man.patch, 1.1, NONE dhcpv6-0.10-no-strlcat.patch, 1.1, NONE dhcpv6-0.10-reassign-global.patch, 1.1, NONE dhcpv6-0.10-redhat.patch, 1.7, NONE dhcpv6-0.10-relay.patch, 1.2, NONE dhcpv6-0.10-remove-leases.patch, 1.1, NONE dhcpv6-0.10-retransmit-confirm.patch, 1.1, NONE dhcpv6-0.10-salen.patch, 1.4, NONE
David Cantrell (dcantrel)
fedora-extras-commits at redhat.com
Thu Nov 8 22:37:21 UTC 2007
- Previous message (by thread): rpms/selinux-policy/F-8 modules-targeted.conf, 1.70, 1.71 policy-20070703.patch, 1.126, 1.127 selinux-policy.spec, 1.571, 1.572
- Next message (by thread): rpms/gdb/F-8 gdb-6.7-ppc-clobbered-registers-O2-fix.patch, NONE, 1.1 gdb-6.7-ppc-clobbered-registers-O2-test.patch, NONE, 1.1 gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch, 1.2, 1.3 gdb.spec, 1.252, 1.253
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: dcantrel
Update of /cvs/pkgs/rpms/dhcpv6/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv8172
Modified Files:
.cvsignore dhcpv6.spec sources
Added Files:
dhcpv6-0.99.0-libdhcp6client.patch
Removed Files:
dhcpv6-0.10-IA_NA-ignore.patch dhcpv6-0.10-device-names.patch
dhcpv6-0.10-elapsed-time.patch dhcpv6-0.10-file-checks.patch
dhcpv6-0.10-gethwid.patch dhcpv6-0.10-initscripts.patch
dhcpv6-0.10-libdhcp6client.patch dhcpv6-0.10-lsb.patch
dhcpv6-0.10-man.patch dhcpv6-0.10-no-strlcat.patch
dhcpv6-0.10-reassign-global.patch dhcpv6-0.10-redhat.patch
dhcpv6-0.10-relay.patch dhcpv6-0.10-remove-leases.patch
dhcpv6-0.10-retransmit-confirm.patch dhcpv6-0.10-salen.patch
Log Message:
* Thu Nov 08 2007 David Cantrell <dcantrell at redhat.com> - 0.99.0-1
- Upgraded to new upstream version, dhcpv6-0.99.0
dhcpv6-0.99.0-libdhcp6client.patch:
--- NEW FILE dhcpv6-0.99.0-libdhcp6client.patch ---
diff -up dhcpv6-0.99.0/dhcp6c.c.libdhcp6client dhcpv6-0.99.0/dhcp6c.c
--- dhcpv6-0.99.0/dhcp6c.c.libdhcp6client 2007-11-08 16:51:41.000000000 -0500
+++ dhcpv6-0.99.0/dhcp6c.c 2007-11-08 17:34:02.000000000 -0500
@@ -74,6 +74,9 @@
#include "common.h"
#include "timer.h"
#include "lease.h"
+#ifdef LIBDHCP
+#include <isc-dhcp/libdhcp_control.h>
+#endif
static int debug = 0;
static u_long sig_flags = 0;
@@ -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 *));
+#ifndef LIBDHCP
static void client6_signal __P((int));
+#endif
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,18 +160,34 @@ extern int dad_parse(const char *file);
#define DUID_FILE "/var/lib/dhcpv6/dhcp6c_duid"
static int pid;
+#ifdef LIBDHCP
+struct sockaddr_in6 sa6_allagent_storage;
+#endif
char client6_lease_temp[256];
struct dhcp6_list request_list;
+#ifndef LIBDHCP
int
-main(argc, argv)
+main(argc, argv, envp)
+#else
+#define exit return
+LIBDHCP_Control *libdhcp_control;
+__attribute__ ((visibility ("default")))
+int dhcpv6_client
+(libdhcp_ctl, argc, argv, envp)
+ LIBDHCP_Control *libdhcp_ctl;
+#endif
int argc;
char **argv;
+ char **envp;
{
int ch;
char *progname, *conffile = DHCP6C_CONF;
FILE *pidfp;
char *addr;
+#ifdef LIBDHCP
+ libdhcp_control = libdhcp_ctl;
+#endif
pid = getpid();
srandom(time(NULL) & pid);
@@ -284,12 +305,18 @@ main(argc, argv)
}
setloglevel(debug);
+#ifdef LIBDHCP
+ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_PID_FILE))
+#endif
/* dump current PID */
if ((pidfp = fopen(DHCP6C_PIDFILE, "w")) != NULL) {
fprintf(pidfp, "%d\n", pid);
fclose(pidfp);
}
+#ifdef LIBDHCP
+ sa6_allagent = (const struct sockaddr_in6 *) &sa6_allagent_storage;
+#endif
ifinit(device);
setup_interface(device);
@@ -301,7 +328,57 @@ main(argc, argv)
client6_init(device);
client6_ifinit(device);
client6_mainloop();
- exit(0);
+#ifdef LIBDHCP
+ /* close all file descriptors */
+ close(nlsock);
+ nlsock = -1;
+ close(insock);
+ insock = -1;
+ close(outsock);
+ outsock = -1;
+ closelog();
+
+ /* release all memory */
+ sleep(1); /* keep valgrind happy :-) */
+ dhc6_free_all_pointers();
+
+ /* initialize globals */
+ optarg = 0L;
+ optind = 0;
+ opterr = 0;
+ optopt = 0;
+ memset(&client6_iaidaddr, '\0', sizeof(client6_iaidaddr));
+ dhcp6_if = NULL;
+ dadlist = NULL;
+ extern LIST_HEAD(, dhcp6_timer) timer_head;
+ memset(&timer_head, '\0', sizeof(timer_head));
+ memset(&request_list, '\0', sizeof(request_list));
+ memset(&sa6_allagent_storage, '\0', sizeof(sa6_allagent_storage));
+ sa6_allagent = (const struct sockaddr_in6 *) &sa6_allagent_storage;
+ memset(&client_duid, '\0', sizeof(client_duid));
+ memset(&iaidtab, '\0', sizeof(iaidtab));
+ client6_request_flag = 0;
+ memset(&leasename, '\0', sizeof(leasename));
+ debug = 0;
+ device = NULL;
+ num_device = 0;
+ sig_flags = 0;
+ extern struct host_conf *host_conflist;
+ host_conflist = 0;
+ client6_lease_file = server6_lease_file = sync_file = NULL;
+ cf_dns_list = NULL;
+ extern int cfdebug;
+ cfdebug = 0;
+ hash_anchors = 0;
+ configfilename = NULL;
+ debug_thresh = 0;
+ memset(&dnslist, '\0', sizeof(dnslist));
+ memset(&radvd_dhcpv6_file, '\0', sizeof(radvd_dhcpv6_file));
+ memset(&resolv_dhcpv6_file, '\0', sizeof(resolv_dhcpv6_file));
+ memset(&client6_lease_temp, '\0', sizeof(client6_lease_temp));
+ foreground = 0;
+#endif
+ return(0);
}
static void
@@ -320,7 +397,9 @@ client6_init(device)
char *device;
{
struct addrinfo hints, *res;
+#ifndef LIBDHCP
static struct sockaddr_in6 sa6_allagent_storage;
+#endif
int error, on = 1;
struct dhcp6_if *ifp;
int ifidx;
@@ -332,19 +411,19 @@ client6_init(device)
ifidx = if_nametoindex(device);
if (ifidx == 0) {
dprintf(LOG_ERR, "if_nametoindex(%s)", device);
- exit(1);
+ return;
}
/* get our DUID */
if (get_duid(DUID_FILE, device, &client_duid)) {
dprintf(LOG_ERR, "%s" "failed to get a DUID", FNAME);
- exit(1);
+ return;
}
if (get_linklocal(device, &lladdr) < 0) {
- exit(1);
+ return;
}
if (inet_ntop(AF_INET6, &lladdr, linklocal, sizeof(linklocal)) < 0) {
- exit(1);
+ return;
}
dprintf(LOG_DEBUG, "link local addr is %s", linklocal);
@@ -357,12 +436,12 @@ client6_init(device)
if (error) {
dprintf(LOG_ERR, "%s" "getaddrinfo: %s",
FNAME, strerror(error));
- exit(1);
+ return;
}
insock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (insock < 0) {
dprintf(LOG_ERR, "%s" "socket(inbound)", FNAME);
- exit(1);
+ return;
}
#ifdef IPV6_RECVPKTINFO
if (setsockopt(insock, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on,
@@ -370,7 +449,7 @@ client6_init(device)
dprintf(LOG_ERR, "%s"
"setsockopt(inbound, IPV6_RECVPKTINFO): %s",
FNAME, strerror(errno));
- exit(1);
+ return;
}
#else
if (setsockopt(insock, IPPROTO_IPV6, IPV6_PKTINFO, &on,
@@ -378,7 +457,7 @@ client6_init(device)
dprintf(LOG_ERR, "%s"
"setsockopt(inbound, IPV6_PKTINFO): %s",
FNAME, strerror(errno));
- exit(1);
+ return;
}
#endif
((struct sockaddr_in6 *)(res->ai_addr))->sin6_scope_id = ifidx;
@@ -407,7 +486,7 @@ client6_init(device)
if (bound < 0) {
dprintf(LOG_ERR, "%s" "bind(inbound): %s", FNAME, strerror(-bound));
- exit(bound);
+ return;
}
freeaddrinfo(res);
@@ -417,26 +496,26 @@ client6_init(device)
if (error) {
dprintf(LOG_ERR, "%s" "getaddrinfo: %s",
FNAME, gai_strerror(error));
- exit(1);
+ return;
}
outsock = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (outsock < 0) {
dprintf(LOG_ERR, "%s" "socket(outbound): %s",
FNAME, strerror(errno));
- exit(1);
+ return;
}
if (setsockopt(outsock, IPPROTO_IPV6, IPV6_MULTICAST_IF,
&ifidx, sizeof(ifidx)) < 0) {
dprintf(LOG_ERR, "%s"
"setsockopt(outbound, IPV6_MULTICAST_IF): %s",
FNAME, strerror(errno));
- exit(1);
+ return;
}
((struct sockaddr_in6 *)(res->ai_addr))->sin6_scope_id = ifidx;
if (bind(outsock, res->ai_addr, res->ai_addrlen) < 0) {
dprintf(LOG_ERR, "%s" "bind(outbound): %s",
FNAME, strerror(errno));
- exit(1);
+ return;
}
freeaddrinfo(res);
memset(&hints, 0, sizeof(hints));
@@ -447,7 +526,7 @@ client6_init(device)
if (error) {
dprintf(LOG_ERR, "%s" "getaddrinfo: %s",
FNAME, gai_strerror(error));
- exit(1);
+ return;
}
memcpy(&sa6_allagent_storage, res->ai_addr, res->ai_addrlen);
sa6_allagent = (const struct sockaddr_in6 *)&sa6_allagent_storage;
@@ -458,25 +537,27 @@ client6_init(device)
if ((ifp = find_ifconfbyname(device)) == NULL) {
dprintf(LOG_ERR, "%s" "interface %s not configured",
FNAME, device);
- exit(1);
+ return;
}
ifp->outsock = outsock;
+#ifndef LIBDHCP
if (signal(SIGHUP, client6_signal) == SIG_ERR) {
dprintf(LOG_WARNING, "%s" "failed to set signal: %s",
FNAME, strerror(errno));
- exit(1);
+ return;
}
if (signal(SIGTERM|SIGKILL, client6_signal) == SIG_ERR) {
dprintf(LOG_WARNING, "%s" "failed to set signal: %s",
FNAME, strerror(errno));
- exit(1);
+ return;
}
if (signal(SIGINT, client6_signal) == SIG_ERR) {
dprintf(LOG_WARNING, "%s" "failed to set signal: %s",
FNAME, strerror(errno));
- exit(1);
+ return;
}
+#endif
}
static void
@@ -490,13 +571,13 @@ client6_ifinit(char *device)
/* get iaid for each interface */
if (num_device == 0) {
if ((num_device = create_iaid(&iaidtab[0], num_device)) < 0)
- exit(1);
+ return;
ifp->iaidinfo.iaid = get_iaid(ifp->ifname, &iaidtab[0], num_device);
if (ifp->iaidinfo.iaid == 0) {
dprintf(LOG_DEBUG, "%s"
"interface %s iaid failed to be created",
FNAME, ifp->ifname);
- exit(1);
+ return;
}
dprintf(LOG_DEBUG, "%s" "interface %s iaid is %u",
FNAME, ifp->ifname, ifp->iaidinfo.iaid);
@@ -505,6 +586,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);
+#ifdef LIBDHCP
+ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE)) {
+#endif
/* parse the lease file */
strcpy(leasename, PATH_CLIENT6_LEASE);
sprintf(iaidstr, "%u", ifp->iaidinfo.iaid);
@@ -512,14 +596,17 @@ client6_ifinit(char *device)
if ((client6_lease_file =
init_leases(leasename)) == NULL) {
dprintf(LOG_ERR, "%s" "failed to parse lease file", FNAME);
- exit(1);
+ return;
}
strcpy(client6_lease_temp, leasename);
strcat(client6_lease_temp, "XXXXXX");
client6_lease_file =
sync_leases(client6_lease_file, leasename, client6_lease_temp);
if (client6_lease_file == NULL)
- exit(1);
+ return;
+#ifdef LIBDHCP
+ }
+#endif
if (!TAILQ_EMPTY(&client6_iaidaddr.lease_list)) {
struct dhcp6_listval *lv;
if (!(client6_request_flag & CLIENT6_REQUEST_ADDR) &&
@@ -527,7 +614,7 @@ client6_ifinit(char *device)
client6_request_flag |= CLIENT6_CONFIRM_ADDR;
if (TAILQ_EMPTY(&request_list)) {
if (create_request_list(1) < 0)
- exit(1);
+ return;
} else if (client6_request_flag & CLIENT6_RELEASE_ADDR) {
for (lv = TAILQ_FIRST(&request_list); lv;
lv = TAILQ_NEXT(lv, link)) {
@@ -536,13 +623,13 @@ client6_ifinit(char *device)
dprintf(LOG_INFO, "this address %s is not"
" leased by this client",
in6addr2str(&lv->val_dhcp6addr.addr,0));
- exit(0);
+ return;
}
}
}
} else if (client6_request_flag & CLIENT6_RELEASE_ADDR) {
dprintf(LOG_INFO, "no ipv6 addresses are leased by client");
- exit(0);
+ return;
}
ifp->link_flag |= IFF_RUNNING;
@@ -553,11 +640,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);
- exit(1);
+ return;
}
if ((ifp->sync_timer = dhcp6_add_timer(check_lease_file_timo, ifp)) < 0) {
dprintf(LOG_ERR, "%s" "failed to create a timer", FNAME);
- exit(1);
+ return;
}
/* DAD timer set up after getting the address */
ifp->dad_timer = NULL;
@@ -565,7 +652,7 @@ client6_ifinit(char *device)
if ((ev = dhcp6_create_event(ifp, DHCP6S_INIT)) == NULL) {
dprintf(LOG_ERR, "%s" "failed to create an event",
FNAME);
- exit(1);
+ return;
}
ifp->servers = NULL;
ev->ifp->current_server = NULL;
@@ -573,7 +660,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);
- exit(1);
+ return;
}
dhcp6_reset_timer(ev);
}
@@ -590,6 +677,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);
+#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" "deconfiging address %s failed",
FNAME, in6addr2str(&sp->lease_addr.addr, 0));
@@ -601,6 +691,9 @@ free_resources(struct dhcp6_if *ifp)
ev_next = TAILQ_NEXT(ev, link);
dhcp6_remove_event(ev);
}
+#ifdef LIBDHCP
+ if (libdhcp_control && (libdhcp_control->capability & DHCP_CONFIGURE_RADVD))
+#endif
/* XXX: check the last dhcpv6 client daemon to restore the original file */
{
/* restore /etc/radv.conf.bak back to /etc/radvd.conf */
@@ -622,7 +715,7 @@ process_signals()
dprintf(LOG_INFO, FNAME "exiting");
free_resources(dhcp6_if);
unlink(DHCP6C_PIDFILE);
- exit(0);
+ return;
}
if ((sig_flags & SIGF_HUP)) {
dprintf(LOG_INFO, FNAME "restarting");
@@ -631,7 +724,7 @@ process_signals()
}
if ((sig_flags & SIGF_CLEAN)) {
free_resources(dhcp6_if);
- exit(0);
+ return;
}
sig_flags = 0;
}
@@ -643,11 +736,39 @@ client6_mainloop()
int ret;
fd_set r;
+#ifdef LIBDHCP
+ struct timeval fb; /* fallback timeout */
+
+ if (libdhcp_control) {
+ if (libdhcp_control->timeout)
+ libdhcp_control->now = time(0);
+ else
+ libdhcp_control->now = 0;
+ }
+#endif
+
while(1) {
if (sig_flags)
process_signals();
w = dhcp6_check_timer();
+#ifdef LIBDHCP
+ if (libdhcp_control && libdhcp_control->timeout) {
+ time_t now = time(0);
+ double a = (double) w->tv_sec + now;
+ double b = (double) w->tv_usec / 1000000.0;
+ double c = (double) libdhcp_control->now;
+ double d = (double) libdhcp_control->timeout;
+ if ((w == NULL) || ((a + b) >= (c + d))) {
+ w = &fb;
+ fb.tv_sec = 0;
+ fb.tv_usec = 0;
+ if (now < (libdhcp_control->now + libdhcp_control->timeout))
+ fb.tv_sec = (libdhcp_control->now + libdhcp_control->timeout) - now;
+ }
+ }
+#endif
+
FD_ZERO(&r);
FD_SET(insock, &r);
@@ -657,7 +778,7 @@ client6_mainloop()
if (errno != EINTR) {
dprintf(LOG_ERR, "%s" "select: %s",
FNAME, strerror(errno));
- exit(1);
+ return;
}
break;
case 0: /* timeout */
@@ -665,6 +786,19 @@ client6_mainloop()
default: /* received a packet */
client6_recv();
}
+
+#ifdef LIBDHCP
+ if (libdhcp_control) {
+ if (libdhcp_control->finished)
+ return;
+
+ if (libdhcp_control->timeout && (time(NULL) >= (libdhcp_control->timeout + libdhcp_control->now))) {
+ if (libdhcp_control->callback)
+ (*(libdhcp_control->callback)) (libdhcp_control, DHC_TIMEDOUT, &client6_iaidaddr);
+ return;
+ }
+ }
+#endif
}
}
@@ -735,7 +869,7 @@ client6_timo(arg)
/* this should not happen! */
dprintf(LOG_ERR, "%s" "can't find a server",
FNAME);
- exit(1); /* XXX */
+ return (NULL);
}
/* if get the address assginment break */
if (!TAILQ_EMPTY(&client6_iaidaddr.lease_list)) {
@@ -794,6 +928,7 @@ select_server(ifp)
return (NULL);
}
+#ifndef LIBDHCP
static void
client6_signal(sig)
int sig;
@@ -816,6 +951,7 @@ client6_signal(sig)
break;
}
}
+#endif
void
client6_send(ev)
@@ -842,21 +978,21 @@ client6_send(ev)
case DHCP6S_REQUEST:
if (ifp->current_server == NULL) {
dprintf(LOG_ERR, "%s" "assumption failure", FNAME);
- exit(1); /* XXX */
+ return;
}
dh6->dh6_msgtype = DH6_REQUEST;
break;
case DHCP6S_RENEW:
if (ifp->current_server == NULL) {
dprintf(LOG_ERR, "%s" "assumption failure", FNAME);
- exit(1); /* XXX */
+ return;
}
dh6->dh6_msgtype = DH6_RENEW;
break;
case DHCP6S_DECLINE:
if (ifp->current_server == NULL) {
dprintf(LOG_ERR, "%s" "assumption failure", FNAME);
- exit(1); /* XXX */
+ return;
}
dh6->dh6_msgtype = DH6_DECLINE;
break;
@@ -874,7 +1010,7 @@ client6_send(ev)
break;
default:
dprintf(LOG_ERR, "%s" "unexpected state %d", FNAME, ev->state);
- exit(1); /* XXX */
+ return;
}
/*
* construct options
@@ -914,7 +1050,7 @@ client6_send(ev)
case DHCP6S_RENEW:
case DHCP6S_DECLINE:
if (&ifp->current_server->optinfo == NULL)
- exit(1);
+ return;
dprintf(LOG_DEBUG, "current server ID %s",
duidstr(&ifp->current_server->optinfo.serverID));
if (duidcpy(&optinfo.serverID,
@@ -1004,17 +1140,28 @@ client6_send(ev)
} else {
if (ev->state == DHCP6S_RELEASE) {
dprintf(LOG_INFO, "release empty address list");
- exit(1);
+ return;
}
/* XXX: allow the other emtpy list ?? */
}
if (client6_request_flag & CLIENT6_RELEASE_ADDR) {
+#ifdef LIBDHCP
+ if (libdhcp_control && (libdhcp_control->capability & DHCP_CONFIGURE_ADDRESSES))
+#endif
if (dhcp6_update_iaidaddr(&optinfo, ADDR_REMOVE)) {
dprintf(LOG_INFO, "client release failed");
- exit(1);
+ return;
}
+#ifdef LIBDHCP
+ if (libdhcp_control && (libdhcp_control->capability & DHCP_CONFIGURE_RADVD))
+#endif
if (client6_iaidaddr.client6_info.type == IAPD)
radvd_parse(&client6_iaidaddr, ADDR_REMOVE);
+
+#ifdef LIBDHCP
+ if (libdhcp_control && libdhcp_control->callback)
+ (*(libdhcp_control->callback)) (libdhcp_control, DHC6_RELEASE, &client6_iaidaddr);
+#endif
}
break;
default:
@@ -1053,7 +1200,7 @@ client6_send(ev)
if (error) {
dprintf(LOG_ERR, "%s" "getaddrinfo: %s",
FNAME, gai_strerror(error));
- exit(1);
+ return;
}
memcpy(&dst, res->ai_addr, res->ai_addrlen);
salen = res->ai_addrlen;
@@ -1275,8 +1422,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 */
- if (!TAILQ_EMPTY(&optinfo0->addr_list))
+ if (!TAILQ_EMPTY(&optinfo0->addr_list)) {
+#ifdef LIBDHCP
+ if (!TAILQ_EMPTY(&(client6_iaidaddr.lease_list)))
+ /* looks like we did a successful REBIND ? */
+ if (libdhcp_control && libdhcp_control->callback) {
+ (*(libdhcp_control->callback)) (libdhcp_control, DHC6_REBIND, optinfo0);
+ }
+#endif
dhcp6_copy_list(&request_list, &optinfo0->addr_list);
+ }
return 0;
}
@@ -1419,6 +1574,9 @@ client6_recvreply(ifp, dh6, len, optinfo
if (!TAILQ_EMPTY(&optinfo->dns_list.addrlist) ||
optinfo->dns_list.domainlist != NULL) {
+#ifdef LIBDHCP
+ if (libdhcp_control && (libdhcp_control->capability & DHCP_CONFIGURE_RESOLVER))
+#endif
resolv_parse(&optinfo->dns_list);
}
/*
@@ -1492,14 +1650,21 @@ client6_recvreply(ifp, dh6, len, optinfo
if (!TAILQ_EMPTY(&optinfo->addr_list)) {
(void)get_if_rainfo(ifp);
dhcp6_add_iaidaddr(optinfo);
- if (optinfo->type == IAPD)
+ if (optinfo->type == IAPD) {
+#ifdef LIBDHCP
+ if (libdhcp_control && (libdhcp_control->capability & DHCP_CONFIGURE_RADVD))
+#endif
radvd_parse(&client6_iaidaddr, ADDR_UPDATE);
- else if (ifp->dad_timer == NULL && (ifp->dad_timer =
+ } else if (ifp->dad_timer == NULL && (ifp->dad_timer =
dhcp6_add_timer(check_dad_timo, ifp)) < 0) {
dprintf(LOG_INFO, "%s" "failed to create a timer for "
" DAD", FNAME);
}
setup_check_timer(ifp);
+#ifdef LIBDHCP
+ if (libdhcp_control && libdhcp_control->callback)
+ (*(libdhcp_control->callback)) (libdhcp_control, DHC6_BOUND, optinfo);
+#endif
}
break;
}
@@ -1515,6 +1680,10 @@ client6_recvreply(ifp, dh6, len, optinfo
dprintf(LOG_DEBUG, "%s"
"got a NoBinding reply, sending request.", FNAME);
dhcp6_remove_iaidaddr(&client6_iaidaddr);
+#ifdef LIBDHCP
+ if (libdhcp_control && libdhcp_control->callback)
+ (*(libdhcp_control->callback)) (libdhcp_control, DHC6_RELEASE, &client6_iaidaddr);
+#endif
break;
case DH6OPT_STCODE_NOADDRAVAIL:
case DH6OPT_STCODE_NOPREFIXAVAIL:
@@ -1525,7 +1694,14 @@ client6_recvreply(ifp, dh6, len, optinfo
default:
dhcp6_update_iaidaddr(optinfo, ADDR_UPDATE);
if (optinfo->type == IAPD)
+#ifdef LIBDHCP
+ if (libdhcp_control && (libdhcp_control->capability & DHCP_CONFIGURE_RADVD))
+#endif
radvd_parse(&client6_iaidaddr, ADDR_UPDATE);
+#ifdef LIBDHCP
+ if (libdhcp_control && libdhcp_control->callback)
+ (*(libdhcp_control->callback)) (libdhcp_control, DHC6_REBIND, optinfo);
+#endif
break;
}
break;
@@ -1672,6 +1848,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)) {
+#ifdef LIBDHCP
+ if (libdhcp_control && (libdhcp_control->capability & DHCP_CONFIGURE_ADDRESSES))
+#endif
if (client6_ifaddrconf(IFADDRCONF_ADD, &cl->lease_addr) != 0) {
dprintf(LOG_INFO, "config address failed: %s",
in6addr2str(&cl->lease_addr.addr, 0));
@@ -1682,6 +1861,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))
+#ifdef LIBDHCP
+ if (libdhcp_control && (libdhcp_control->capability & DHCP_CONFIGURE_RADVD))
+#endif
radvd_parse(&client6_iaidaddr, ADDR_UPDATE);
return (0);
}
@@ -1818,7 +2000,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));
- exit(1);
+ return;
}
memset(&ifr,'\0', sizeof(struct ifreq));
@@ -1826,13 +2008,13 @@ setup_interface(char *ifname)
if (ioctl(nlsock, SIOCGIFFLAGS, &ifr) < 0) {
dprintf(LOG_ERR, "ioctl SIOCGIFFLAGS failed");
- exit(1);
+ return;
}
while ((ifr.ifr_flags & (IFF_UP | IFF_RUNNING)) != (IFF_UP | IFF_RUNNING)) {
if (retries++ > 1) {
dprintf(LOG_INFO, "NIC is not connected to the network, please connect it.");
- exit(1);
+ return;
}
memset(&ifr, '\0', sizeof(struct ifreq));
@@ -1840,7 +2022,7 @@ setup_interface(char *ifname)
ifr.ifr_flags |= (IFF_UP | IFF_RUNNING) ;
if (ioctl(nlsock, SIOCSIFFLAGS, &ifr) < 0) {
dprintf(LOG_ERR, "ioctl SIOCSIFFLAGS failed");
- exit(1);
+ return;
}
/*
@@ -1853,7 +2035,7 @@ setup_interface(char *ifname)
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
if (ioctl(nlsock, SIOCGIFFLAGS, &ifr) < 0) {
dprintf(LOG_ERR, "ioctl SIOCGIFFLAGS failed");
- exit(1);
+ return;
}
}
diff -up dhcpv6-0.99.0/dhcp6.h.libdhcp6client dhcpv6-0.99.0/dhcp6.h
--- dhcpv6-0.99.0/dhcp6.h.libdhcp6client 2007-11-08 16:30:14.000000000 -0500
+++ dhcpv6-0.99.0/dhcp6.h 2007-11-08 17:22:13.000000000 -0500
@@ -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 dhcpv6-0.99.0/common.c.libdhcp6client dhcpv6-0.99.0/common.c
--- dhcpv6-0.99.0/common.c.libdhcp6client 2007-11-08 16:51:41.000000000 -0500
+++ dhcpv6-0.99.0/common.c 2007-11-08 17:22:13.000000000 -0500
@@ -79,11 +79,19 @@
#include "timer.h"
#include "lease.h"
+#ifdef LIBDHCP
+#include <isc-dhcp/libdhcp_control.h>
+#endif
+
int foreground;
int debug_thresh;
struct dhcp6_if *dhcp6_if;
struct dns_list dnslist;
+#ifdef LIBDHCP
+struct host_conf *host_conflist;
+#else
static struct host_conf *host_conflist;
+#endif
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 @@ ifinit(const char *ifname)
TAILQ_INIT(&ifp->event_list);
- if ((ifp->ifname = strdup(ifname)) == NULL) {
+ if ((ifp->ifname = strdup((char *) ifname)) == NULL) {
dprintf(LOG_ERR, "%s" "failed to copy ifname", FNAME);
goto die;
}
@@ -721,6 +729,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 */
+#ifdef LIBDHCP
+ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE))
+#endif
if ((fp = fopen(idfile, "r")) == NULL && errno != ENOENT)
dprintf(LOG_NOTICE, "%s" "failed to open DUID file: %s",
FNAME, idfile);
@@ -775,6 +786,9 @@ get_duid(const char *idfile, const char
}
/* save the (new) ID to the file for next time */
+#ifdef LIBDHCP
+ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE))
+#endif
if (!fp) {
if ((fp = fopen(idfile, "w+")) == NULL) {
dprintf(LOG_ERR, "%s"
@@ -2070,8 +2084,16 @@ dprintf(int level, const char *fmt, ...)
va_list ap;
char logbuf[LINE_MAX];
+#ifdef LIBDHCP
+ va_start(ap, fmt);
+ if (libdhcp_control && libdhcp_control->eh)
+ libdhcp_control->eh(libdhcp_control, level, fmt, ap);
+ va_end(ap);
+ return;
+#endif
va_start(ap, fmt);
vsnprintf(logbuf, sizeof(logbuf), fmt, ap);
+ va_end(ap);
if (foreground && debug_thresh >= level) {
time_t now;
diff -up dhcpv6-0.99.0/client6_addr.c.libdhcp6client dhcpv6-0.99.0/client6_addr.c
--- dhcpv6-0.99.0/client6_addr.c.libdhcp6client 2007-11-08 16:16:52.000000000 -0500
+++ dhcpv6-0.99.0/client6_addr.c 2007-11-08 17:22:13.000000000 -0500
@@ -56,6 +56,10 @@
#include "timer.h"
#include "lease.h"
+#ifdef LIBDHCP
+#include <isc-dhcp/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 *,
@@ -225,14 +229,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
+ } 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 ||
@@ -279,6 +292,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",
@@ -290,10 +306,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)
@@ -443,6 +462,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: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/dhcpv6/devel/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- .cvsignore 9 Sep 2004 04:11:12 -0000 1.2
+++ .cvsignore 8 Nov 2007 22:36:48 -0000 1.3
@@ -1 +1 @@
-dhcp-0.10.tgz
+dhcpv6-0.99.0.tar.gz
Index: dhcpv6.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dhcpv6/devel/dhcpv6.spec,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- dhcpv6.spec 25 Oct 2007 20:47:23 -0000 1.68
+++ dhcpv6.spec 8 Nov 2007 22:36:48 -0000 1.69
@@ -3,12 +3,12 @@
Summary: DHCPv6 - DHCP server and client for IPv6
Name: dhcpv6
-Version: 0.10
-Release: 52%{?dist}
+Version: 0.99.0
+Release: 1%{?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
+Source0: http://osdn.dl.sourceforge.net/sourceforge/%{name}/%{name}-%{version}.tar.gz
Source1: libdhcp6client.pc
Source2: rfc3315.txt
Source3: Makefile.libdhcp6client
@@ -16,22 +16,7 @@
Source5: dhc6_alloc.h
Source6: dhcp6client.h
-Patch0: %{name}-0.10-redhat.patch
-Patch1: %{name}-0.10-relay.patch
-Patch2: %{name}-0.10-man.patch
-Patch3: %{name}-0.10-gethwid.patch
-Patch4: %{name}-0.10-no-strlcat.patch
-Patch5: %{name}-0.10-salen.patch
-Patch6: %{name}-0.10-initscripts.patch
-Patch7: %{name}-0.10-file-checks.patch
-Patch8: %{name}-0.10-device-names.patch
-Patch9: %{name}-0.10-lsb.patch
-Patch10: %{name}-0.10-IA_NA-ignore.patch
-Patch11: %{name}-0.10-remove-leases.patch
-Patch12: %{name}-0.10-retransmit-confirm.patch
-Patch13: %{name}-0.10-elapsed-time.patch
-Patch14: %{name}-0.10-reassign-global.patch
-Patch15: %{name}-0.10-libdhcp6client.patch
+Patch0: %{name}-0.99.0-libdhcp6client.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: flex
@@ -92,23 +77,8 @@
libdhcp6client.
%prep
-%setup -q -n dhcp-%{version}
-%patch0 -p1 -b .rh
-%patch1 -p1 -b .relay
-%patch2 -p1 -b .man
-%patch3 -p1 -b .gethwid
-%patch4 -p1 -b .no_strlcat
-%patch5 -p1 -b .salen
-%patch6 -p1 -b .initscripts
-%patch7 -p1 -b .file-checks
-%patch8 -p1 -b .device-names
-%patch9 -p1 -b .lsb
-%patch10 -p1 -b .ia_na_ignore
-%patch11 -p1 -b .remove_leases
-%patch12 -p1 -b .retransmit
-%patch13 -p1 -b .elapsed
-%patch14 -p1 -b .reassign
-%patch15 -p1 -b .libdhcp6client
+%setup -q
+%patch0 -p1 -b .libdhcp6client
# copy in libdhcp6client-specific sources
%{__mkdir} -p libdhcp6client
@@ -117,12 +87,6 @@
%{__cp} -fp %{SOURCE2} docs
-# these things are part of glibc
-%{__rm} -f ifaddrs.c ifaddrs.h queue.h
-
-# we don't need these things
-%{__rm} -f strlcat.c
-
autoconf
%build
@@ -206,6 +170,9 @@
%{_libdir}/libdhcp6client.a
%changelog
+* Thu Nov 08 2007 David Cantrell <dcantrell at redhat.com> - 0.99.0-1
+- Upgraded to new upstream version, dhcpv6-0.99.0
+
* 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
Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/dhcpv6/devel/sources,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sources 9 Sep 2004 04:11:12 -0000 1.2
+++ sources 8 Nov 2007 22:36:48 -0000 1.3
@@ -1 +1 @@
-72b802d6c89e15e5cf6b0aecf46613f2 dhcp-0.10.tgz
+0181c7ef518570e7d33c493ff118ceed dhcpv6-0.99.0.tar.gz
--- dhcpv6-0.10-IA_NA-ignore.patch DELETED ---
--- dhcpv6-0.10-device-names.patch DELETED ---
--- dhcpv6-0.10-elapsed-time.patch DELETED ---
--- dhcpv6-0.10-file-checks.patch DELETED ---
--- dhcpv6-0.10-gethwid.patch DELETED ---
--- dhcpv6-0.10-initscripts.patch DELETED ---
--- dhcpv6-0.10-libdhcp6client.patch DELETED ---
--- dhcpv6-0.10-lsb.patch DELETED ---
--- dhcpv6-0.10-man.patch DELETED ---
--- dhcpv6-0.10-no-strlcat.patch DELETED ---
--- dhcpv6-0.10-reassign-global.patch DELETED ---
--- dhcpv6-0.10-redhat.patch DELETED ---
--- dhcpv6-0.10-relay.patch DELETED ---
--- dhcpv6-0.10-remove-leases.patch DELETED ---
--- dhcpv6-0.10-retransmit-confirm.patch DELETED ---
--- dhcpv6-0.10-salen.patch DELETED ---
- Previous message (by thread): rpms/selinux-policy/F-8 modules-targeted.conf, 1.70, 1.71 policy-20070703.patch, 1.126, 1.127 selinux-policy.spec, 1.571, 1.572
- Next message (by thread): rpms/gdb/F-8 gdb-6.7-ppc-clobbered-registers-O2-fix.patch, NONE, 1.1 gdb-6.7-ppc-clobbered-registers-O2-test.patch, NONE, 1.1 gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch, 1.2, 1.3 gdb.spec, 1.252, 1.253
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list