rpms/dhcp/devel dhcp-4.0.0-dhclient-decline-backoff.patch, NONE, 1.1 dhcp-4.0.0-enable-timeout-functions.patch, NONE, 1.1 dhcp-4.0.0-errwarn-message.patch, NONE, 1.1 dhcp-4.0.0-failover-ports.patch, NONE, 1.1 dhcp-4.0.0-inherit-leases.patch, NONE, 1.1 dhcp-4.0.0-memory.patch, NONE, 1.1 dhcp-4.0.0-release-by-ifup.patch, NONE, 1.1 dhcp-4.0.0-unicast-bootp.patch, NONE, 1.1 dhcp-4.0.0-fast-timeout.patch, 1.3, 1.4 dhcp-4.0.0-libdhcp4client.patch, 1.6, 1.7 dhcp-4.0.0-selinux.patch, 1.1, 1.2 dhcp.spec, 1.211, 1.212 linux, 1.14, 1.15 dhcp-3.0.5-dhclient-decline-backoff.patch, 1.3, NONE dhcp-3.0.5-enable-timeout-functions.patch, 1.3, NONE dhcp-3.0.5-errwarn-message.patch, 1.3, NONE dhcp-3.0.5-failover-ports.patch, 1.3, NONE dhcp-3.0.5-release-by-ifup.patch, 1.3, NONE dhcp-3.0.5-unicast-bootp.patch, 1.3, NONE dhcp-3.0.6-memory.patch, 1.3, NONE
David Cantrell (dcantrel)
fedora-extras-commits at redhat.com
Fri Aug 1 21:17:11 UTC 2008
Author: dcantrel
Update of /cvs/pkgs/rpms/dhcp/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv16025
Modified Files:
dhcp-4.0.0-fast-timeout.patch dhcp-4.0.0-libdhcp4client.patch
dhcp-4.0.0-selinux.patch dhcp.spec linux
Added Files:
dhcp-4.0.0-dhclient-decline-backoff.patch
dhcp-4.0.0-enable-timeout-functions.patch
dhcp-4.0.0-errwarn-message.patch
dhcp-4.0.0-failover-ports.patch
dhcp-4.0.0-inherit-leases.patch dhcp-4.0.0-memory.patch
dhcp-4.0.0-release-by-ifup.patch
dhcp-4.0.0-unicast-bootp.patch
Removed Files:
dhcp-3.0.5-dhclient-decline-backoff.patch
dhcp-3.0.5-enable-timeout-functions.patch
dhcp-3.0.5-errwarn-message.patch
dhcp-3.0.5-failover-ports.patch
dhcp-3.0.5-release-by-ifup.patch
dhcp-3.0.5-unicast-bootp.patch dhcp-3.0.6-memory.patch
Log Message:
* Fri Aug 01 2008 David Cantrell <dcantrell at redhat.com> - 12:4.0.0-17
- Carry over RES_OPTIONS from ifcfg-ethX files to /etc/resolv.conf (#202923)
- Clean up Requires tags for devel packages
- Allow SEARCH variable in ifcfg files to override search path (#454152)
- Do not down interface if there is an active lease (#453982)
- Clean up how dhclient-script restarts ypbind
dhcp-4.0.0-dhclient-decline-backoff.patch:
--- NEW FILE dhcp-4.0.0-dhclient-decline-backoff.patch ---
diff -up dhcp-4.0.0//client/dhclient.c.backoff dhcp-4.0.0//client/dhclient.c
--- dhcp-4.0.0//client/dhclient.c.backoff 2008-08-01 10:09:17.000000000 -1000
+++ dhcp-4.0.0//client/dhclient.c 2008-08-01 10:10:10.000000000 -1000
@@ -1003,6 +1003,7 @@ void state_init (cpp)
void *cpp;
{
struct client_state *client = cpp;
+ enum dhcp_state init_state = client->state;
ASSERT_STATE(state, S_INIT);
@@ -1015,9 +1016,16 @@ void state_init (cpp)
client -> first_sending = cur_time;
client -> interval = client -> config -> initial_interval;
- /* Add an immediate timeout to cause the first DHCPDISCOVER packet
- to go out. */
- send_discover (client);
+ if (init_state != S_DECLINED) {
+ /* Add an immediate timeout to cause the first DHCPDISCOVER packet
+ to go out. */
+ send_discover(client);
+ } else {
+ /* We've received an OFFER and it has been DECLINEd by dhclient-script.
+ * wait for a random time between 1 and backoff_cutoff seconds before
+ * trying again. */
+ add_timeout(cur_time + ((1 + (random() >> 2)) % client->config->backoff_cutoff), send_discover, client, 0, 0);
+ }
}
/* state_selecting is called when one or more DHCPOFFER packets have been
@@ -1284,6 +1292,7 @@ void bind_lease (client)
send_decline (client);
destroy_client_lease (client -> new);
client -> new = (struct client_lease *)0;
+ client -> state = S_DECLINED;
state_init (client);
return;
}
@@ -3439,6 +3448,7 @@ void client_location_changed ()
case S_INIT:
case S_REBINDING:
case S_STOPPED:
+ case S_DECLINED:
break;
}
client -> state = S_INIT;
diff -up dhcp-4.0.0//includes/dhcpd.h.backoff dhcp-4.0.0//includes/dhcpd.h
--- dhcp-4.0.0//includes/dhcpd.h.backoff 2008-08-01 10:09:01.000000000 -1000
+++ dhcp-4.0.0//includes/dhcpd.h 2008-08-01 10:10:10.000000000 -1000
@@ -992,7 +992,8 @@ enum dhcp_state {
S_BOUND = 5,
S_RENEWING = 6,
S_REBINDING = 7,
- S_STOPPED = 8
+ S_STOPPED = 8,
+ S_DECLINED = 9
};
/* Authentication and BOOTP policy possibilities (not all values work
dhcp-4.0.0-enable-timeout-functions.patch:
--- NEW FILE dhcp-4.0.0-enable-timeout-functions.patch ---
diff -up dhcp-4.0.0//common/dispatch.c.timeout dhcp-4.0.0//common/dispatch.c
--- dhcp-4.0.0//common/dispatch.c.timeout 2007-09-05 07:32:10.000000000 -1000
+++ dhcp-4.0.0//common/dispatch.c 2008-08-01 10:11:35.000000000 -1000
@@ -190,7 +190,6 @@ void cancel_timeout (where, what)
}
}
-#if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
void cancel_all_timeouts ()
{
struct timeout *t, *n;
@@ -211,4 +210,3 @@ void relinquish_timeouts ()
dfree (t, MDL);
}
}
-#endif
dhcp-4.0.0-errwarn-message.patch:
--- NEW FILE dhcp-4.0.0-errwarn-message.patch ---
diff -up dhcp-4.0.0//omapip/errwarn.c.errwarn dhcp-4.0.0//omapip/errwarn.c
--- dhcp-4.0.0//omapip/errwarn.c.errwarn 2007-07-12 20:43:42.000000000 -1000
+++ dhcp-4.0.0//omapip/errwarn.c 2008-08-01 10:06:05.000000000 -1000
@@ -76,20 +76,13 @@ void log_fatal (const char * fmt, ... )
#if !defined (NOMINUM)
log_error ("%s", "");
- log_error ("If you did not get this software from ftp.isc.org, please");
- log_error ("get the latest from ftp.isc.org and install that before");
- log_error ("requesting help.");
+ log_error ("This version of ISC DHCP is based on the release available");
+ log_error ("on ftp.isc.org. Features have been added and other changes");
+ log_error ("have been made to the base software release in order to make");
+ log_error ("it work better with this distribution.");
log_error ("%s", "");
- log_error ("If you did get this software from ftp.isc.org and have not");
- log_error ("yet read the README, please read it before requesting help.");
- log_error ("If you intend to request help from the dhcp-server at isc.org");
- log_error ("mailing list, please read the section on the README about");
- log_error ("submitting bug reports and requests for help.");
- log_error ("%s", "");
- log_error ("Please do not under any circumstances send requests for");
- log_error ("help directly to the authors of this software - please");
- log_error ("send them to the appropriate mailing list as described in");
- log_error ("the README file.");
+ log_error ("Please report for this software via the Red Hat Bugzilla site:");
+ log_error (" http://bugzilla.redhat.com");
log_error ("%s", "");
log_error ("exiting.");
#endif
dhcp-4.0.0-failover-ports.patch:
--- NEW FILE dhcp-4.0.0-failover-ports.patch ---
diff -up dhcp-4.0.0//server/confpars.c.failover dhcp-4.0.0//server/confpars.c
--- dhcp-4.0.0//server/confpars.c.failover 2008-08-01 10:07:46.000000000 -1000
+++ dhcp-4.0.0//server/confpars.c 2008-08-01 10:14:03.000000000 -1000
@@ -1065,10 +1065,17 @@ void parse_failover_peer (cfile, group,
parse_warn (cfile, "peer address may not be omitted");
/* XXX - when/if we get a port number assigned, just set as default */
+ /* See Red Hat Bugzilla 167292:
+ * we do now: dhcp-failover 647/tcp
+ * dhcp-failover 647/udp
+ * dhcp-failover 847/tcp
+ * dhcp-failover 847/udp
+ * IANA registration by Bernard Volz <volz at cisco.com>
+ */
if (!peer -> me.port)
- parse_warn (cfile, "local port may not be omitted");
+ peer -> me.port = 647;
if (!peer -> partner.port)
- parse_warn (cfile, "peer port may not be omitted");
+ peer -> partner.port = 847;
if (peer -> i_am == primary) {
if (!peer -> hba) {
dhcp-4.0.0-inherit-leases.patch:
--- NEW FILE dhcp-4.0.0-inherit-leases.patch ---
diff -up dhcp-4.0.0//client/dhclient.c.inherit dhcp-4.0.0//client/dhclient.c
--- dhcp-4.0.0//client/dhclient.c.inherit 2008-08-01 09:49:36.000000000 -1000
+++ dhcp-4.0.0//client/dhclient.c 2008-08-01 09:53:28.000000000 -1000
@@ -2393,6 +2393,15 @@ void send_request (cpp)
/* Now do a preinit on the interface so that we can
discover a new address. */
script_init (client, "PREINIT", (struct string_list *)0);
+ /* Has an active lease */
+ if (client -> active &&
+ client -> active -> is_bootp &&
+ client -> active -> expiry > cur_time &&
+ primary_address.s_addr != 0 &&
+ client -> active -> address.len == 4 &&
+ memcpy (client -> active -> address.iabuf, &primary_address, 4) == 0)
+ client_envadd (client, "", "keep_old_ip", "%s", "yes");
+
if (client -> alias)
script_write_params (client, "alias_",
client -> alias);
dhcp-4.0.0-memory.patch:
--- NEW FILE dhcp-4.0.0-memory.patch ---
diff -up dhcp-4.0.0//common/lpf.c.memory dhcp-4.0.0//common/lpf.c
--- dhcp-4.0.0//common/lpf.c.memory 2007-07-12 20:43:41.000000000 -1000
+++ dhcp-4.0.0//common/lpf.c 2008-08-01 10:08:01.000000000 -1000
@@ -245,6 +245,7 @@ static void lpf_tr_filter_setup (info)
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 */
diff -up dhcp-4.0.0//common/packet.c.memory dhcp-4.0.0//common/packet.c
--- dhcp-4.0.0//common/packet.c.memory 2007-11-30 11:51:43.000000000 -1000
+++ dhcp-4.0.0//common/packet.c 2008-08-01 10:08:01.000000000 -1000
@@ -135,6 +135,7 @@ void assemble_udp_ip_header (interface,
struct ip ip;
struct udphdr udp;
+ memset( &ip, '\0', sizeof ip);
/* Fill out the IP header */
IP_V_SET (&ip, 4);
IP_HL_SET (&ip, 20);
diff -up dhcp-4.0.0//minires/ns_name.c.memory dhcp-4.0.0//minires/ns_name.c
--- dhcp-4.0.0//minires/ns_name.c.memory 2005-03-17 10:15:17.000000000 -1000
+++ dhcp-4.0.0//minires/ns_name.c 2008-08-01 10:08:01.000000000 -1000
@@ -71,6 +71,11 @@ ns_name_ntop(const u_char *src, char *ds
dn = dst;
eom = dst + dstsiz;
+ if (dn >= eom) {
+ errno = EMSGSIZE;
+ return (-1);
+ }
+
while ((n = *cp++) != 0) {
if ((n & NS_CMPRSFLGS) != 0) {
/* Some kind of compression pointer. */
dhcp-4.0.0-release-by-ifup.patch:
--- NEW FILE dhcp-4.0.0-release-by-ifup.patch ---
diff -up dhcp-4.0.0//client/dhclient.c.release dhcp-4.0.0//client/dhclient.c
--- dhcp-4.0.0//client/dhclient.c.release 2008-08-01 10:09:01.000000000 -1000
+++ dhcp-4.0.0//client/dhclient.c 2008-08-01 10:09:17.000000000 -1000
@@ -412,9 +412,81 @@ main(int argc, char **argv) {
kill(oldpid, SIGTERM);
}
fclose(pidfd);
+ } else {
+ /* handle release for interfaces requested with Red Hat
+ * /sbin/ifup - pidfile will be /var/run/dhclient-$interface.pid
+ */
+
+ if ((path_dhclient_pid == NULL) || (*path_dhclient_pid == '\0'))
+ path_dhclient_pid = "/var/run/dhclient.pid";
+
+ char *new_path_dhclient_pid;
+ struct interface_info *ip;
+ int pdp_len = strlen(path_dhclient_pid), pfx, dpfx;
+
+ /* find append point: beginning of any trailing '.pid'
+ * or '-$IF.pid' */
+ for (pfx=pdp_len; (pfx >= 0) && (path_dhclient_pid[pfx] != '.') && (path_dhclient_pid[pfx] != '/'); pfx--);
+ if (pfx == -1)
+ pfx = pdp_len;
+
+ if (path_dhclient_pid[pfx] == '/')
+ pfx += 1;
+
+ for (dpfx=pfx; (dpfx >= 0) && (path_dhclient_pid[dpfx] != '-') && (path_dhclient_pid[dpfx] != '/'); dpfx--);
+ if ((dpfx > -1) && (path_dhclient_pid[dpfx] != '/'))
+ pfx = dpfx;
+
+ for (ip = interfaces; ip; ip = ip->next) {
+ if (interfaces_requested && (ip->flags & (INTERFACE_REQUESTED)) && (ip->name != NULL)) {
+ int n_len = strlen(ip->name);
+
+ new_path_dhclient_pid = (char*) malloc(pfx + n_len + 6);
+ strncpy(new_path_dhclient_pid, path_dhclient_pid, pfx);
+ sprintf(new_path_dhclient_pid + pfx, "-%s.pid", ip->name);
+
+ if ((pidfd = fopen(new_path_dhclient_pid, "r")) != NULL) {
+ e = fscanf(pidfd, "%ld\n", &temp);
+ oldpid = (pid_t)temp;
+
+ if (e != 0 && e != EOF) {
+ if (oldpid) {
+ if (kill(oldpid, SIGTERM) == 0)
+ unlink(path_dhclient_pid);
+ }
+ }
+
+ fclose(pidfd);
+ }
+
+ free(new_path_dhclient_pid);
+ }
+ }
+ }
+ } else {
+ FILE *pidfp = NULL;
+ long temp = 0;
+ pid_t dhcpid = 0;
+ int dhc_running = 0;
+ char procfn[256] = "";
+
+ if ((pidfp = fopen(path_dhclient_pid, "r")) != NULL) {
+ if ((fscanf(pidfp, "%ld", &temp)==1) && ((dhcpid=(pid_t)temp) > 0)) {
+ snprintf(procfn,256,"/proc/%u",dhcpid);
+ dhc_running = (access(procfn, F_OK) == 0);
+ }
+
+ fclose(pidfp);
+ }
+
+ if (dhc_running) {
+ log_fatal("dhclient(%u) is already running - exiting. ", dhcpid);
+ return(1);
}
}
+ write_client_pid_file();
+
if (!quiet) {
log_info ("%s %s", message, PACKAGE_VERSION);
log_info (copyright);
dhcp-4.0.0-unicast-bootp.patch:
--- NEW FILE dhcp-4.0.0-unicast-bootp.patch ---
diff -up dhcp-4.0.0//server/bootp.c.unicast dhcp-4.0.0//server/bootp.c
--- dhcp-4.0.0//server/bootp.c.unicast 2007-10-26 12:46:50.000000000 -1000
+++ dhcp-4.0.0//server/bootp.c 2008-08-01 10:12:38.000000000 -1000
@@ -58,6 +58,7 @@ void bootp (packet)
char msgbuf [1024];
int ignorep;
int peer_has_leases = 0;
+ int norelay = 0;
if (packet -> raw -> op != BOOTREQUEST)
return;
@@ -73,7 +74,7 @@ void bootp (packet)
? inet_ntoa (packet -> raw -> giaddr)
: packet -> interface -> name);
- if (!locate_network (packet)) {
+ if ((norelay = locate_network (packet)) == 0) {
log_info ("%s: network unknown", msgbuf);
return;
}
@@ -384,6 +385,13 @@ void bootp (packet)
from, &to, &hto);
goto out;
}
+ } else if (norelay == 2) {
+ to.sin_addr = raw.ciaddr;
+ to.sin_port = remote_port;
+ if (fallback_interface) {
+ result = send_packet (fallback_interface, (struct packet *)0, &raw, outgoing.packet_length, from, &to, &hto);
+ goto out;
+ }
/* If it comes from a client that already knows its address
and is not requesting a broadcast response, and we can
diff -up dhcp-4.0.0//server/dhcp.c.unicast dhcp-4.0.0//server/dhcp.c
--- dhcp-4.0.0//server/dhcp.c.unicast 2007-11-02 12:09:02.000000000 -1000
+++ dhcp-4.0.0//server/dhcp.c 2008-08-01 10:12:38.000000000 -1000
@@ -3904,6 +3904,7 @@ int locate_network (packet)
struct data_string data;
struct subnet *subnet = (struct subnet *)0;
struct option_cache *oc;
+ int norelay = 0;
/* See if there's a Relay Agent Link Selection Option, or a
* Subnet Selection Option. The Link-Select and Subnet-Select
@@ -3919,12 +3920,24 @@ int locate_network (packet)
from the interface, if there is one. If not, fail. */
if (!oc && !packet -> raw -> giaddr.s_addr) {
if (packet -> interface -> shared_network) {
- shared_network_reference
- (&packet -> shared_network,
- packet -> interface -> shared_network, MDL);
- return 1;
+ struct in_addr any_addr;
+ any_addr.s_addr = INADDR_ANY;
+
+ if (!packet -> packet_type && memcmp(&packet -> raw -> ciaddr, &any_addr, 4)) {
+ struct iaddr cip;
+ memcpy(cip.iabuf, &packet -> raw -> ciaddr, 4);
+ cip.len = 4;
+ if (!find_grouped_subnet(&subnet, packet->interface->shared_network, cip, MDL))
+ norelay = 2;
+ }
+
+ if (!norelay) {
+ shared_network_reference(&packet -> shared_network, packet -> interface -> shared_network, MDL);
+ return 1;
+ }
+ } else {
+ return 0;
}
- return 0;
}
/* If there's an option indicating link connection, and it's valid,
@@ -3947,7 +3960,10 @@ int locate_network (packet)
data_string_forget (&data, MDL);
} else {
ia.len = 4;
- memcpy (ia.iabuf, &packet -> raw -> giaddr, 4);
+ if (norelay)
+ memcpy (ia.iabuf, &packet->raw->ciaddr, 4);
+ else
+ memcpy (ia.iabuf, &packet->raw->giaddr, 4);
}
/* If we know the subnet on which the IP address lives, use it. */
@@ -3955,7 +3971,10 @@ int locate_network (packet)
shared_network_reference (&packet -> shared_network,
subnet -> shared_network, MDL);
subnet_dereference (&subnet, MDL);
- return 1;
+ if (norelay)
+ return norelay;
+ else
+ return 1;
}
/* Otherwise, fail. */
dhcp-4.0.0-fast-timeout.patch:
Index: dhcp-4.0.0-fast-timeout.patch
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcp-4.0.0-fast-timeout.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dhcp-4.0.0-fast-timeout.patch 13 Jan 2008 21:02:47 -0000 1.3
+++ dhcp-4.0.0-fast-timeout.patch 1 Aug 2008 21:16:41 -0000 1.4
@@ -1,7 +1,7 @@
-diff -up dhcp-4.0.0/client/dhclient.c.fast dhcp-4.0.0/client/dhclient.c
---- dhcp-4.0.0/client/dhclient.c.fast 2007-12-29 06:07:14.000000000 -1000
-+++ dhcp-4.0.0/client/dhclient.c 2007-12-29 06:08:07.000000000 -1000
-@@ -3624,10 +3624,7 @@ isc_result_t dhclient_interface_startup_
+diff -up dhcp-4.0.0//client/dhclient.c.fast_timeout dhcp-4.0.0//client/dhclient.c
+--- dhcp-4.0.0//client/dhclient.c.fast_timeout 2008-08-01 10:10:10.000000000 -1000
++++ dhcp-4.0.0//client/dhclient.c 2008-08-01 10:13:37.000000000 -1000
+@@ -3613,10 +3613,7 @@ isc_result_t dhclient_interface_startup_
ip -> flags |= INTERFACE_RUNNING;
for (client = ip -> client; client; client = client -> next) {
client -> state = S_INIT;
dhcp-4.0.0-libdhcp4client.patch:
Index: dhcp-4.0.0-libdhcp4client.patch
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcp-4.0.0-libdhcp4client.patch,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- dhcp-4.0.0-libdhcp4client.patch 23 Jan 2008 04:10:09 -0000 1.6
+++ dhcp-4.0.0-libdhcp4client.patch 1 Aug 2008 21:16:41 -0000 1.7
@@ -1,373 +1,438 @@
-diff -up dhcp-4.0.0/configure.ac.libdhcp4client dhcp-4.0.0/configure.ac
---- dhcp-4.0.0/configure.ac.libdhcp4client 2007-12-14 08:24:56.000000000 -1000
-+++ dhcp-4.0.0/configure.ac 2008-01-22 17:04:28.000000000 -1000
-@@ -1,5 +1,32 @@
- AC_INIT([DHCP], [4.0.0], [dhcp-users at isc.org])
+diff -up dhcp-4.0.0//client/Makefile.am.libdhcp4client dhcp-4.0.0//client/Makefile.am
+--- dhcp-4.0.0//client/Makefile.am.libdhcp4client 2007-12-12 09:23:42.000000000 -1000
++++ dhcp-4.0.0//client/Makefile.am 2008-08-01 10:17:46.000000000 -1000
+@@ -1,10 +1,18 @@
+ dist_sysconf_DATA = dhclient.conf
+ sbin_PROGRAMS = dhclient
++lib_LTLIBRARIES = libdhcp4client.la
+ dhclient_SOURCES = clparse.c dhclient.c dhc6.c \
+ scripts/bsdos scripts/freebsd scripts/linux scripts/netbsd \
+ scripts/nextstep scripts/openbsd scripts/solaris
+ dhclient_LDADD = ../common/libdhcp.a ../minires/libres.a \
+ ../omapip/libomapi.a ../dst/libdst.a
++libdhcp4client_la_CFLAGS = -DLIBDHCP -DLOCALSTATEDIR='"@localstatedir@"'
++libdhcp4client_la_LDFLAGS = -version-info \
++ $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
++ -release $(LT_RELEASE)
++libdhcp4client_la_SOURCES = clparse.c dhclient.c dhc6.c
++libdhcp4client_la_LIBADD = ../common/libdhcpLIBDHCP.a ../minires/libres.a \
++ ../omapip/libomapiLIBDHCP.a ../dst/libdstLIBDHCP.a
+ man_MANS = dhclient.8 dhclient-script.8 dhclient.conf.5 dhclient.leases.5
+ EXTRA_DIST = $(man_MANS)
-+dnl Versioning
-+dnl (from glib's configure.in ...)
-+dnl Making releases:
-+dnl DHCP_MICRO_VERSION += 1;
-+dnl DHCP_INTERFACE_AGE += 1;
-+dnl DHCP_BINARY_AGE += 1;
-+dnl if any functions have been added, set DHCP_INTERFACE_AGE to 0.
-+dnl if backwards compatibility has been broken (e.g., functions removed,
-+dnl function signatures changed),
-+dnl set DHCP_BINARY_AGE and DHCP_INTERFACE_AGE to 0.
-+DHCP_MAJOR_VERSION=4
-+DHCP_MINOR_VERSION=0
-+DHCP_MICRO_VERSION=0
-+DHCP_INTERFACE_AGE=0
-+DHCP_BINARY_AGE=0
-+DHCP_VERSION_SUFFIX=
-+DHCP_VERSION=$DHCP_MAJOR_VERSION.$DHCP_MINOR_VERSION.$DHCP_MICRO_VERSION$DHCP_VERSION_SUFFIX
-+
-+LT_RELEASE=$DHCP_MAJOR_VERSION.$DHCP_MINOR_VERSION
-+LT_CURRENT=`expr $DHCP_MICRO_VERSION - $DHCP_INTERFACE_AGE`
-+LT_REVISION=$DHCP_INTERFACE_AGE
-+AC_SUBST(DHCP_VERSION)
-+AC_SUBST(LT_RELEASE)
-+AC_SUBST(LT_CURRENT)
-+AC_SUBST(LT_REVISION)
-+AC_SUBST(LT_AGE)
-+
- # we specify "foreign" to avoid having to have the GNU mandated files,
- # like AUTHORS, COPYING, and such
- AM_INIT_AUTOMAKE([foreign])
-@@ -20,7 +47,8 @@ if test "$GCC" = "yes"; then
- fi
- fi
+diff -up dhcp-4.0.0//client/dhclient.c.libdhcp4client dhcp-4.0.0//client/dhclient.c
+--- dhcp-4.0.0//client/dhclient.c.libdhcp4client 2008-08-01 10:17:46.000000000 -1000
++++ dhcp-4.0.0//client/dhclient.c 2008-08-01 10:17:46.000000000 -1000
+@@ -83,14 +83,50 @@ int nowait=0;
+ char *mockup_relay = NULL;
+ int bootp_broadcast_always = 0;
--AC_PROG_RANLIB
-+AC_PROG_LIBTOOL
++#ifdef LIBDHCP
++FILE *leaseFile = NULL;
++#endif
+
- AC_CONFIG_HEADERS([includes/config.h])
+ extern u_int32_t default_requested_options[];
- # we sometimes need to know byte order for building packets
-diff -up dhcp-4.0.0/omapip/Makefile.am.libdhcp4client dhcp-4.0.0/omapip/Makefile.am
---- dhcp-4.0.0/omapip/Makefile.am.libdhcp4client 2007-05-29 06:32:11.000000000 -1000
-+++ dhcp-4.0.0/omapip/Makefile.am 2008-01-22 17:04:28.000000000 -1000
-@@ -1,10 +1,18 @@
- lib_LIBRARIES = libomapi.a
-+noinst_LIBRARIES = libomapiLIBDHCP.a
- noinst_PROGRAMS = svtest
+ static void usage PROTO ((void));
- libomapi_a_SOURCES = protocol.c buffer.c alloc.c result.c connection.c \
- errwarn.c listener.c dispatch.c generic.c support.c \
- handle.c message.c convert.c hash.c auth.c inet_addr.c \
- array.c trace.c mrtrace.c toisc.c iscprint.c
+ static isc_result_t write_duid(struct data_string *duid);
+
+-int
+-main(int argc, char **argv) {
++#ifdef LIBDHCP
++#include "isc-dhcp/libdhcp_control.h"
++LIBDHCP_Control *libdhcp_control;
++static void libdhcp_dispatch(void)
++{
++ struct timeval tv = { 0, 0 }, *tvp;
++ isc_result_t status;
+
-+libomapiLIBDHCP_a_CFLAGS = -DLIBDHCP
-+libomapiLIBDHCP_a_SOURCES = alloc.c array.c auth.c buffer.c connection.c \
-+ convert.c dispatch.c errwarn.c handle.c hash.c listener.c \
-+ mrtrace.c result.c support.c toisc.c trace.c generic.c message.c \
-+ protocol.c
++ /* Wait for a packet, or a timeout, or libdhcp being finished */
++ do {
++ tvp = process_outstanding_timeouts(&tv);
++ status = omapi_one_dispatch(0, tvp);
+
- man_MANS = omapi.3
- EXTRA_DIST = $(man_MANS)
-
-diff -up dhcp-4.0.0/omapip/dispatch.c.libdhcp4client dhcp-4.0.0/omapip/dispatch.c
---- dhcp-4.0.0/omapip/dispatch.c.libdhcp4client 2007-11-30 11:51:43.000000000 -1000
-+++ dhcp-4.0.0/omapip/dispatch.c 2008-01-22 17:04:28.000000000 -1000
-@@ -37,7 +37,7 @@
- #include <omapip/omapip_p.h>
- #include <sys/time.h>
-
--static omapi_io_object_t omapi_io_states;
-+omapi_io_object_t omapi_io_states;
- time_t cur_time;
-
- OMAPI_OBJECT_ALLOC (omapi_io,
-diff -up dhcp-4.0.0/omapip/errwarn.c.libdhcp4client dhcp-4.0.0/omapip/errwarn.c
---- dhcp-4.0.0/omapip/errwarn.c.libdhcp4client 2008-01-22 17:04:28.000000000 -1000
-+++ dhcp-4.0.0/omapip/errwarn.c 2008-01-22 17:04:28.000000000 -1000
-@@ -37,6 +37,11 @@
- #include <errno.h>
- #include <syslog.h>
-
++ if (libdhcp_control && ((status == ISC_R_TIMEDOUT) || (libdhcp_control->timeout && (time(NULL) >= (libdhcp_control->timeout + libdhcp_control->now))))) {
++ if (libdhcp_control->callback)
++ libdhcp_control->callback(libdhcp_control, DHC_TIMEDOUT, NULL);
++
++ break;
++ }
++ } while ((status != ISC_R_TIMEDOUT) && ((!libdhcp_control) || (!(libdhcp_control->finished))));
++}
++
++extern void omapi_free_all_pointers(void);
++
++__attribute__ ((visibility ("default")))
++int dhcpv4_client (LIBDHCP_Control *libdhcp_ctl, int argc, char **argv,
++ char **envp)
++#else
++int main(int argc, char **argv, char **envp)
++#endif
++{
+#ifdef LIBDHCP
-+#include <isc-dhcp/libdhcp_control.h>
-+extern LIBDHCP_Control *libdhcp_control;
++ libdhcp_control = libdhcp_ctl;
+#endif
-+
- #ifdef DEBUG
- int log_perror = -1;
- #else
-@@ -46,7 +51,9 @@ int log_priority;
- void (*log_cleanup) (void);
+ int fd;
+ int i;
+ struct interface_info *ip;
+@@ -122,6 +158,7 @@ main(int argc, char **argv) {
+ /* Initialize client globals. */
+ memset(&default_duid, 0, sizeof(default_duid));
- #define CVT_BUF_MAX 1023
+#ifndef LIBDHCP
- static char mbuf [CVT_BUF_MAX + 1];
+ /* Make sure that file descriptors 0 (stdin), 1, (stdout), and
+ 2 (stderr) are open. To do this, we assume that when we
+ open a file the lowest available file descriptor is used. */
+@@ -140,6 +177,7 @@ main(int argc, char **argv) {
+ #if !(defined (DEBUG) || defined (__CYGWIN32__))
+ setlogmask (LOG_UPTO (LOG_INFO));
+ #endif
+#endif
- static char fbuf [CVT_BUF_MAX + 1];
- /* Log an error message, then exit... */
-@@ -56,6 +63,16 @@ void log_fatal (const char * fmt, ... )
- va_list list;
+ /* Set up the OMAPI. */
+ status = omapi_init ();
+@@ -485,8 +523,12 @@ main(int argc, char **argv) {
+ }
+ }
- do_percentm (fbuf, fmt);
-+
+#ifdef LIBDHCP
-+ if (libdhcp_control && (libdhcp_control->eh)) {
-+ va_start (list, fmt);
-+ libdhcp_control->eh(libdhcp_control, LOG_FATAL, fbuf, list);
-+ va_end(list);
-+ libdhcp_control->finished = 1;
-+ return;
-+ }
-+#else
-
- /* %Audit% This is log output. %2004.06.17,Safe%
- * If we truncate we hope the user can get a hint from the log.
-@@ -89,6 +106,7 @@ void log_fatal (const char * fmt, ... )
- if (log_cleanup)
- (*log_cleanup) ();
- exit (1);
++ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_PID_FILE))
+#endif
- }
+ write_client_pid_file();
- /* Log an error message... */
-@@ -99,6 +117,13 @@ int log_error (const char * fmt, ...)
++#ifndef LIBDHCP
+ if (!quiet) {
+ log_info ("%s %s", message, PACKAGE_VERSION);
+ log_info (copyright);
+@@ -497,6 +539,7 @@ main(int argc, char **argv) {
+ log_perror = 0;
+ quiet_interface_discovery = 1;
+ }
++#endif
- do_percentm (fbuf, fmt);
+ /* If we're given a relay agent address to insert, for testing
+ purposes, figure out what it is. */
+@@ -702,11 +745,17 @@ main(int argc, char **argv) {
+ arg_conf_len = 0;
+ }
+#ifdef LIBDHCP
-+ if (libdhcp_control && libdhcp_control->eh) {
-+ va_start (list, fmt);
-+ libdhcp_control->eh(libdhcp_control, LOG_ERR, fbuf, list);
-+ va_end(list);
-+ }
-+#else
- /* %Audit% This is log output. %2004.06.17,Safe%
- * If we truncate we hope the user can get a hint from the log.
- */
-@@ -114,7 +139,7 @@ int log_error (const char * fmt, ...)
- write (STDERR_FILENO, mbuf, strlen (mbuf));
- write (STDERR_FILENO, "\n", 1);
- }
--
++ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE)) {
+#endif
- return 0;
- }
-
-@@ -126,6 +151,13 @@ int log_info (const char *fmt, ...)
-
- do_percentm (fbuf, fmt);
+ /* Parse the lease database. */
+ read_client_leases ();
+ /* Rewrite the lease database... */
+ rewrite_client_leases ();
+#ifdef LIBDHCP
-+ if (libdhcp_control && libdhcp_control->eh) {
-+ va_start (list, fmt);
-+ libdhcp_control->eh(libdhcp_control, LOG_INFO, fbuf, list);
-+ va_end(list);
-+ }
-+#else
- /* %Audit% This is log output. %2004.06.17,Safe%
- * If we truncate we hope the user can get a hint from the log.
- */
-@@ -141,7 +173,7 @@ int log_info (const char *fmt, ...)
- write (STDERR_FILENO, mbuf, strlen (mbuf));
- write (STDERR_FILENO, "\n", 1);
- }
--
++ }
+#endif
- return 0;
- }
-@@ -152,7 +184,13 @@ int log_debug (const char *fmt, ...)
- va_list list;
+ /* XXX */
+ /* config_counter(&snd_counter, &rcv_counter); */
+@@ -725,7 +774,7 @@ main(int argc, char **argv) {
+ if (!persist) {
+ /* Nothing more to do. */
+ log_info ("No broadcast interfaces found - exiting.");
+- exit (0);
++ return (0);
+ }
+ } else if (!release_mode && !exit_mode) {
+ /* Call the script with the list of interfaces. */
+@@ -863,6 +912,7 @@ main(int argc, char **argv) {
+ dmalloc_outstanding = 0;
+ #endif
- do_percentm (fbuf, fmt);
--
-+#ifdef LIBDHCP
-+ if (libdhcp_control && libdhcp_control->eh) {
-+ va_start (list, fmt);
-+ libdhcp_control->eh(libdhcp_control, LOG_DEBUG, fbuf, list);
-+ va_end(list);
-+ }
-+#else
- /* %Audit% This is log output. %2004.06.17,Safe%
- * If we truncate we hope the user can get a hint from the log.
- */
-@@ -168,7 +206,7 @@ int log_debug (const char *fmt, ...)
- write (STDERR_FILENO, mbuf, strlen (mbuf));
- write (STDERR_FILENO, "\n", 1);
- }
--
-+#endif
- return 0;
- }
-
-diff -up dhcp-4.0.0/omapip/alloc.c.libdhcp4client dhcp-4.0.0/omapip/alloc.c
---- dhcp-4.0.0/omapip/alloc.c.libdhcp4client 2007-07-12 20:43:42.000000000 -1000
-+++ dhcp-4.0.0/omapip/alloc.c 2008-01-22 17:04:28.000000000 -1000
-@@ -37,6 +37,33 @@
-
- #include <omapip/omapip_p.h>
++#ifndef LIBDHCP
+ /* If we're not supposed to wait before getting the address,
+ don't. */
+ if (nowait)
+@@ -875,6 +925,132 @@ main(int argc, char **argv) {
-+#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));
-+}
+ /* Start dispatching packets and timeouts... */
+ dispatch ();
++#else
++ if (libdhcp_control) {
++ if (libdhcp_control->timeout)
++ libdhcp_control->now = time(NULL);
++ else
++ libdhcp_control->now = 0;
++ }
+
-+static void record_pointer(void *ptr) {
-+ tsearch(ptr, &(all_pointers), ptr_comparator);
-+}
++ libdhcp_dispatch();
+
-+static void forget_pointer(void *ptr) {
-+ tdelete(ptr, &(all_pointers), ptr_comparator);
-+}
++ /* libdhcp is finished with us. */
+
-+void omapi_free_all_pointers(void) {
-+ if (all_pointers != NULL)
-+ tdestroy(all_pointers, free);
-+ all_pointers = NULL;
-+}
-+#endif
++ /* close all file descriptors: */
++ for (ip = interfaces; ip; ip = ip->next) {
++ shutdown(ip->wfdesc, SHUT_RDWR);
++ close(ip->wfdesc);
+
- #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
- defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
- struct dmalloc_preamble *dmalloc_list;
-@@ -72,7 +99,9 @@ dmalloc(unsigned size, const char *file,
- return NULL;
++ if (ip->rfdesc != ip->wfdesc)
++ close(ip->rfdesc);
++ }
++
++ if (fallback_interface != 0) {
++ ip = fallback_interface;
++ shutdown(ip->wfdesc, SHUT_RDWR);
++ close(ip->wfdesc);
++
++ if (ip->rfdesc != ip->wfdesc)
++ close(ip->rfdesc);
++ }
++
++ if (leaseFile)
++ fclose (leaseFile);
++
++ closelog();
++
++ char *current_pid_file = _PATH_DHCLIENT_PID;
++
++ /* Free ALL allocated memory: */
++ omapi_free_all_pointers();
++
++ /* Re-Initialize globals: */
++ client_env = 0;
++ client_env_count = 0;
++ default_lease_time = 43200;
++
++ dhcp_max_agent_option_packet_length = 0;
++ iaddr_any.len = 4;
++ memset(&(iaddr_any.iabuf[0]), '\0', 4);
++ iaddr_broadcast.len = 4;
++ memset(&(iaddr_broadcast.iabuf[0]), 0xff, 4);
++ interfaces_requested = 0;
++ leaseFile = 0;
++
++ libdhcp_control = 0;
++
++ local_port = 0;
++ no_daemon = 0;
++ nowait = 0;
++ onetry = 0;
++ quiet = 0;
++ max_lease_time = 86400;
++ path_dhclient_conf = _PATH_DHCLIENT_CONF;
++ path_dhclient_db = _PATH_DHCLIENT_DB;
++ path_dhclient_pid = _PATH_DHCLIENT_PID;
++ strcpy(&(path_dhclient_script_array[0]), _PATH_DHCLIENT_SCRIPT);
++ path_dhclient_script = path_dhclient_script_array;
++ remote_port = 0;
++ resolver_inited = 0;
++ log_perror = 1;
++ global_scope = NULL;
++ root_group = NULL;
++ group_name_hash = NULL;
++ interfaces = NULL;
++ dummy_interfaces = NULL;
++ fallback_interface = NULL;
++ extern int have_setup_fallback;
++ have_setup_fallback = 0;
++ quiet_interface_discovery = 1;
++#ifndef LIBDHCP
++ timeouts = NULL;
++#endif
++ dhcp_type_interface = NULL;
++ interface_vector = NULL;
++ interface_count = 0;
++ interface_max = 0;
++ name_servers = 0;
++ domains = 0;
++ dhcp_type_interface = NULL;
++ dhcp_type_group = NULL;
++ dhcp_type_shared_network = NULL;
++ dhcp_type_control = NULL;
++ memset(&dhcp_universe, '\0', sizeof(struct universe));
++ memset(&dhcpv6_universe, '\0', sizeof(struct universe));
++ memset(&nwip_universe, '\0', sizeof(struct universe));
++ memset(&fqdn_universe, '\0', sizeof(struct universe));
++ memset(&vendor_class_universe, '\0', sizeof(struct universe));
++ memset(&vendor_universe, '\0', sizeof(struct universe));
++ memset(&vsio_universe, '\0', sizeof(struct universe));
++ memset(&isc_universe, '\0', sizeof(struct universe));
++ memset(&isc6_universe, '\0', sizeof(struct universe));
++ universe_hash = 0;
++ universes = 0;
++ universe_count = 0;
++ universe_max = 0;
++ config_universe = 0;
++ extern struct hash_bucket *free_hash_buckets;
++ free_hash_buckets = NULL;
++ extern struct dhcp_packet *dhcp_free_list;
++ dhcp_free_list = NULL;
++ extern struct packet *packet_free_list;
++ packet_free_list = NULL;
++ extern struct binding_value *free_binding_values;
++ free_binding_values = NULL;
++ extern struct expression *free_expressions;
++ free_expressions = NULL;
++ extern struct option_cache *free_option_caches;
++ free_option_caches = NULL;
++ extern struct packet *free_packets;
++ free_packets = NULL;
++ extern pair free_pairs;
++ free_pairs = NULL;
++ extern omapi_io_object_t omapi_io_states;
++ memset(&omapi_io_states, '\0', sizeof(omapi_io_states));
++ dhcp_control_object = NULL;
++ unlink(current_pid_file);
++#endif
+
+ /*NOTREACHED*/
+ return 0;
+@@ -1270,7 +1446,20 @@ void dhcpack (packet)
+ if (client -> new -> rebind < cur_time)
+ client -> new -> rebind = TIME_MAX;
- foo = malloc(len);
--
+#ifdef LIBDHCP
-+ record_pointer(foo);
++ /* 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
- if (!foo)
- return NULL;
- bar = (void *)(foo + DMDOFFSET);
-@@ -191,6 +220,9 @@ dfree(void *ptr, const char *file, int l
- 0, (unsigned char *)ptr + DMDOFFSET, 0, 1, RC_MALLOC);
- #endif
- free (ptr);
++
+ bind_lease (client);
++
+#ifdef LIBDHCP
-+ forget_pointer(ptr);
++ client->packet.siaddr.s_addr = set_siaddr;
+#endif
}
- #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
-diff -up dhcp-4.0.0/dst/Makefile.am.libdhcp4client dhcp-4.0.0/dst/Makefile.am
---- dhcp-4.0.0/dst/Makefile.am.libdhcp4client 2008-01-22 17:04:28.000000000 -1000
-+++ dhcp-4.0.0/dst/Makefile.am 2008-01-22 17:04:28.000000000 -1000
-@@ -2,7 +2,7 @@ AM_CPPFLAGS = -DMINIRES_LIB -DHMAC_MD5
-
- lib_LIBRARIES = libdst.a
-
--noinst_LIBRARIES = libdstnomd5.a
-+noinst_LIBRARIES = libdstnomd5.a libdstLIBDHCP.a
+ void bind_lease (client)
+@@ -1306,6 +1495,9 @@ void bind_lease (client)
+ return;
+ }
- libdst_a_SOURCES = dst_support.c dst_api.c hmac_link.c md5_dgst.c \
- base64.c prandom.c
-@@ -10,4 +10,8 @@ libdst_a_SOURCES = dst_support.c dst_api
- libdstnomd5_a_SOURCES = dst_support.c dst_api.c hmac_link.c \
- base64.c prandom.c
++#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);
-+libdstLIBDHCP_a_CFLAGS = -DLIBDHCP
-+libdstLIBDHCP_a_SOURCES = dst_support.c dst_api.c hmac_link.c md5_dgst.c \
-+ base64.c prandom.c
-+
- EXTRA_DIST = dst_internal.h md5.h md5_locl.h
-diff -up dhcp-4.0.0/dst/hmac_link.c.libdhcp4client dhcp-4.0.0/dst/hmac_link.c
---- dhcp-4.0.0/dst/hmac_link.c.libdhcp4client 2007-12-05 14:50:22.000000000 -1000
-+++ dhcp-4.0.0/dst/hmac_link.c 2008-01-22 17:04:28.000000000 -1000
-@@ -39,6 +39,10 @@ static const char rcsid[] = "$Header: /p
+@@ -1398,10 +1590,12 @@ void state_stop (cpp)
+ }
+ }
- #include "dst_internal.h"
++#ifndef LIBDHCP
+ int commit_leases ()
+ {
+ return 0;
+ }
++#endif
+ int write_lease (lease)
+ struct lease *lease;
+@@ -2074,6 +2268,10 @@ void state_panic (cpp)
+ tell the shell script that we failed to allocate an address,
+ and try again later. */
+ if (onetry) {
+#ifdef LIBDHCP
-+extern void* dmalloc(size_t,char *,int);
++ script_init (client, "FAIL", (struct string_list *)0);
++ return;
+#endif
-+
- #ifdef USE_MD5
- # include "md5.h"
- # ifndef _MD5_H_
-@@ -87,7 +91,11 @@ dst_hmac_md5_sign(const int mode, DST_KE
- MD5_CTX *ctx = NULL;
+ if (!quiet)
+ log_info ("Unable to obtain a lease on first try.%s",
+ " Exiting.");
+@@ -2691,7 +2889,9 @@ void destroy_client_lease (lease)
+ free_client_lease (lease, MDL);
+ }
- if (mode & SIG_MODE_INIT)
-+#ifdef LIBDHCP
-+ ctx = (MD5_CTX *) dmalloc(sizeof(*ctx),__FILE__,__LINE__);
-+#else
- ctx = (MD5_CTX *) malloc(sizeof(*ctx));
++#ifndef LIBDHCP
+ FILE *leaseFile = NULL;
+#endif
- else if (context)
- ctx = (MD5_CTX *) *context;
- if (ctx == NULL)
-@@ -154,7 +162,11 @@ dst_hmac_md5_verify(const int mode, DST_
- MD5_CTX *ctx = NULL;
+ int leases_written = 0;
- if (mode & SIG_MODE_INIT)
+ void rewrite_client_leases ()
+@@ -3235,6 +3435,54 @@ void script_write_params (client, prefix
+ int script_go (client)
+ struct client_state *client;
+ {
+#ifdef LIBDHCP
-+ ctx = (MD5_CTX *) dmalloc(sizeof(*ctx),__FILE__,__LINE__);
++ struct string_list *sp;
++
++ if (libdhcp_control && libdhcp_control->callback) {
++ int dhcmsg;
++ char *reason="";
++
++ for (sp = client->env; sp; sp = sp->next)
++ if (strncmp(sp->string, "reason=", 7) == 0) {
++ reason = sp->string + 7;
++ break;
++ }
++
++ if (strcmp(reason,"NBI") == 0)
++ dhcmsg = DHC4_NBI;
++ else if (strcmp(reason,"PREINIT") == 0)
++ dhcmsg = DHC4_PREINIT;
++ else if (strcmp(reason,"BOUND") == 0)
++ dhcmsg = DHC4_BOUND;
++ else if (strcmp(reason,"RENEW") == 0)
++ dhcmsg = DHC4_RENEW;
++ else if (strcmp(reason,"REBOOT") == 0)
++ dhcmsg = DHC4_REBOOT;
++ else if (strcmp(reason,"REBIND") == 0)
++ dhcmsg = DHC4_REBIND;
++ else if (strcmp(reason,"STOP") == 0)
++ dhcmsg = DHC4_STOP;
++ else if (strcmp(reason,"MEDIUM") == 0)
++ dhcmsg = DHC4_MEDIUM;
++ else if (strcmp(reason,"TIMEOUT") == 0)
++ dhcmsg = DHC4_TIMEOUT;
++ else if (strcmp(reason,"FAIL") == 0)
++ dhcmsg = DHC4_FAIL;
++ else if (strcmp(reason,"EXPIRE") == 0)
++ dhcmsg = DHC4_EXPIRE;
++ else if (strcmp(reason,"RELEASE") == 0)
++ dhcmsg = DHC4_RELEASE;
++ else
++ dhcmsg = DHC4_NBI;
++
++ (*libdhcp_control->callback) (libdhcp_control, dhcmsg, client);
++
++ if (libdhcp_control->decline)
++ return 1;
++ }
++
++ return 0;
+#else
- ctx = (MD5_CTX *) malloc(sizeof(*ctx));
+ char *scriptName;
+ char *argv [2];
+ char **envp;
+@@ -3311,6 +3559,7 @@ int script_go (client)
+ time(&cur_time);
+ return (WIFEXITED (wstatus) ?
+ WEXITSTATUS (wstatus) : -WTERMSIG (wstatus));
+#endif
- else if (context)
- ctx = (MD5_CTX *) *context;
- if (ctx == NULL)
-@@ -218,8 +230,11 @@ dst_buffer_to_hmac_md5(DST_KEY *dkey, co
+ }
- if (dkey == NULL || key == NULL || keylen < 0)
- return (-1);
--
-+#ifdef LIBDHCP
-+ if ((hkey = (HMAC_Key *) dmalloc(sizeof(HMAC_Key),__FILE__,__LINE__)) == NULL)
-+#else
- if ((hkey = (HMAC_Key *) malloc(sizeof(HMAC_Key))) == NULL)
-+#endif
- return (-2);
+ void client_envadd (struct client_state *client,
+@@ -3393,6 +3642,9 @@ void go_daemon ()
- memset(hkey->hk_ipad, 0, sizeof(hkey->hk_ipad));
-@@ -348,7 +363,11 @@ dst_hmac_md5_key_from_file_format(DST_KE
- if (eol == NULL)
- return (-4);
- len = eol - p;
-+#ifdef LIBDHCP
-+ tmp = dmalloc(len + 2,__FILE__,__LINE__);
-+#else
- tmp = malloc(len + 2);
-+#endif
- memcpy(tmp, p, len);
- *(tmp + len) = 0x0;
- key_len = b64_pton((char *)tmp, key, HMAC_LEN+1); /* see above */
-@@ -440,8 +459,11 @@ dst_hmac_md5_generate_key(DST_KEY *key,
- return(0);
-
- len = size > 64 ? 64 : size;
+ /* Don't become a daemon if the user requested otherwise. */
+ if (no_daemon) {
+#ifdef LIBDHCP
-+ buff = dmalloc(len+8,__FILE__,__LINE__);
-+#else
- buff = malloc(len+8);
--
++ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_PID_FILE))
+#endif
- n = dst_random(DST_RAND_SEMI, len, buff);
- n += dst_random(DST_RAND_KEY, len, buff);
- if (n <= len) { /* failed getting anything */
-@@ -464,7 +486,11 @@ dst_hmac_md5_init()
- {
- if (dst_t_func[KEY_HMAC_MD5] != NULL)
- return (1);
+ write_client_pid_file ();
+ return;
+ }
+@@ -3402,6 +3654,10 @@ void go_daemon ()
+ return;
+ state = 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));
++ return;
+#endif
- if (dst_t_func[KEY_HMAC_MD5] == NULL)
- return (0);
- memset(dst_t_func[KEY_HMAC_MD5], 0, sizeof(struct dst_func));
-diff -up dhcp-4.0.0/common/Makefile.am.libdhcp4client dhcp-4.0.0/common/Makefile.am
---- dhcp-4.0.0/common/Makefile.am.libdhcp4client 2007-11-16 01:04:11.000000000 -1000
-+++ dhcp-4.0.0/common/Makefile.am 2008-01-22 17:04:28.000000000 -1000
++
+ /* Stop logging to stderr... */
+ log_perror = 0;
+
+diff -up dhcp-4.0.0//common/Makefile.am.libdhcp4client dhcp-4.0.0//common/Makefile.am
+--- dhcp-4.0.0//common/Makefile.am.libdhcp4client 2007-11-16 01:04:11.000000000 -1000
++++ dhcp-4.0.0//common/Makefile.am 2008-08-01 10:17:46.000000000 -1000
@@ -1,11 +1,17 @@
AM_CPPFLAGS = -I.. -DLOCALSTATEDIR='"@localstatedir@"'
@@ -387,9 +452,24 @@
man_MANS = dhcp-eval.5 dhcp-options.5
EXTRA_DIST = $(man_MANS)
-diff -up dhcp-4.0.0/common/discover.c.libdhcp4client dhcp-4.0.0/common/discover.c
---- dhcp-4.0.0/common/discover.c.libdhcp4client 2007-10-05 12:29:51.000000000 -1000
-+++ dhcp-4.0.0/common/discover.c 2008-01-22 17:04:28.000000000 -1000
+diff -up dhcp-4.0.0//common/alloc.c.libdhcp4client dhcp-4.0.0//common/alloc.c
+--- dhcp-4.0.0//common/alloc.c.libdhcp4client 2007-10-23 14:54:11.000000000 -1000
++++ dhcp-4.0.0//common/alloc.c 2008-08-01 10:17:46.000000000 -1000
+@@ -1004,7 +1004,11 @@ int executable_statement_reference (ptr,
+ return 1;
+ }
+
++#ifdef LIBDHCP
++struct packet *free_packets;
++#else
+ static struct packet *free_packets;
++#endif
+
+ #if defined (DEBUG_MEMORY_LEAKAGE) || \
+ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+diff -up dhcp-4.0.0//common/discover.c.libdhcp4client dhcp-4.0.0//common/discover.c
+--- dhcp-4.0.0//common/discover.c.libdhcp4client 2007-10-05 12:29:51.000000000 -1000
++++ dhcp-4.0.0//common/discover.c 2008-08-01 10:17:46.000000000 -1000
@@ -883,6 +883,10 @@ add_ipv6_addr_to_interface(struct interf
register that interface with the network I/O software, figure out what
subnet it's on, and add it to the list of interfaces. */
@@ -429,40 +509,9 @@
#if defined (F_SETFD)
if (fallback_interface) {
-diff -up dhcp-4.0.0/common/tree.c.libdhcp4client dhcp-4.0.0/common/tree.c
---- dhcp-4.0.0/common/tree.c.libdhcp4client 2007-08-22 03:41:37.000000000 -1000
-+++ dhcp-4.0.0/common/tree.c 2008-01-22 17:04:28.000000000 -1000
-@@ -41,7 +41,7 @@
- # include <regex.h>
- #endif
-
--struct binding_scope *global_scope;
-+struct binding_scope __attribute__ ((visibility ("default"))) *global_scope;
-
- static int do_host_lookup PROTO ((struct data_string *,
- struct dns_host_entry *));
-@@ -2859,6 +2859,7 @@ int evaluate_numeric_expression (result,
- result of that evaluation. There should never be both an expression
- and a valid data_string. */
-
-+__attribute__ ((visibility ("default")))
- int evaluate_option_cache (result, packet, lease, client_state,
- in_options, cfg_options, scope, oc, file, line)
- struct data_string *result;
-diff -up dhcp-4.0.0/common/options.c.libdhcp4client dhcp-4.0.0/common/options.c
---- dhcp-4.0.0/common/options.c.libdhcp4client 2007-11-30 11:51:43.000000000 -1000
-+++ dhcp-4.0.0/common/options.c 2008-01-22 17:04:28.000000000 -1000
-@@ -3392,6 +3392,7 @@ fqdn6_universe_decode(struct option_stat
- return 0;
- }
-
-+__attribute__ ((visibility ("default")))
- void option_space_foreach (struct packet *packet, struct lease *lease,
- struct client_state *client_state,
- struct option_state *in_options,
-diff -up dhcp-4.0.0/common/dispatch.c.libdhcp4client dhcp-4.0.0/common/dispatch.c
---- dhcp-4.0.0/common/dispatch.c.libdhcp4client 2008-01-22 17:04:28.000000000 -1000
-+++ dhcp-4.0.0/common/dispatch.c 2008-01-22 17:04:28.000000000 -1000
+diff -up dhcp-4.0.0//common/dispatch.c.libdhcp4client dhcp-4.0.0//common/dispatch.c
+--- dhcp-4.0.0//common/dispatch.c.libdhcp4client 2008-08-01 10:17:45.000000000 -1000
++++ dhcp-4.0.0//common/dispatch.c 2008-08-01 10:17:46.000000000 -1000
@@ -34,8 +34,24 @@
#include "dhcpd.h"
@@ -732,495 +781,446 @@
}
+#endif
}
-diff -up dhcp-4.0.0/common/alloc.c.libdhcp4client dhcp-4.0.0/common/alloc.c
---- dhcp-4.0.0/common/alloc.c.libdhcp4client 2007-10-23 14:54:11.000000000 -1000
-+++ dhcp-4.0.0/common/alloc.c 2008-01-22 17:04:28.000000000 -1000
-@@ -1004,7 +1004,11 @@ int executable_statement_reference (ptr,
- return 1;
+diff -up dhcp-4.0.0//common/options.c.libdhcp4client dhcp-4.0.0//common/options.c
+--- dhcp-4.0.0//common/options.c.libdhcp4client 2007-11-30 11:51:43.000000000 -1000
++++ dhcp-4.0.0//common/options.c 2008-08-01 10:17:46.000000000 -1000
+@@ -3392,6 +3392,7 @@ fqdn6_universe_decode(struct option_stat
+ return 0;
}
-+#ifdef LIBDHCP
-+struct packet *free_packets;
-+#else
- static struct packet *free_packets;
-+#endif
-
- #if defined (DEBUG_MEMORY_LEAKAGE) || \
- defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
-diff -up dhcp-4.0.0/includes/dhcpd.h.libdhcp4client dhcp-4.0.0/includes/dhcpd.h
---- dhcp-4.0.0/includes/dhcpd.h.libdhcp4client 2008-01-22 17:04:28.000000000 -1000
-+++ dhcp-4.0.0/includes/dhcpd.h 2008-01-22 17:05:02.000000000 -1000
-@@ -1199,14 +1199,6 @@ struct hardware_link {
++__attribute__ ((visibility ("default")))
+ void option_space_foreach (struct packet *packet, struct lease *lease,
+ struct client_state *client_state,
+ struct option_state *in_options,
+diff -up dhcp-4.0.0//common/tree.c.libdhcp4client dhcp-4.0.0//common/tree.c
+--- dhcp-4.0.0//common/tree.c.libdhcp4client 2007-08-22 03:41:37.000000000 -1000
++++ dhcp-4.0.0//common/tree.c 2008-08-01 10:17:46.000000000 -1000
+@@ -41,7 +41,7 @@
+ # include <regex.h>
+ #endif
- 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 binding_scope *global_scope;
++struct binding_scope __attribute__ ((visibility ("default"))) *global_scope;
- struct protocol {
- struct protocol *next;
-@@ -1664,7 +1656,6 @@ extern const char *path_dhcpd_pid;
+ static int do_host_lookup PROTO ((struct data_string *,
+ struct dns_host_entry *));
+@@ -2859,6 +2859,7 @@ int evaluate_numeric_expression (result,
+ result of that evaluation. There should never be both an expression
+ and a valid data_string. */
- extern int dhcp_max_agent_option_packet_length;
++__attribute__ ((visibility ("default")))
+ int evaluate_option_cache (result, packet, lease, client_state,
+ in_options, cfg_options, scope, oc, file, line)
+ struct data_string *result;
+diff -up dhcp-4.0.0//configure.ac.libdhcp4client dhcp-4.0.0//configure.ac
+--- dhcp-4.0.0//configure.ac.libdhcp4client 2007-12-14 08:24:56.000000000 -1000
++++ dhcp-4.0.0//configure.ac 2008-08-01 10:17:46.000000000 -1000
+@@ -1,5 +1,32 @@
+ AC_INIT([DHCP], [4.0.0], [dhcp-users at isc.org])
--int main(int, char **);
- void postconf_initialization(int);
- void postdb_startup(void);
- void cleanup PROTO ((void));
-@@ -2337,7 +2328,6 @@ extern void (*bootp_packet_handler) PROT
- extern void (*dhcpv6_packet_handler)(struct interface_info *,
- const char *, int,
- int, const struct iaddr *, isc_boolean_t);
--extern struct timeout *timeouts;
- extern omapi_object_type_t *dhcp_type_interface;
- #if defined (TRACING)
- extern trace_type_t *interface_trace;
-@@ -2392,6 +2382,10 @@ extern struct universe dhcpv6_universe;
- extern struct universe nwip_universe;
- extern struct universe fqdn_universe;
- extern struct universe vsio_universe;
-+extern struct universe vendor_class_universe;
-+extern struct universe vendor_universe;
-+extern struct universe isc_universe;
-+extern struct universe isc6_universe;
- extern int dhcp_option_default_priority_list [];
- extern int dhcp_option_default_priority_list_count;
- extern const char *hardware_types [256];
-diff -up dhcp-4.0.0/client/Makefile.am.libdhcp4client dhcp-4.0.0/client/Makefile.am
---- dhcp-4.0.0/client/Makefile.am.libdhcp4client 2007-12-12 09:23:42.000000000 -1000
-+++ dhcp-4.0.0/client/Makefile.am 2008-01-22 17:04:28.000000000 -1000
-@@ -1,10 +1,18 @@
- dist_sysconf_DATA = dhclient.conf
- sbin_PROGRAMS = dhclient
-+lib_LTLIBRARIES = libdhcp4client.la
- dhclient_SOURCES = clparse.c dhclient.c dhc6.c \
- scripts/bsdos scripts/freebsd scripts/linux scripts/netbsd \
- scripts/nextstep scripts/openbsd scripts/solaris
- dhclient_LDADD = ../common/libdhcp.a ../minires/libres.a \
- ../omapip/libomapi.a ../dst/libdst.a
-+libdhcp4client_la_CFLAGS = -DLIBDHCP -DLOCALSTATEDIR='"@localstatedir@"'
-+libdhcp4client_la_LDFLAGS = -version-info \
-+ $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-+ -release $(LT_RELEASE)
-+libdhcp4client_la_SOURCES = clparse.c dhclient.c dhc6.c
-+libdhcp4client_la_LIBADD = ../common/libdhcpLIBDHCP.a ../minires/libres.a \
-+ ../omapip/libomapiLIBDHCP.a ../dst/libdstLIBDHCP.a
- man_MANS = dhclient.8 dhclient-script.8 dhclient.conf.5 dhclient.leases.5
- EXTRA_DIST = $(man_MANS)
-
-diff -up dhcp-4.0.0/client/dhclient.c.libdhcp4client dhcp-4.0.0/client/dhclient.c
---- dhcp-4.0.0/client/dhclient.c.libdhcp4client 2008-01-22 17:04:28.000000000 -1000
-+++ dhcp-4.0.0/client/dhclient.c 2008-01-22 17:05:47.000000000 -1000
-@@ -83,14 +83,50 @@ int nowait=0;
- char *mockup_relay = NULL;
- int bootp_broadcast_always = 0;
++dnl Versioning
++dnl (from glib's configure.in ...)
++dnl Making releases:
++dnl DHCP_MICRO_VERSION += 1;
++dnl DHCP_INTERFACE_AGE += 1;
++dnl DHCP_BINARY_AGE += 1;
++dnl if any functions have been added, set DHCP_INTERFACE_AGE to 0.
++dnl if backwards compatibility has been broken (e.g., functions removed,
++dnl function signatures changed),
++dnl set DHCP_BINARY_AGE and DHCP_INTERFACE_AGE to 0.
++DHCP_MAJOR_VERSION=4
++DHCP_MINOR_VERSION=0
++DHCP_MICRO_VERSION=0
++DHCP_INTERFACE_AGE=0
++DHCP_BINARY_AGE=0
++DHCP_VERSION_SUFFIX=
++DHCP_VERSION=$DHCP_MAJOR_VERSION.$DHCP_MINOR_VERSION.$DHCP_MICRO_VERSION$DHCP_VERSION_SUFFIX
++
++LT_RELEASE=$DHCP_MAJOR_VERSION.$DHCP_MINOR_VERSION
++LT_CURRENT=`expr $DHCP_MICRO_VERSION - $DHCP_INTERFACE_AGE`
++LT_REVISION=$DHCP_INTERFACE_AGE
++AC_SUBST(DHCP_VERSION)
++AC_SUBST(LT_RELEASE)
++AC_SUBST(LT_CURRENT)
++AC_SUBST(LT_REVISION)
++AC_SUBST(LT_AGE)
++
+ # we specify "foreign" to avoid having to have the GNU mandated files,
+ # like AUTHORS, COPYING, and such
+ AM_INIT_AUTOMAKE([foreign])
+@@ -20,7 +47,8 @@ if test "$GCC" = "yes"; then
+ fi
+ fi
-+#ifdef LIBDHCP
-+FILE *leaseFile = NULL;
-+#endif
+-AC_PROG_RANLIB
++AC_PROG_LIBTOOL
+
- extern u_int32_t default_requested_options[];
+ AC_CONFIG_HEADERS([includes/config.h])
- static void usage PROTO ((void));
+ # we sometimes need to know byte order for building packets
+diff -up dhcp-4.0.0//dst/Makefile.am.libdhcp4client dhcp-4.0.0//dst/Makefile.am
+--- dhcp-4.0.0//dst/Makefile.am.libdhcp4client 2008-08-01 10:17:45.000000000 -1000
++++ dhcp-4.0.0//dst/Makefile.am 2008-08-01 10:17:46.000000000 -1000
+@@ -2,7 +2,7 @@ AM_CPPFLAGS = -DMINIRES_LIB -DHMAC_MD5
- static isc_result_t write_duid(struct data_string *duid);
+ lib_LIBRARIES = libdst.a
--int
--main(int argc, char **argv) {
-+#ifdef LIBDHCP
-+#include "isc-dhcp/libdhcp_control.h"
-+LIBDHCP_Control *libdhcp_control;
-+static void libdhcp_dispatch(void)
-+{
-+ struct timeval tv = { 0, 0 }, *tvp;
-+ isc_result_t status;
-+
-+ /* Wait for a packet, or a timeout, or libdhcp being finished */
-+ do {
-+ tvp = process_outstanding_timeouts(&tv);
-+ status = omapi_one_dispatch(0, tvp);
-+
-+ if (libdhcp_control && ((status == ISC_R_TIMEDOUT) || (libdhcp_control->timeout && (time(NULL) >= (libdhcp_control->timeout + libdhcp_control->now))))) {
-+ if (libdhcp_control->callback)
-+ libdhcp_control->callback(libdhcp_control, DHC_TIMEDOUT, NULL);
-+
-+ break;
-+ }
-+ } while ((status != ISC_R_TIMEDOUT) && ((!libdhcp_control) || (!(libdhcp_control->finished))));
-+}
-+
-+extern void omapi_free_all_pointers(void);
+-noinst_LIBRARIES = libdstnomd5.a
++noinst_LIBRARIES = libdstnomd5.a libdstLIBDHCP.a
+
+ libdst_a_SOURCES = dst_support.c dst_api.c hmac_link.c md5_dgst.c \
+ base64.c prandom.c
+@@ -10,4 +10,8 @@ libdst_a_SOURCES = dst_support.c dst_api
+ libdstnomd5_a_SOURCES = dst_support.c dst_api.c hmac_link.c \
+ base64.c prandom.c
+
++libdstLIBDHCP_a_CFLAGS = -DLIBDHCP
++libdstLIBDHCP_a_SOURCES = dst_support.c dst_api.c hmac_link.c md5_dgst.c \
++ base64.c prandom.c
+
-+__attribute__ ((visibility ("default")))
-+int dhcpv4_client (LIBDHCP_Control *libdhcp_ctl, int argc, char **argv,
-+ char **envp)
-+#else
-+int main(int argc, char **argv, char **envp)
-+#endif
-+{
+ EXTRA_DIST = dst_internal.h md5.h md5_locl.h
+diff -up dhcp-4.0.0//dst/hmac_link.c.libdhcp4client dhcp-4.0.0//dst/hmac_link.c
+--- dhcp-4.0.0//dst/hmac_link.c.libdhcp4client 2007-12-05 14:50:22.000000000 -1000
++++ dhcp-4.0.0//dst/hmac_link.c 2008-08-01 10:17:46.000000000 -1000
+@@ -39,6 +39,10 @@ static const char rcsid[] = "$Header: /p
+
+ #include "dst_internal.h"
+
+#ifdef LIBDHCP
-+ libdhcp_control = libdhcp_ctl;
++extern void* dmalloc(size_t,char *,int);
+#endif
- int fd;
- int i;
- struct interface_info *ip;
-@@ -122,6 +158,7 @@ main(int argc, char **argv) {
- /* Initialize client globals. */
- memset(&default_duid, 0, sizeof(default_duid));
++
+ #ifdef USE_MD5
+ # include "md5.h"
+ # ifndef _MD5_H_
+@@ -87,7 +91,11 @@ dst_hmac_md5_sign(const int mode, DST_KE
+ MD5_CTX *ctx = NULL;
-+#ifndef LIBDHCP
- /* Make sure that file descriptors 0 (stdin), 1, (stdout), and
- 2 (stderr) are open. To do this, we assume that when we
- open a file the lowest available file descriptor is used. */
-@@ -140,6 +177,7 @@ main(int argc, char **argv) {
- #if !(defined (DEBUG) || defined (__CYGWIN32__))
- setlogmask (LOG_UPTO (LOG_INFO));
- #endif
+ if (mode & SIG_MODE_INIT)
++#ifdef LIBDHCP
++ ctx = (MD5_CTX *) dmalloc(sizeof(*ctx),__FILE__,__LINE__);
++#else
+ ctx = (MD5_CTX *) malloc(sizeof(*ctx));
+#endif
+ else if (context)
+ ctx = (MD5_CTX *) *context;
+ if (ctx == NULL)
+@@ -154,7 +162,11 @@ dst_hmac_md5_verify(const int mode, DST_
+ MD5_CTX *ctx = NULL;
- /* Set up the OMAPI. */
- status = omapi_init ();
-@@ -485,8 +523,12 @@ main(int argc, char **argv) {
- }
- }
-
+ if (mode & SIG_MODE_INIT)
+#ifdef LIBDHCP
-+ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_PID_FILE))
++ ctx = (MD5_CTX *) dmalloc(sizeof(*ctx),__FILE__,__LINE__);
++#else
+ ctx = (MD5_CTX *) malloc(sizeof(*ctx));
+#endif
- write_client_pid_file();
+ else if (context)
+ ctx = (MD5_CTX *) *context;
+ if (ctx == NULL)
+@@ -218,8 +230,11 @@ dst_buffer_to_hmac_md5(DST_KEY *dkey, co
-+#ifndef LIBDHCP
- if (!quiet) {
- log_info ("%s %s", message, PACKAGE_VERSION);
- log_info (copyright);
-@@ -497,6 +539,7 @@ main(int argc, char **argv) {
- log_perror = 0;
- quiet_interface_discovery = 1;
- }
+ 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);
- /* If we're given a relay agent address to insert, for testing
- purposes, figure out what it is. */
-@@ -702,11 +745,17 @@ main(int argc, char **argv) {
- arg_conf_len = 0;
- }
-
+ memset(hkey->hk_ipad, 0, sizeof(hkey->hk_ipad));
+@@ -348,7 +363,11 @@ dst_hmac_md5_key_from_file_format(DST_KE
+ if (eol == NULL)
+ return (-4);
+ len = eol - p;
+#ifdef LIBDHCP
-+ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE)) {
++ tmp = dmalloc(len + 2,__FILE__,__LINE__);
++#else
+ tmp = malloc(len + 2);
+#endif
- /* Parse the lease database. */
- read_client_leases ();
-
- /* Rewrite the lease database... */
- rewrite_client_leases ();
+ memcpy(tmp, p, len);
+ *(tmp + len) = 0x0;
+ key_len = b64_pton((char *)tmp, key, HMAC_LEN+1); /* see above */
+@@ -440,8 +459,11 @@ dst_hmac_md5_generate_key(DST_KEY *key,
+ return(0);
+
+ len = size > 64 ? 64 : size;
+#ifdef LIBDHCP
-+ }
++ buff = dmalloc(len+8,__FILE__,__LINE__);
++#else
+ buff = malloc(len+8);
+-
++#endif
+ n = dst_random(DST_RAND_SEMI, len, buff);
+ n += dst_random(DST_RAND_KEY, len, buff);
+ if (n <= len) { /* failed getting anything */
+@@ -464,7 +486,11 @@ dst_hmac_md5_init()
+ {
+ if (dst_t_func[KEY_HMAC_MD5] != NULL)
+ return (1);
++#ifdef LIBDHCP
++ dst_t_func[KEY_HMAC_MD5] = dmalloc(sizeof(struct dst_func),__FILE__,__LINE__);
++#else
+ dst_t_func[KEY_HMAC_MD5] = malloc(sizeof(struct dst_func));
+#endif
+ if (dst_t_func[KEY_HMAC_MD5] == NULL)
+ return (0);
+ memset(dst_t_func[KEY_HMAC_MD5], 0, sizeof(struct dst_func));
+diff -up dhcp-4.0.0//includes/dhcpd.h.libdhcp4client dhcp-4.0.0//includes/dhcpd.h
+--- dhcp-4.0.0//includes/dhcpd.h.libdhcp4client 2008-08-01 10:17:46.000000000 -1000
++++ dhcp-4.0.0//includes/dhcpd.h 2008-08-01 10:17:46.000000000 -1000
+@@ -1199,14 +1199,6 @@ struct hardware_link {
- /* XXX */
- /* config_counter(&snd_counter, &rcv_counter); */
-@@ -725,7 +774,7 @@ main(int argc, char **argv) {
- if (!persist) {
- /* Nothing more to do. */
- log_info ("No broadcast interfaces found - exiting.");
-- exit (0);
-+ return (0);
- }
- } else if (!release_mode && !exit_mode) {
- /* Call the script with the list of interfaces. */
-@@ -863,6 +912,7 @@ main(int argc, char **argv) {
- dmalloc_outstanding = 0;
- #endif
+ 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;
+-};
-+#ifndef LIBDHCP
- /* If we're not supposed to wait before getting the address,
- don't. */
- if (nowait)
-@@ -875,6 +925,132 @@ main(int argc, char **argv) {
+ struct protocol {
+ struct protocol *next;
+@@ -1664,7 +1656,6 @@ extern const char *path_dhcpd_pid;
- /* Start dispatching packets and timeouts... */
- dispatch ();
-+#else
-+ if (libdhcp_control) {
-+ if (libdhcp_control->timeout)
-+ libdhcp_control->now = time(NULL);
-+ else
-+ libdhcp_control->now = 0;
-+ }
-+
-+ libdhcp_dispatch();
-+
-+ /* libdhcp is finished with us. */
-+
-+ /* close all file descriptors: */
-+ for (ip = interfaces; ip; ip = ip->next) {
-+ shutdown(ip->wfdesc, SHUT_RDWR);
-+ close(ip->wfdesc);
-+
-+ if (ip->rfdesc != ip->wfdesc)
-+ close(ip->rfdesc);
-+ }
-+
-+ if (fallback_interface != 0) {
-+ ip = fallback_interface;
-+ shutdown(ip->wfdesc, SHUT_RDWR);
-+ close(ip->wfdesc);
-+
-+ if (ip->rfdesc != ip->wfdesc)
-+ close(ip->rfdesc);
-+ }
-+
-+ if (leaseFile)
-+ fclose (leaseFile);
-+
-+ closelog();
-+
-+ char *current_pid_file = _PATH_DHCLIENT_PID;
-+
-+ /* Free ALL allocated memory: */
-+ omapi_free_all_pointers();
-+
-+ /* Re-Initialize globals: */
-+ client_env = 0;
-+ client_env_count = 0;
-+ default_lease_time = 43200;
-+
-+ dhcp_max_agent_option_packet_length = 0;
-+ iaddr_any.len = 4;
-+ memset(&(iaddr_any.iabuf[0]), '\0', 4);
-+ iaddr_broadcast.len = 4;
-+ memset(&(iaddr_broadcast.iabuf[0]), 0xff, 4);
-+ interfaces_requested = 0;
-+ leaseFile = 0;
+ extern int dhcp_max_agent_option_packet_length;
+
+-int main(int, char **);
+ void postconf_initialization(int);
+ void postdb_startup(void);
+ void cleanup PROTO ((void));
+@@ -2337,7 +2328,6 @@ extern void (*bootp_packet_handler) PROT
+ extern void (*dhcpv6_packet_handler)(struct interface_info *,
+ const char *, int,
+ int, const struct iaddr *, isc_boolean_t);
+-extern struct timeout *timeouts;
+ extern omapi_object_type_t *dhcp_type_interface;
+ #if defined (TRACING)
+ extern trace_type_t *interface_trace;
+@@ -2392,6 +2382,10 @@ extern struct universe dhcpv6_universe;
+ extern struct universe nwip_universe;
+ extern struct universe fqdn_universe;
+ extern struct universe vsio_universe;
++extern struct universe vendor_class_universe;
++extern struct universe vendor_universe;
++extern struct universe isc_universe;
++extern struct universe isc6_universe;
+ extern int dhcp_option_default_priority_list [];
+ extern int dhcp_option_default_priority_list_count;
+ extern const char *hardware_types [256];
+diff -up dhcp-4.0.0//omapip/Makefile.am.libdhcp4client dhcp-4.0.0//omapip/Makefile.am
+--- dhcp-4.0.0//omapip/Makefile.am.libdhcp4client 2007-05-29 06:32:11.000000000 -1000
++++ dhcp-4.0.0//omapip/Makefile.am 2008-08-01 10:17:46.000000000 -1000
+@@ -1,10 +1,18 @@
+ lib_LIBRARIES = libomapi.a
++noinst_LIBRARIES = libomapiLIBDHCP.a
+ noinst_PROGRAMS = svtest
+
+ libomapi_a_SOURCES = protocol.c buffer.c alloc.c result.c connection.c \
+ errwarn.c listener.c dispatch.c generic.c support.c \
+ handle.c message.c convert.c hash.c auth.c inet_addr.c \
+ array.c trace.c mrtrace.c toisc.c iscprint.c
+
-+ libdhcp_control = 0;
++libomapiLIBDHCP_a_CFLAGS = -DLIBDHCP
++libomapiLIBDHCP_a_SOURCES = alloc.c array.c auth.c buffer.c connection.c \
++ convert.c dispatch.c errwarn.c handle.c hash.c listener.c \
++ mrtrace.c result.c support.c toisc.c trace.c generic.c message.c \
++ protocol.c
+
-+ local_port = 0;
-+ no_daemon = 0;
-+ nowait = 0;
-+ onetry = 0;
-+ quiet = 0;
-+ max_lease_time = 86400;
-+ path_dhclient_conf = _PATH_DHCLIENT_CONF;
-+ path_dhclient_db = _PATH_DHCLIENT_DB;
-+ path_dhclient_pid = _PATH_DHCLIENT_PID;
-+ strcpy(&(path_dhclient_script_array[0]), _PATH_DHCLIENT_SCRIPT);
-+ path_dhclient_script = path_dhclient_script_array;
-+ remote_port = 0;
-+ resolver_inited = 0;
-+ log_perror = 1;
-+ global_scope = NULL;
-+ root_group = NULL;
-+ group_name_hash = NULL;
-+ interfaces = NULL;
-+ dummy_interfaces = NULL;
-+ fallback_interface = NULL;
-+ extern int have_setup_fallback;
-+ have_setup_fallback = 0;
-+ quiet_interface_discovery = 1;
-+#ifndef LIBDHCP
-+ timeouts = NULL;
-+#endif
-+ dhcp_type_interface = NULL;
-+ interface_vector = NULL;
-+ interface_count = 0;
-+ interface_max = 0;
-+ name_servers = 0;
-+ domains = 0;
-+ dhcp_type_interface = NULL;
-+ dhcp_type_group = NULL;
-+ dhcp_type_shared_network = NULL;
-+ dhcp_type_control = NULL;
-+ memset(&dhcp_universe, '\0', sizeof(struct universe));
-+ memset(&dhcpv6_universe, '\0', sizeof(struct universe));
-+ memset(&nwip_universe, '\0', sizeof(struct universe));
-+ memset(&fqdn_universe, '\0', sizeof(struct universe));
-+ memset(&vendor_class_universe, '\0', sizeof(struct universe));
-+ memset(&vendor_universe, '\0', sizeof(struct universe));
-+ memset(&vsio_universe, '\0', sizeof(struct universe));
-+ memset(&isc_universe, '\0', sizeof(struct universe));
-+ memset(&isc6_universe, '\0', sizeof(struct universe));
-+ universe_hash = 0;
-+ universes = 0;
-+ universe_count = 0;
-+ universe_max = 0;
-+ config_universe = 0;
-+ extern struct hash_bucket *free_hash_buckets;
-+ free_hash_buckets = NULL;
-+ extern struct dhcp_packet *dhcp_free_list;
-+ dhcp_free_list = NULL;
-+ extern struct packet *packet_free_list;
-+ packet_free_list = NULL;
-+ extern struct binding_value *free_binding_values;
-+ free_binding_values = NULL;
-+ extern struct expression *free_expressions;
-+ free_expressions = NULL;
-+ extern struct option_cache *free_option_caches;
-+ free_option_caches = NULL;
-+ extern struct packet *free_packets;
-+ free_packets = NULL;
-+ extern pair free_pairs;
-+ free_pairs = NULL;
-+ extern omapi_io_object_t omapi_io_states;
-+ memset(&omapi_io_states, '\0', sizeof(omapi_io_states));
-+ dhcp_control_object = NULL;
-+ unlink(current_pid_file);
-+#endif
+ man_MANS = omapi.3
+ EXTRA_DIST = $(man_MANS)
- /*NOTREACHED*/
- return 0;
-@@ -1270,7 +1446,20 @@ void dhcpack (packet)
- if (client -> new -> rebind < cur_time)
- client -> new -> rebind = TIME_MAX;
+diff -up dhcp-4.0.0//omapip/alloc.c.libdhcp4client dhcp-4.0.0//omapip/alloc.c
+--- dhcp-4.0.0//omapip/alloc.c.libdhcp4client 2007-07-12 20:43:42.000000000 -1000
++++ dhcp-4.0.0//omapip/alloc.c 2008-08-01 10:17:46.000000000 -1000
+@@ -37,6 +37,33 @@
+
+ #include <omapip/omapip_p.h>
+#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
++/* 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));
++}
+
- bind_lease (client);
++static void record_pointer(void *ptr) {
++ tsearch(ptr, &(all_pointers), ptr_comparator);
++}
++
++static void forget_pointer(void *ptr) {
++ tdelete(ptr, &(all_pointers), ptr_comparator);
++}
++
++void omapi_free_all_pointers(void) {
++ if (all_pointers != NULL)
++ tdestroy(all_pointers, free);
++ all_pointers = NULL;
++}
++#endif
+
+ #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
+ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+ struct dmalloc_preamble *dmalloc_list;
+@@ -72,7 +99,9 @@ dmalloc(unsigned size, const char *file,
+ return NULL;
+
+ foo = malloc(len);
+-
+#ifdef LIBDHCP
-+ client->packet.siaddr.s_addr = set_siaddr;
++ record_pointer(foo);
++#endif
+ if (!foo)
+ return NULL;
+ bar = (void *)(foo + DMDOFFSET);
+@@ -191,6 +220,9 @@ dfree(void *ptr, const char *file, int l
+ 0, (unsigned char *)ptr + DMDOFFSET, 0, 1, RC_MALLOC);
+ #endif
+ free (ptr);
++#ifdef LIBDHCP
++ forget_pointer(ptr);
+#endif
}
- void bind_lease (client)
-@@ -1306,6 +1495,9 @@ void bind_lease (client)
- return;
- }
+ #if defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL) || \
+diff -up dhcp-4.0.0//omapip/dispatch.c.libdhcp4client dhcp-4.0.0//omapip/dispatch.c
+--- dhcp-4.0.0//omapip/dispatch.c.libdhcp4client 2007-11-30 11:51:43.000000000 -1000
++++ dhcp-4.0.0//omapip/dispatch.c 2008-08-01 10:17:46.000000000 -1000
+@@ -37,7 +37,7 @@
+ #include <omapip/omapip_p.h>
+ #include <sys/time.h>
+
+-static omapi_io_object_t omapi_io_states;
++omapi_io_object_t omapi_io_states;
+ time_t cur_time;
+
+ OMAPI_OBJECT_ALLOC (omapi_io,
+diff -up dhcp-4.0.0//omapip/errwarn.c.libdhcp4client dhcp-4.0.0//omapip/errwarn.c
+--- dhcp-4.0.0//omapip/errwarn.c.libdhcp4client 2008-08-01 10:17:44.000000000 -1000
++++ dhcp-4.0.0//omapip/errwarn.c 2008-08-01 10:17:46.000000000 -1000
+@@ -37,6 +37,11 @@
+ #include <errno.h>
+ #include <syslog.h>
+#ifdef LIBDHCP
-+ if (libdhcp_control && (libdhcp_control->capability & DHCP_USE_LEASE_DATABASE))
++#include <isc-dhcp/libdhcp_control.h>
++extern LIBDHCP_Control *libdhcp_control;
+#endif
- /* Write out the new lease. */
- write_client_lease (client, client -> new, 0, 0);
-
-@@ -1398,10 +1590,12 @@ void state_stop (cpp)
- }
- }
++
+ #ifdef DEBUG
+ int log_perror = -1;
+ #else
+@@ -46,7 +51,9 @@ int log_priority;
+ void (*log_cleanup) (void);
+ #define CVT_BUF_MAX 1023
+#ifndef LIBDHCP
- int commit_leases ()
- {
- return 0;
- }
+ static char mbuf [CVT_BUF_MAX + 1];
+#endif
+ static char fbuf [CVT_BUF_MAX + 1];
- int write_lease (lease)
- struct lease *lease;
-@@ -2074,6 +2268,10 @@ void state_panic (cpp)
- tell the shell script that we failed to allocate an address,
- and try again later. */
- if (onetry) {
+ /* Log an error message, then exit... */
+@@ -56,6 +63,16 @@ void log_fatal (const char * fmt, ... )
+ va_list list;
+
+ do_percentm (fbuf, fmt);
++
+#ifdef LIBDHCP
-+ script_init (client, "FAIL", (struct string_list *)0);
-+ return;
++ if (libdhcp_control && (libdhcp_control->eh)) {
++ va_start (list, fmt);
++ libdhcp_control->eh(libdhcp_control, LOG_FATAL, fbuf, list);
++ va_end(list);
++ libdhcp_control->finished = 1;
++ return;
++ }
++#else
+
+ /* %Audit% This is log output. %2004.06.17,Safe%
+ * If we truncate we hope the user can get a hint from the log.
+@@ -89,6 +106,7 @@ void log_fatal (const char * fmt, ... )
+ if (log_cleanup)
+ (*log_cleanup) ();
+ exit (1);
+#endif
- if (!quiet)
- log_info ("Unable to obtain a lease on first try.%s",
- " Exiting.");
-@@ -2691,7 +2889,9 @@ void destroy_client_lease (lease)
- free_client_lease (lease, MDL);
}
-+#ifndef LIBDHCP
- FILE *leaseFile = NULL;
-+#endif
- int leases_written = 0;
+ /* Log an error message... */
+@@ -99,6 +117,13 @@ int log_error (const char * fmt, ...)
+
+ do_percentm (fbuf, fmt);
- void rewrite_client_leases ()
-@@ -3218,6 +3418,54 @@ void script_write_params (client, prefix
- int script_go (client)
- struct client_state *client;
- {
+#ifdef LIBDHCP
-+ struct string_list *sp;
-+
-+ if (libdhcp_control && libdhcp_control->callback) {
-+ int dhcmsg;
-+ char *reason="";
-+
-+ for (sp = client->env; sp; sp = sp->next)
-+ if (strncmp(sp->string, "reason=", 7) == 0) {
-+ reason = sp->string + 7;
-+ break;
-+ }
-+
-+ if (strcmp(reason,"NBI") == 0)
-+ dhcmsg = DHC4_NBI;
-+ else if (strcmp(reason,"PREINIT") == 0)
-+ dhcmsg = DHC4_PREINIT;
-+ else if (strcmp(reason,"BOUND") == 0)
-+ dhcmsg = DHC4_BOUND;
-+ else if (strcmp(reason,"RENEW") == 0)
-+ dhcmsg = DHC4_RENEW;
-+ else if (strcmp(reason,"REBOOT") == 0)
-+ dhcmsg = DHC4_REBOOT;
-+ else if (strcmp(reason,"REBIND") == 0)
-+ dhcmsg = DHC4_REBIND;
-+ else if (strcmp(reason,"STOP") == 0)
-+ dhcmsg = DHC4_STOP;
-+ else if (strcmp(reason,"MEDIUM") == 0)
-+ dhcmsg = DHC4_MEDIUM;
-+ else if (strcmp(reason,"TIMEOUT") == 0)
-+ dhcmsg = DHC4_TIMEOUT;
-+ else if (strcmp(reason,"FAIL") == 0)
-+ dhcmsg = DHC4_FAIL;
-+ else if (strcmp(reason,"EXPIRE") == 0)
-+ dhcmsg = DHC4_EXPIRE;
-+ else if (strcmp(reason,"RELEASE") == 0)
-+ dhcmsg = DHC4_RELEASE;
-+ else
-+ dhcmsg = DHC4_NBI;
-+
-+ (*libdhcp_control->callback) (libdhcp_control, dhcmsg, client);
-+
-+ if (libdhcp_control->decline)
-+ return 1;
-+ }
-+
-+ return 0;
++ if (libdhcp_control && libdhcp_control->eh) {
++ va_start (list, fmt);
++ libdhcp_control->eh(libdhcp_control, LOG_ERR, fbuf, list);
++ va_end(list);
++ }
+#else
- char *scriptName;
- char *argv [2];
- char **envp;
-@@ -3294,6 +3542,7 @@ int script_go (client)
- time(&cur_time);
- return (WIFEXITED (wstatus) ?
- WEXITSTATUS (wstatus) : -WTERMSIG (wstatus));
+ /* %Audit% This is log output. %2004.06.17,Safe%
+ * If we truncate we hope the user can get a hint from the log.
+ */
+@@ -114,7 +139,7 @@ int log_error (const char * fmt, ...)
+ write (STDERR_FILENO, mbuf, strlen (mbuf));
+ write (STDERR_FILENO, "\n", 1);
+ }
+-
+#endif
+ return 0;
}
- void client_envadd (struct client_state *client,
-@@ -3376,6 +3625,9 @@ void go_daemon ()
+@@ -126,6 +151,13 @@ int log_info (const char *fmt, ...)
+
+ do_percentm (fbuf, fmt);
- /* 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))
++ if (libdhcp_control && libdhcp_control->eh) {
++ va_start (list, fmt);
++ libdhcp_control->eh(libdhcp_control, LOG_INFO, fbuf, list);
++ va_end(list);
++ }
++#else
+ /* %Audit% This is log output. %2004.06.17,Safe%
+ * If we truncate we hope the user can get a hint from the log.
+ */
+@@ -141,7 +173,7 @@ int log_info (const char *fmt, ...)
+ write (STDERR_FILENO, mbuf, strlen (mbuf));
+ write (STDERR_FILENO, "\n", 1);
+ }
+-
+#endif
- write_client_pid_file ();
- return;
- }
-@@ -3385,6 +3637,10 @@ void go_daemon ()
- return;
- state = 1;
+ return 0;
+ }
+
+@@ -152,7 +184,13 @@ int log_debug (const char *fmt, ...)
+ va_list list;
+ do_percentm (fbuf, fmt);
+-
+#ifdef LIBDHCP
-+ return;
++ if (libdhcp_control && libdhcp_control->eh) {
++ va_start (list, fmt);
++ libdhcp_control->eh(libdhcp_control, LOG_DEBUG, fbuf, list);
++ va_end(list);
++ }
++#else
+ /* %Audit% This is log output. %2004.06.17,Safe%
+ * If we truncate we hope the user can get a hint from the log.
+ */
+@@ -168,7 +206,7 @@ int log_debug (const char *fmt, ...)
+ write (STDERR_FILENO, mbuf, strlen (mbuf));
+ write (STDERR_FILENO, "\n", 1);
+ }
+-
+#endif
-+
- /* Stop logging to stderr... */
- log_perror = 0;
+ return 0;
+ }
dhcp-4.0.0-selinux.patch:
Index: dhcp-4.0.0-selinux.patch
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcp-4.0.0-selinux.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dhcp-4.0.0-selinux.patch 17 May 2008 00:18:13 -0000 1.1
+++ dhcp-4.0.0-selinux.patch 1 Aug 2008 21:16:41 -0000 1.2
@@ -1,7 +1,7 @@
diff -up dhcp-4.0.0//client/dhclient.c.selinux dhcp-4.0.0//client/dhclient.c
---- dhcp-4.0.0//client/dhclient.c.selinux 2008-05-16 13:42:18.000000000 -1000
-+++ dhcp-4.0.0//client/dhclient.c 2008-05-16 13:57:54.000000000 -1000
-@@ -2908,6 +2908,11 @@ void rewrite_client_leases ()
+--- dhcp-4.0.0//client/dhclient.c.selinux 2008-08-01 10:16:48.000000000 -1000
++++ dhcp-4.0.0//client/dhclient.c 2008-08-01 10:16:48.000000000 -1000
+@@ -2708,6 +2708,11 @@ void rewrite_client_leases ()
return;
}
@@ -13,7 +13,7 @@
/* If there is a default duid, write it out. */
if (default_duid.len != 0)
write_duid(&default_duid);
-@@ -3011,6 +3016,10 @@ write_duid(struct data_string *duid)
+@@ -2811,6 +2816,10 @@ write_duid(struct data_string *duid)
log_error("can't create %s: %m", path_dhclient_db);
return ISC_R_IOERROR;
}
@@ -24,7 +24,7 @@
}
/* It would make more sense to write this as a hex string,
-@@ -3058,6 +3067,10 @@ write_client6_lease(struct client_state
+@@ -2858,6 +2867,10 @@ write_client6_lease(struct client_state
log_error("can't create %s: %m", path_dhclient_db);
return ISC_R_IOERROR;
}
@@ -35,7 +35,7 @@
}
stat = fprintf(leaseFile, "lease6 {\n");
-@@ -3161,6 +3174,10 @@ int write_client_lease (client, lease, r
+@@ -2961,6 +2974,10 @@ int write_client_lease (client, lease, r
log_error ("can't create %s: %m", path_dhclient_db);
return 0;
}
Index: dhcp.spec
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/dhcp.spec,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -r1.211 -r1.212
--- dhcp.spec 25 Jul 2008 01:21:14 -0000 1.211
+++ dhcp.spec 1 Aug 2008 21:16:41 -0000 1.212
@@ -26,16 +26,16 @@
Source11: dhcp.schema
Source12: get-ldap-patch.sh
-Patch0: %{name}-3.0.5-errwarn-message.patch
+Patch0: %{name}-4.0.0-errwarn-message.patch
Patch1: %{name}-4.0.0-ldap-configuration.patch
-Patch2: %{name}-3.0.6-memory.patch
+Patch2: %{name}-4.0.0-memory.patch
Patch3: %{name}-4.0.0-options.patch
-Patch4: %{name}-3.0.5-release-by-ifup.patch
-Patch5: %{name}-3.0.5-dhclient-decline-backoff.patch
-Patch6: %{name}-3.0.5-enable-timeout-functions.patch
-Patch7: %{name}-3.0.5-unicast-bootp.patch
+Patch4: %{name}-4.0.0-release-by-ifup.patch
+Patch5: %{name}-4.0.0-dhclient-decline-backoff.patch
+Patch6: %{name}-4.0.0-enable-timeout-functions.patch
+Patch7: %{name}-4.0.0-unicast-bootp.patch
Patch8: %{name}-4.0.0-fast-timeout.patch
-Patch9: %{name}-3.0.5-failover-ports.patch
+Patch9: %{name}-4.0.0-failover-ports.patch
Patch10: %{name}-4.0.0-dhclient-usage.patch
Patch11: %{name}-4.0.0-default-requested-options.patch
Patch12: %{name}-4.0.0-xen-checksum.patch
@@ -46,6 +46,7 @@
Patch17: %{name}-4.0.0-selinux.patch
Patch18: %{name}-4.0.0-libdhcp4client.patch
Patch19: %{name}-4.0.0-O_CLOEXEC.patch
+Patch20: %{name}-4.0.0-inherit-leases.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: autoconf
@@ -199,6 +200,9 @@
# Make sure all open file descriptors are closed-on-exec for SELinux
%patch19 -p1
+# If we have an active lease, do not down the interface (#453982)
+%patch20 -p1
+
# Copy in documentation and example scripts for LDAP patch to dhcpd
%{__install} -p -m 0644 %{SOURCE5} .
%{__install} -p -m 0644 %{SOURCE6} doc/
@@ -427,9 +431,12 @@
%{_libdir}/libdhcp4client.so
%changelog
-* Thu Jul 24 2008 David Cantrell <dcantrell at redhat.com> - 12:4.0.0-17
+* Fri Aug 01 2008 David Cantrell <dcantrell at redhat.com> - 12:4.0.0-17
- Carry over RES_OPTIONS from ifcfg-ethX files to /etc/resolv.conf (#202923)
- Clean up Requires tags for devel packages
+- Allow SEARCH variable in ifcfg files to override search path (#454152)
+- Do not down interface if there is an active lease (#453982)
+- Clean up how dhclient-script restarts ypbind
* Sat Jun 21 2008 David Cantrell <dcantrell at redhat.com> - 12:4.0.0-16
- Remove instaces of \032 in domain search option (#450042)
Index: linux
===================================================================
RCS file: /cvs/pkgs/rpms/dhcp/devel/linux,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- linux 25 Jul 2008 01:21:14 -0000 1.14
+++ linux 1 Aug 2008 21:16:41 -0000 1.15
@@ -47,16 +47,20 @@
rscf=`mktemp /tmp/XXXXXX`;
echo '; generated by /sbin/dhclient-script' > $rscf
- if [ -n "$new_domain_search" ]; then
- echo "search ${new_domain_search//\\032/ }" >> $rscf
- else
- if [ -n "$new_domain_name" ]; then
- echo "search ${new_domain_name//\\032/ }" >> $rscf
+ if [ -z "$SEARCH" ]; then
+ if [ -n "$new_domain_search" ]; then
+ echo "search ${new_domain_search//\\032/ }" >> $rscf
+ else
+ if [ -n "$new_domain_name" ]; then
+ echo "search ${new_domain_name//\\032/ }" >> $rscf
+ fi
fi
+ else
+ echo "search $SEARCH" >> $rscf
fi
if [ -n "$RES_OPTIONS" ]; then
- echo options $RES_OPTIONS >> $rscf
+ echo "options $RES_OPTIONS" >> $rscf
fi
for nameserver in $new_domain_name_servers; do
@@ -355,8 +359,10 @@
let contents=contents+1
fi
- if [ $contents -gt 0 ] && [ -r /var/run/ypbind.pid ] && yppid=$(cat /var/run/ypbind.pid) && [ -d /proc/${yppid} ] && [ "$(if [ -x /usr/bin/readlink ]; then readlink /proc/${yppid}/exe; else echo /sbin/ypbind; fi)" = "/sbin/ypbind" ]; then
- kill -HUP $yppid
+ if [ $contents -gt 0 ]; then
+ if [ -x /etc/rc.d/init.d/ypbind ] && [ -r /var/run/ypbind.pid ]; then
+ service ypbind restart >/dev/null 2>&1
+ fi
fi
elif [ -n "$new_nis_servers" ]; then
save_previous /etc/yp.conf
@@ -368,8 +374,10 @@
let contents=contents+1
done
- if [ $contents -gt 0 ] && [ -r /var/run/ypbind.pid ] && yppid=$(cat /var/run/ypbind.pid) && [ -d /proc/${yppid} ] && [ "$(if [ -x /usr/bin/readlink ]; then readlink /proc/${yppid}/exe; else echo /sbin/ypbind; fi)" = "/sbin/ypbind" ]; then
- kill -HUP $yppid
+ if [ $contents -gt 0 ]; then
+ if [ -x /etc/rc.d/init.d/ypbind ] && [ -r /var/run/ypbind.pid ]; then
+ service ypbind restart >/dev/null 2>&1
+ fi
fi
fi
@@ -511,8 +519,8 @@
/bin/rm -f /etc/yp.conf
/bin/mv -f /etc/yp.conf.predhclient.$interface /etc/yp.conf
- if [ -r /var/run/ypbind.pid ] && yppid=$(cat /var/run/ypbind.pid) && [ -d /proc/${yppid} ] && [ "$(if [ -x /usr/bin/readlink ]; then readlink /proc/${yppid}/exe; else echo /sbin/ypbind; fi)" = "/sbin/ypbind" ]; then
- kill -HUP $yppid
+ if [ -x /etc/rc.d/init.d/ypbind ] && [ -r /var/run/ypbind.pid ]; then
+ service ypbind restart >/dev/null 2>&1
fi
fi
fi
@@ -554,10 +562,7 @@
exit_with_hooks 0
fi
- if [ -z "${dhc_dbus}" ] || (( ( dhc_dbus & 2 ) != 2 )); then
- ifconfig $interface inet 0 down
- fi
-
+ ifconfig $interface inet 0 down
exit_with_hooks 1
elif [ x$reason = xTIMEOUT ]; then
exit_with_hooks 1
--- dhcp-3.0.5-dhclient-decline-backoff.patch DELETED ---
--- dhcp-3.0.5-enable-timeout-functions.patch DELETED ---
--- dhcp-3.0.5-errwarn-message.patch DELETED ---
--- dhcp-3.0.5-failover-ports.patch DELETED ---
--- dhcp-3.0.5-release-by-ifup.patch DELETED ---
--- dhcp-3.0.5-unicast-bootp.patch DELETED ---
--- dhcp-3.0.6-memory.patch DELETED ---
More information about the fedora-extras-commits
mailing list