- Upgraded to ISC dhcp-4.1.0

- Had to rename the -T option to -timeout as ISC is now using -T
- Allow package rebuilders to easily enable DHCPv6 support with: rpmbuild
    --with DHCPv6 dhcp.spec Note that Fedora is still using the 'dhcpv6'
    package, but some users may want to experiment with the ISC DHCPv6
    implementation locally.
This commit is contained in:
David Cantrell 2009-01-06 23:50:29 +00:00
parent bd47089600
commit 4bf24c8243
28 changed files with 1241 additions and 1246 deletions

View File

@ -1 +1 @@
dhcp-4.0.0.tar.gz dhcp-4.1.0.tar.gz

View File

@ -1,12 +0,0 @@
--- dhcp-4.0.0//client/clparse.c.nmcrash 2008-04-01 10:25:39.000000000 -1000
+++ dhcp-4.0.0//client/clparse.c 2008-04-01 10:26:20.000000000 -1000
@@ -227,6 +227,9 @@ int read_client_conf_file (const char *n
cfile = (struct parse *)0;
new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0);
+ if (!cfile)
+ return ISC_R_BADPARSE;
+
do {
token = peek_token (&val, (unsigned *)0, cfile);
if (token == END_OF_FILE)

View File

@ -1,43 +0,0 @@
diff -up dhcp-4.0.0/client/dhclient.c.usage dhcp-4.0.0/client/dhclient.c
--- dhcp-4.0.0/client/dhclient.c.usage 2008-02-13 16:20:30.000000000 -1000
+++ dhcp-4.0.0/client/dhclient.c 2008-02-13 16:21:05.000000000 -1000
@@ -882,21 +882,30 @@ main(int argc, char **argv) {
static void usage ()
{
- log_info ("%s %s", message, PACKAGE_VERSION);
- log_info (copyright);
- log_info (arr);
- log_info (url);
+ printf ("%s %s\n", message, PACKAGE_VERSION);
+ printf (copyright);
+ printf ("\n");
+ printf (arr);
+ printf ("\n");
+ printf (url);
+ printf ("\n");
- log_error ("Usage: dhclient %s %s",
+ printf ("Usage: dhclient %s %s",
#ifdef DHCPv6
"[-4|-6] [-1dvrx] [-nw] [-p <port>]",
#else /* DHCPv6 */
"[-1dvrx] [-nw] [-p <port>]",
#endif /* DHCPv6 */
- "[-s server]");
- log_error (" [-cf config-file] [-lf lease-file]%s",
- "[-pf pid-file] [-e VAR=val]");
- log_fatal (" [-sf script-file] [interface]");
+ "[-s server]\n");
+ printf (" [-cf config-file] [-lf lease-file]%s",
+ "[-pf pid-file] [-e VAR=val]\n");
+ printf (" [ -I <dhcp-client-identifier> ] [-B]\n");
+ printf (" [ -H <host-name> | -F <fqdn.fqdn> ] [ -T <timeout> ]\n");
+ printf (" [ -V <vendor-class-identifier> ]\n");
+ printf (" [ -R <request option list> ]\n");
+ printf (" [-sf script-file] [interface]\n");
+
+ exit (EXIT_FAILURE);
}
isc_result_t find_class (struct class **c,

View File

@ -1,16 +0,0 @@
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

View File

@ -1,15 +0,0 @@
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;
- /* Set up a timeout to start the initialization
- process. */
- add_timeout (cur_time + random () % 5,
- state_reboot, client, 0, 0);
+ add_timeout (cur_time, state_reboot, client, 0, 0);
}
}
return ISC_R_SUCCESS;

View File

@ -1,37 +0,0 @@
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. */

View File

@ -1,7 +1,7 @@
diff -up dhcp-4.0.0/client/clparse.c.cloexec dhcp-4.0.0/client/clparse.c diff -up dhcp-4.1.0/client/clparse.c.cloexec dhcp-4.1.0/client/clparse.c
--- dhcp-4.0.0/client/clparse.c.cloexec 2008-10-29 12:59:29.000000000 -1000 --- dhcp-4.1.0/client/clparse.c.cloexec 2009-01-06 11:56:11.000000000 -1000
+++ dhcp-4.0.0/client/clparse.c 2008-10-29 13:11:34.000000000 -1000 +++ dhcp-4.1.0/client/clparse.c 2009-01-06 12:04:48.000000000 -1000
@@ -221,7 +221,7 @@ int read_client_conf_file (const char *n @@ -226,7 +226,7 @@ int read_client_conf_file (const char *n
int token; int token;
isc_result_t status; isc_result_t status;
@ -9,20 +9,20 @@ diff -up dhcp-4.0.0/client/clparse.c.cloexec dhcp-4.0.0/client/clparse.c
+ if ((file = open (name, O_RDONLY | O_CLOEXEC)) < 0) + if ((file = open (name, O_RDONLY | O_CLOEXEC)) < 0)
return uerr2isc (errno); return uerr2isc (errno);
cfile = (struct parse *)0; cfile = NULL;
@@ -258,7 +258,7 @@ void read_client_leases () @@ -263,7 +263,7 @@ void read_client_leases ()
/* Open the lease file. If we can't open it, just return - /* Open the lease file. If we can't open it, just return -
we can safely trust the server to remember our state. */ we can safely trust the server to remember our state. */
- if ((file = open (path_dhclient_db, O_RDONLY)) < 0) - if ((file = open (path_dhclient_db, O_RDONLY)) < 0)
+ if ((file = open (path_dhclient_db, O_RDONLY | O_CLOEXEC)) < 0) + if ((file = open (path_dhclient_db, O_RDONLY | O_CLOEXEC)) < 0)
return; return;
cfile = (struct parse *)0;
/* new_parse() may fail if the file is of zero length. */ cfile = NULL;
diff -up dhcp-4.0.0/client/dhclient.c.cloexec dhcp-4.0.0/client/dhclient.c diff -up dhcp-4.1.0/client/dhclient.c.cloexec dhcp-4.1.0/client/dhclient.c
--- dhcp-4.0.0/client/dhclient.c.cloexec 2008-10-29 12:59:29.000000000 -1000 --- dhcp-4.1.0/client/dhclient.c.cloexec 2009-01-06 11:56:10.000000000 -1000
+++ dhcp-4.0.0/client/dhclient.c 2008-10-29 13:26:16.000000000 -1000 +++ dhcp-4.1.0/client/dhclient.c 2009-01-06 12:04:01.000000000 -1000
@@ -125,11 +125,11 @@ main(int argc, char **argv) { @@ -135,11 +135,11 @@ main(int argc, char **argv) {
/* Make sure that file descriptors 0 (stdin), 1, (stdout), and /* Make sure that file descriptors 0 (stdin), 1, (stdout), and
2 (stderr) are open. To do this, we assume that when we 2 (stderr) are open. To do this, we assume that when we
open a file the lowest available file descriptor is used. */ open a file the lowest available file descriptor is used. */
@ -37,7 +37,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.cloexec dhcp-4.0.0/client/dhclient.c
if (fd == 2) if (fd == 2)
log_perror = 0; /* No sense logging to /dev/null. */ log_perror = 0; /* No sense logging to /dev/null. */
else if (fd != -1) else if (fd != -1)
@@ -403,7 +403,7 @@ main(int argc, char **argv) { @@ -465,7 +465,7 @@ main(int argc, char **argv) {
int e; int e;
oldpid = 0; oldpid = 0;
@ -46,7 +46,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.cloexec dhcp-4.0.0/client/dhclient.c
e = fscanf(pidfd, "%ld\n", &temp); e = fscanf(pidfd, "%ld\n", &temp);
oldpid = (pid_t)temp; oldpid = (pid_t)temp;
@@ -445,7 +445,7 @@ main(int argc, char **argv) { @@ -507,7 +507,7 @@ main(int argc, char **argv) {
strncpy(new_path_dhclient_pid, path_dhclient_pid, pfx); strncpy(new_path_dhclient_pid, path_dhclient_pid, pfx);
sprintf(new_path_dhclient_pid + pfx, "-%s.pid", ip->name); sprintf(new_path_dhclient_pid + pfx, "-%s.pid", ip->name);
@ -55,7 +55,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.cloexec dhcp-4.0.0/client/dhclient.c
e = fscanf(pidfd, "%ld\n", &temp); e = fscanf(pidfd, "%ld\n", &temp);
oldpid = (pid_t)temp; oldpid = (pid_t)temp;
@@ -470,7 +470,7 @@ main(int argc, char **argv) { @@ -532,7 +532,7 @@ main(int argc, char **argv) {
int dhc_running = 0; int dhc_running = 0;
char procfn[256] = ""; char procfn[256] = "";
@ -64,7 +64,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.cloexec dhcp-4.0.0/client/dhclient.c
if ((fscanf(pidfp, "%ld", &temp)==1) && ((dhcpid=(pid_t)temp) > 0)) { if ((fscanf(pidfp, "%ld", &temp)==1) && ((dhcpid=(pid_t)temp) > 0)) {
snprintf(procfn,256,"/proc/%u",dhcpid); snprintf(procfn,256,"/proc/%u",dhcpid);
dhc_running = (access(procfn, F_OK) == 0); dhc_running = (access(procfn, F_OK) == 0);
@@ -2702,7 +2702,7 @@ void rewrite_client_leases () @@ -2908,7 +2908,7 @@ void rewrite_client_leases ()
if (leaseFile != NULL) if (leaseFile != NULL)
fclose (leaseFile); fclose (leaseFile);
@ -73,7 +73,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.cloexec dhcp-4.0.0/client/dhclient.c
if (leaseFile == NULL) { if (leaseFile == NULL) {
log_error ("can't create %s: %m", path_dhclient_db); log_error ("can't create %s: %m", path_dhclient_db);
return; return;
@@ -2806,7 +2806,7 @@ write_duid(struct data_string *duid) @@ -3012,7 +3012,7 @@ write_duid(struct data_string *duid)
return ISC_R_INVALIDARG; return ISC_R_INVALIDARG;
if (leaseFile == NULL) { /* XXX? */ if (leaseFile == NULL) { /* XXX? */
@ -82,16 +82,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.cloexec dhcp-4.0.0/client/dhclient.c
if (leaseFile == NULL) { if (leaseFile == NULL) {
log_error("can't create %s: %m", path_dhclient_db); log_error("can't create %s: %m", path_dhclient_db);
return ISC_R_IOERROR; return ISC_R_IOERROR;
@@ -2853,7 +2853,7 @@ write_client6_lease(struct client_state @@ -3192,7 +3192,7 @@ int write_client_lease (client, lease, r
return ISC_R_INVALIDARG;
if (leaseFile == NULL) { /* XXX? */
- leaseFile = fopen(path_dhclient_db, "w");
+ leaseFile = fopen(path_dhclient_db, "we");
if (leaseFile == NULL) {
log_error("can't create %s: %m", path_dhclient_db);
return ISC_R_IOERROR;
@@ -2956,7 +2956,7 @@ int write_client_lease (client, lease, r
return 1; return 1;
if (leaseFile == NULL) { /* XXX */ if (leaseFile == NULL) { /* XXX */
@ -100,7 +91,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.cloexec dhcp-4.0.0/client/dhclient.c
if (leaseFile == NULL) { if (leaseFile == NULL) {
log_error ("can't create %s: %m", path_dhclient_db); log_error ("can't create %s: %m", path_dhclient_db);
return 0; return 0;
@@ -3402,9 +3402,9 @@ void go_daemon () @@ -3638,9 +3638,9 @@ void go_daemon ()
close(2); close(2);
/* Reopen them on /dev/null. */ /* Reopen them on /dev/null. */
@ -113,7 +104,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.cloexec dhcp-4.0.0/client/dhclient.c
write_client_pid_file (); write_client_pid_file ();
@@ -3416,14 +3416,14 @@ void write_client_pid_file () @@ -3652,14 +3652,14 @@ void write_client_pid_file ()
FILE *pf; FILE *pf;
int pfdesc; int pfdesc;
@ -130,9 +121,9 @@ diff -up dhcp-4.0.0/client/dhclient.c.cloexec dhcp-4.0.0/client/dhclient.c
if (!pf) if (!pf)
log_error ("Can't fdopen %s: %m", path_dhclient_pid); log_error ("Can't fdopen %s: %m", path_dhclient_pid);
else { else {
diff -up dhcp-4.0.0/common/bpf.c.cloexec dhcp-4.0.0/common/bpf.c diff -up dhcp-4.1.0/common/bpf.c.cloexec dhcp-4.1.0/common/bpf.c
--- dhcp-4.0.0/common/bpf.c.cloexec 2008-10-29 12:59:29.000000000 -1000 --- dhcp-4.1.0/common/bpf.c.cloexec 2009-01-06 11:56:11.000000000 -1000
+++ dhcp-4.0.0/common/bpf.c 2008-10-29 13:03:48.000000000 -1000 +++ dhcp-4.1.0/common/bpf.c 2009-01-06 11:56:11.000000000 -1000
@@ -94,7 +94,7 @@ int if_register_bpf (info) @@ -94,7 +94,7 @@ int if_register_bpf (info)
for (b = 0; 1; b++) { for (b = 0; 1; b++) {
/* %Audit% 31 bytes max. %2004.06.17,Safe% */ /* %Audit% 31 bytes max. %2004.06.17,Safe% */
@ -142,10 +133,10 @@ diff -up dhcp-4.0.0/common/bpf.c.cloexec dhcp-4.0.0/common/bpf.c
if (sock < 0) { if (sock < 0) {
if (errno == EBUSY) { if (errno == EBUSY) {
continue; continue;
diff -up dhcp-4.0.0/common/discover.c.cloexec dhcp-4.0.0/common/discover.c diff -up dhcp-4.1.0/common/discover.c.cloexec dhcp-4.1.0/common/discover.c
--- dhcp-4.0.0/common/discover.c.cloexec 2007-10-05 12:29:51.000000000 -1000 --- dhcp-4.1.0/common/discover.c.cloexec 2008-08-29 07:48:57.000000000 -1000
+++ dhcp-4.0.0/common/discover.c 2008-10-29 13:04:07.000000000 -1000 +++ dhcp-4.1.0/common/discover.c 2009-01-06 11:56:11.000000000 -1000
@@ -388,7 +388,7 @@ begin_iface_scan(struct iface_conf_list @@ -409,7 +409,7 @@ begin_iface_scan(struct iface_conf_list
int len; int len;
int i; int i;
@ -154,7 +145,7 @@ diff -up dhcp-4.0.0/common/discover.c.cloexec dhcp-4.0.0/common/discover.c
if (ifaces->fp == NULL) { if (ifaces->fp == NULL) {
log_error("Error opening '/proc/net/dev' to list interfaces"); log_error("Error opening '/proc/net/dev' to list interfaces");
return 0; return 0;
@@ -422,7 +422,7 @@ begin_iface_scan(struct iface_conf_list @@ -443,7 +443,7 @@ begin_iface_scan(struct iface_conf_list
} }
#ifdef DHCPv6 #ifdef DHCPv6
@ -163,9 +154,9 @@ diff -up dhcp-4.0.0/common/discover.c.cloexec dhcp-4.0.0/common/discover.c
if (ifaces->fp6 == NULL) { if (ifaces->fp6 == NULL) {
log_error("Error opening '/proc/net/if_inet6' to " log_error("Error opening '/proc/net/if_inet6' to "
"list IPv6 interfaces; %m"); "list IPv6 interfaces; %m");
diff -up dhcp-4.0.0/common/dlpi.c.cloexec dhcp-4.0.0/common/dlpi.c diff -up dhcp-4.1.0/common/dlpi.c.cloexec dhcp-4.1.0/common/dlpi.c
--- dhcp-4.0.0/common/dlpi.c.cloexec 2008-10-29 12:59:29.000000000 -1000 --- dhcp-4.1.0/common/dlpi.c.cloexec 2009-01-06 11:56:11.000000000 -1000
+++ dhcp-4.0.0/common/dlpi.c 2008-10-29 13:04:35.000000000 -1000 +++ dhcp-4.1.0/common/dlpi.c 2009-01-06 11:56:11.000000000 -1000
@@ -795,7 +795,7 @@ dlpiopen(const char *ifname) { @@ -795,7 +795,7 @@ dlpiopen(const char *ifname) {
} }
*dp = '\0'; *dp = '\0';
@ -175,9 +166,9 @@ diff -up dhcp-4.0.0/common/dlpi.c.cloexec dhcp-4.0.0/common/dlpi.c
} }
/* /*
diff -up dhcp-4.0.0/common/nit.c.cloexec dhcp-4.0.0/common/nit.c diff -up dhcp-4.1.0/common/nit.c.cloexec dhcp-4.1.0/common/nit.c
--- dhcp-4.0.0/common/nit.c.cloexec 2008-10-29 12:59:29.000000000 -1000 --- dhcp-4.1.0/common/nit.c.cloexec 2009-01-06 11:56:11.000000000 -1000
+++ dhcp-4.0.0/common/nit.c 2008-10-29 13:04:53.000000000 -1000 +++ dhcp-4.1.0/common/nit.c 2009-01-06 11:56:11.000000000 -1000
@@ -81,7 +81,7 @@ int if_register_nit (info) @@ -81,7 +81,7 @@ int if_register_nit (info)
struct strioctl sio; struct strioctl sio;
@ -187,21 +178,21 @@ diff -up dhcp-4.0.0/common/nit.c.cloexec dhcp-4.0.0/common/nit.c
if (sock < 0) if (sock < 0)
log_fatal ("Can't open NIT device for %s: %m", info -> name); log_fatal ("Can't open NIT device for %s: %m", info -> name);
diff -up dhcp-4.0.0/common/resolv.c.cloexec dhcp-4.0.0/common/resolv.c diff -up dhcp-4.1.0/common/resolv.c.cloexec dhcp-4.1.0/common/resolv.c
--- dhcp-4.0.0/common/resolv.c.cloexec 2007-11-30 11:51:43.000000000 -1000 --- dhcp-4.1.0/common/resolv.c.cloexec 2008-03-07 10:12:44.000000000 -1000
+++ dhcp-4.0.0/common/resolv.c 2008-10-29 13:05:08.000000000 -1000 +++ dhcp-4.1.0/common/resolv.c 2009-01-06 12:05:17.000000000 -1000
@@ -48,7 +48,7 @@ void read_resolv_conf (parse_time) @@ -49,7 +49,7 @@ void read_resolv_conf (parse_time)
struct name_server *sp, *sl, *ns;
struct domain_search_list *dp, *dl, *nd; struct domain_search_list *dp, *dl, *nd;
isc_result_t status;
- if ((file = open (path_resolv_conf, O_RDONLY)) < 0) { - if ((file = open (path_resolv_conf, O_RDONLY)) < 0) {
+ if ((file = open (path_resolv_conf, O_RDONLY | O_CLOEXEC)) < 0) { + if ((file = open (path_resolv_conf, O_RDONLY | O_CLOEXEC)) < 0) {
log_error ("Can't open %s: %m", path_resolv_conf); log_error ("Can't open %s: %m", path_resolv_conf);
return; return;
} }
diff -up dhcp-4.0.0/common/upf.c.cloexec dhcp-4.0.0/common/upf.c diff -up dhcp-4.1.0/common/upf.c.cloexec dhcp-4.1.0/common/upf.c
--- dhcp-4.0.0/common/upf.c.cloexec 2008-10-29 12:59:29.000000000 -1000 --- dhcp-4.1.0/common/upf.c.cloexec 2009-01-06 11:56:11.000000000 -1000
+++ dhcp-4.0.0/common/upf.c 2008-10-29 13:05:27.000000000 -1000 +++ dhcp-4.1.0/common/upf.c 2009-01-06 11:56:11.000000000 -1000
@@ -77,7 +77,7 @@ int if_register_upf (info) @@ -77,7 +77,7 @@ int if_register_upf (info)
/* %Audit% Cannot exceed 36 bytes. %2004.06.17,Safe% */ /* %Audit% Cannot exceed 36 bytes. %2004.06.17,Safe% */
sprintf(filename, "/dev/pf/pfilt%d", b); sprintf(filename, "/dev/pf/pfilt%d", b);
@ -211,9 +202,9 @@ diff -up dhcp-4.0.0/common/upf.c.cloexec dhcp-4.0.0/common/upf.c
if (sock < 0) { if (sock < 0) {
if (errno == EBUSY) { if (errno == EBUSY) {
continue; continue;
diff -up dhcp-4.0.0/dst/dst_api.c.cloexec dhcp-4.0.0/dst/dst_api.c diff -up dhcp-4.1.0/dst/dst_api.c.cloexec dhcp-4.1.0/dst/dst_api.c
--- dhcp-4.0.0/dst/dst_api.c.cloexec 2007-11-30 11:51:43.000000000 -1000 --- dhcp-4.1.0/dst/dst_api.c.cloexec 2007-11-30 11:51:43.000000000 -1000
+++ dhcp-4.0.0/dst/dst_api.c 2008-10-29 13:06:22.000000000 -1000 +++ dhcp-4.1.0/dst/dst_api.c 2009-01-06 11:56:11.000000000 -1000
@@ -436,7 +436,7 @@ dst_s_write_private_key(const DST_KEY *k @@ -436,7 +436,7 @@ dst_s_write_private_key(const DST_KEY *k
PRIVATE_KEY, PATH_MAX); PRIVATE_KEY, PATH_MAX);
@ -250,9 +241,9 @@ diff -up dhcp-4.0.0/dst/dst_api.c.cloexec dhcp-4.0.0/dst/dst_api.c
EREPORT(("dst_s_read_private_key_file: Could not open file %s in directory %s\n", EREPORT(("dst_s_read_private_key_file: Could not open file %s in directory %s\n",
filename, dst_path[0] ? dst_path : filename, dst_path[0] ? dst_path :
(char *) getcwd(NULL, PATH_MAX - 1))); (char *) getcwd(NULL, PATH_MAX - 1)));
diff -up dhcp-4.0.0/dst/prandom.c.cloexec dhcp-4.0.0/dst/prandom.c diff -up dhcp-4.1.0/dst/prandom.c.cloexec dhcp-4.1.0/dst/prandom.c
--- dhcp-4.0.0/dst/prandom.c.cloexec 2007-11-30 11:51:43.000000000 -1000 --- dhcp-4.1.0/dst/prandom.c.cloexec 2007-11-30 11:51:43.000000000 -1000
+++ dhcp-4.0.0/dst/prandom.c 2008-10-29 13:06:50.000000000 -1000 +++ dhcp-4.1.0/dst/prandom.c 2009-01-06 11:56:11.000000000 -1000
@@ -267,7 +267,7 @@ get_dev_random(u_char *output, unsigned @@ -267,7 +267,7 @@ get_dev_random(u_char *output, unsigned
s = stat("/dev/random", &st); s = stat("/dev/random", &st);
@ -271,10 +262,10 @@ diff -up dhcp-4.0.0/dst/prandom.c.cloexec dhcp-4.0.0/dst/prandom.c
return (0); return (0);
for (no = 0; (i = fread(buf, sizeof(*buf), sizeof(buf), fp)) > 0; for (no = 0; (i = fread(buf, sizeof(*buf), sizeof(buf), fp)) > 0;
no += i) no += i)
diff -up dhcp-4.0.0/minires/res_init.c.cloexec dhcp-4.0.0/minires/res_init.c diff -up dhcp-4.1.0/minires/res_init.c.cloexec dhcp-4.1.0/minires/res_init.c
--- dhcp-4.0.0/minires/res_init.c.cloexec 2007-10-01 04:47:35.000000000 -1000 --- dhcp-4.1.0/minires/res_init.c.cloexec 2008-02-28 11:21:56.000000000 -1000
+++ dhcp-4.0.0/minires/res_init.c 2008-10-29 13:07:12.000000000 -1000 +++ dhcp-4.1.0/minires/res_init.c 2009-01-06 11:56:11.000000000 -1000
@@ -234,7 +234,7 @@ minires_vinit(res_state statp, int prein @@ -233,7 +233,7 @@ minires_vinit(res_state statp, int prein
(line[sizeof(name) - 1] == ' ' || \ (line[sizeof(name) - 1] == ' ' || \
line[sizeof(name) - 1] == '\t')) line[sizeof(name) - 1] == '\t'))
@ -283,10 +274,10 @@ diff -up dhcp-4.0.0/minires/res_init.c.cloexec dhcp-4.0.0/minires/res_init.c
/* read the config file */ /* read the config file */
while (fgets(buf, sizeof(buf), fp) != NULL) { while (fgets(buf, sizeof(buf), fp) != NULL) {
/* skip comments */ /* skip comments */
diff -up dhcp-4.0.0/minires/res_query.c.cloexec dhcp-4.0.0/minires/res_query.c diff -up dhcp-4.1.0/minires/res_query.c.cloexec dhcp-4.1.0/minires/res_query.c
--- dhcp-4.0.0/minires/res_query.c.cloexec 2007-09-05 07:32:10.000000000 -1000 --- dhcp-4.1.0/minires/res_query.c.cloexec 2008-02-28 11:21:56.000000000 -1000
+++ dhcp-4.0.0/minires/res_query.c 2008-10-29 13:07:30.000000000 -1000 +++ dhcp-4.1.0/minires/res_query.c 2009-01-06 11:56:11.000000000 -1000
@@ -391,7 +391,7 @@ res_hostalias(const res_state statp, con @@ -379,7 +379,7 @@ res_hostalias(const res_state statp, con
if (statp->options & RES_NOALIASES) if (statp->options & RES_NOALIASES)
return (NULL); return (NULL);
file = getenv("HOSTALIASES"); file = getenv("HOSTALIASES");
@ -295,9 +286,9 @@ diff -up dhcp-4.0.0/minires/res_query.c.cloexec dhcp-4.0.0/minires/res_query.c
return (NULL); return (NULL);
setbuf(fp, NULL); setbuf(fp, NULL);
buf[sizeof(buf) - 1] = '\0'; buf[sizeof(buf) - 1] = '\0';
diff -up dhcp-4.0.0/omapip/trace.c.cloexec dhcp-4.0.0/omapip/trace.c diff -up dhcp-4.1.0/omapip/trace.c.cloexec dhcp-4.1.0/omapip/trace.c
--- dhcp-4.0.0/omapip/trace.c.cloexec 2007-07-12 20:43:42.000000000 -1000 --- dhcp-4.1.0/omapip/trace.c.cloexec 2007-07-12 20:43:42.000000000 -1000
+++ dhcp-4.0.0/omapip/trace.c 2008-10-29 13:08:04.000000000 -1000 +++ dhcp-4.1.0/omapip/trace.c 2009-01-06 11:56:11.000000000 -1000
@@ -140,10 +140,10 @@ isc_result_t trace_begin (const char *fi @@ -140,10 +140,10 @@ isc_result_t trace_begin (const char *fi
return ISC_R_INVALIDARG; return ISC_R_INVALIDARG;
} }
@ -320,12 +311,12 @@ diff -up dhcp-4.0.0/omapip/trace.c.cloexec dhcp-4.0.0/omapip/trace.c
if (!traceinfile) { if (!traceinfile) {
log_error ("Can't open tracefile %s: %m", filename); log_error ("Can't open tracefile %s: %m", filename);
return; return;
diff -up dhcp-4.0.0/relay/dhcrelay.c.cloexec dhcp-4.0.0/relay/dhcrelay.c diff -up dhcp-4.1.0/relay/dhcrelay.c.cloexec dhcp-4.1.0/relay/dhcrelay.c
--- dhcp-4.0.0/relay/dhcrelay.c.cloexec 2007-11-30 11:51:43.000000000 -1000 --- dhcp-4.1.0/relay/dhcrelay.c.cloexec 2008-11-12 13:22:14.000000000 -1000
+++ dhcp-4.0.0/relay/dhcrelay.c 2008-10-29 13:08:49.000000000 -1000 +++ dhcp-4.1.0/relay/dhcrelay.c 2009-01-06 12:06:23.000000000 -1000
@@ -112,11 +112,11 @@ main(int argc, char **argv) { @@ -174,11 +174,11 @@ main(int argc, char **argv) {
/* Make sure that file descriptors 0 (stdin), 1, (stdout), and /* Make sure that file descriptors 0(stdin), 1,(stdout), and
2 (stderr) are open. To do this, we assume that when we 2(stderr) are open. To do this, we assume that when we
open a file the lowest available file descriptor is used. */ open a file the lowest available file descriptor is used. */
- fd = open("/dev/null", O_RDWR); - fd = open("/dev/null", O_RDWR);
+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); + fd = open("/dev/null", O_RDWR | O_CLOEXEC);
@ -338,25 +329,25 @@ diff -up dhcp-4.0.0/relay/dhcrelay.c.cloexec dhcp-4.0.0/relay/dhcrelay.c
if (fd == 2) if (fd == 2)
log_perror = 0; /* No sense logging to /dev/null. */ log_perror = 0; /* No sense logging to /dev/null. */
else if (fd != -1) else if (fd != -1)
@@ -288,12 +288,12 @@ main(int argc, char **argv) { @@ -511,12 +511,12 @@ main(int argc, char **argv) {
exit (0); exit(0);
pfdesc = open (path_dhcrelay_pid, pfdesc = open(path_dhcrelay_pid,
- O_CREAT | O_TRUNC | O_WRONLY, 0644); - O_CREAT | O_TRUNC | O_WRONLY, 0644);
+ O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, 0644); + O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, 0644);
if (pfdesc < 0) { if (pfdesc < 0) {
log_error ("Can't create %s: %m", path_dhcrelay_pid); log_error("Can't create %s: %m", path_dhcrelay_pid);
} else { } else {
- pf = fdopen (pfdesc, "w"); - pf = fdopen(pfdesc, "w");
+ pf = fdopen (pfdesc, "we"); + pf = fdopen(pfdesc, "we");
if (!pf) if (!pf)
log_error ("Can't fdopen %s: %m", log_error("Can't fdopen %s: %m",
path_dhcrelay_pid); path_dhcrelay_pid);
diff -up dhcp-4.0.0/server/confpars.c.cloexec dhcp-4.0.0/server/confpars.c diff -up dhcp-4.1.0/server/confpars.c.cloexec dhcp-4.1.0/server/confpars.c
--- dhcp-4.0.0/server/confpars.c.cloexec 2008-10-29 12:59:28.000000000 -1000 --- dhcp-4.1.0/server/confpars.c.cloexec 2009-01-06 11:56:10.000000000 -1000
+++ dhcp-4.0.0/server/confpars.c 2008-10-29 13:09:17.000000000 -1000 +++ dhcp-4.1.0/server/confpars.c 2009-01-06 11:56:11.000000000 -1000
@@ -115,7 +115,7 @@ isc_result_t read_conf_file (const char @@ -116,7 +116,7 @@ isc_result_t read_conf_file (const char
} }
#endif #endif
@ -365,10 +356,10 @@ diff -up dhcp-4.0.0/server/confpars.c.cloexec dhcp-4.0.0/server/confpars.c
if (leasep) { if (leasep) {
log_error ("Can't open lease database %s: %m --", log_error ("Can't open lease database %s: %m --",
path_dhcpd_db); path_dhcpd_db);
diff -up dhcp-4.0.0/server/db.c.cloexec dhcp-4.0.0/server/db.c diff -up dhcp-4.1.0/server/db.c.cloexec dhcp-4.1.0/server/db.c
--- dhcp-4.0.0/server/db.c.cloexec 2007-10-05 12:29:51.000000000 -1000 --- dhcp-4.1.0/server/db.c.cloexec 2008-03-31 03:49:45.000000000 -1000
+++ dhcp-4.0.0/server/db.c 2008-10-29 13:09:39.000000000 -1000 +++ dhcp-4.1.0/server/db.c 2009-01-06 11:56:11.000000000 -1000
@@ -974,7 +974,7 @@ void db_startup (testp) @@ -1021,7 +1021,7 @@ void db_startup (testp)
} }
#endif #endif
if (!testp) { if (!testp) {
@ -377,7 +368,7 @@ diff -up dhcp-4.0.0/server/db.c.cloexec dhcp-4.0.0/server/db.c
if (!db_file) if (!db_file)
log_fatal ("Can't open %s for append.", path_dhcpd_db); log_fatal ("Can't open %s for append.", path_dhcpd_db);
expire_all_pools (); expire_all_pools ();
@@ -1022,12 +1022,12 @@ int new_lease_file () @@ -1069,12 +1069,12 @@ int new_lease_file ()
path_dhcpd_db, (int)t) >= sizeof newfname) path_dhcpd_db, (int)t) >= sizeof newfname)
log_fatal("new_lease_file: lease file path too long"); log_fatal("new_lease_file: lease file path too long");
@ -392,10 +383,10 @@ diff -up dhcp-4.0.0/server/db.c.cloexec dhcp-4.0.0/server/db.c
log_error("Can't fdopen new lease file: %m"); log_error("Can't fdopen new lease file: %m");
close(db_fd); close(db_fd);
goto fdfail; goto fdfail;
diff -up dhcp-4.0.0/server/dhcpd.c.cloexec dhcp-4.0.0/server/dhcpd.c diff -up dhcp-4.1.0/server/dhcpd.c.cloexec dhcp-4.1.0/server/dhcpd.c
--- dhcp-4.0.0/server/dhcpd.c.cloexec 2008-10-29 12:59:28.000000000 -1000 --- dhcp-4.1.0/server/dhcpd.c.cloexec 2009-01-06 11:56:09.000000000 -1000
+++ dhcp-4.0.0/server/dhcpd.c 2008-10-29 13:10:42.000000000 -1000 +++ dhcp-4.1.0/server/dhcpd.c 2009-01-06 12:06:49.000000000 -1000
@@ -225,11 +225,11 @@ main(int argc, char **argv) { @@ -266,11 +266,11 @@ main(int argc, char **argv) {
/* Make sure that file descriptors 0 (stdin), 1, (stdout), and /* Make sure that file descriptors 0 (stdin), 1, (stdout), and
2 (stderr) are open. To do this, we assume that when we 2 (stderr) are open. To do this, we assume that when we
open a file the lowest available file descriptor is used. */ open a file the lowest available file descriptor is used. */
@ -410,8 +401,8 @@ diff -up dhcp-4.0.0/server/dhcpd.c.cloexec dhcp-4.0.0/server/dhcpd.c
if (fd == 2) if (fd == 2)
log_perror = 0; /* No sense logging to /dev/null. */ log_perror = 0; /* No sense logging to /dev/null. */
else if (fd != -1) else if (fd != -1)
@@ -658,7 +658,7 @@ main(int argc, char **argv) { @@ -779,7 +779,7 @@ main(int argc, char **argv) {
} #endif /* PARANOIA */
/* Read previous pid file. */ /* Read previous pid file. */
- if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) { - if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
@ -419,7 +410,7 @@ diff -up dhcp-4.0.0/server/dhcpd.c.cloexec dhcp-4.0.0/server/dhcpd.c
status = read(i, pbuf, (sizeof pbuf) - 1); status = read(i, pbuf, (sizeof pbuf) - 1);
close (i); close (i);
if (status > 0) { if (status > 0) {
@@ -676,7 +676,7 @@ main(int argc, char **argv) { @@ -797,7 +797,7 @@ main(int argc, char **argv) {
} }
/* Write new pid file. */ /* Write new pid file. */
@ -428,7 +419,7 @@ diff -up dhcp-4.0.0/server/dhcpd.c.cloexec dhcp-4.0.0/server/dhcpd.c
sprintf(pbuf, "%d\n", (int) getpid()); sprintf(pbuf, "%d\n", (int) getpid());
write(i, pbuf, strlen(pbuf)); write(i, pbuf, strlen(pbuf));
close(i); close(i);
@@ -702,9 +702,9 @@ main(int argc, char **argv) { @@ -823,9 +823,9 @@ main(int argc, char **argv) {
close(2); close(2);
/* Reopen them on /dev/null. */ /* Reopen them on /dev/null. */
@ -441,9 +432,9 @@ diff -up dhcp-4.0.0/server/dhcpd.c.cloexec dhcp-4.0.0/server/dhcpd.c
log_perror = 0; /* No sense logging to /dev/null. */ log_perror = 0; /* No sense logging to /dev/null. */
chdir("/"); chdir("/");
diff -up dhcp-4.0.0/server/ldap.c.cloexec dhcp-4.0.0/server/ldap.c diff -up dhcp-4.1.0/server/ldap.c.cloexec dhcp-4.1.0/server/ldap.c
--- dhcp-4.0.0/server/ldap.c.cloexec 2008-10-29 12:59:28.000000000 -1000 --- dhcp-4.1.0/server/ldap.c.cloexec 2009-01-06 11:56:09.000000000 -1000
+++ dhcp-4.0.0/server/ldap.c 2008-10-29 13:11:10.000000000 -1000 +++ dhcp-4.1.0/server/ldap.c 2009-01-06 11:56:11.000000000 -1000
@@ -685,7 +685,7 @@ ldap_start (void) @@ -685,7 +685,7 @@ ldap_start (void)
if (ldap_debug_file != NULL && ldap_debug_fd == -1) if (ldap_debug_file != NULL && ldap_debug_fd == -1)

View File

@ -1,6 +1,6 @@
diff -up dhcp-4.0.0/client/clparse.c.dho dhcp-4.0.0/client/clparse.c diff -up dhcp-4.1.0/client/clparse.c.requested dhcp-4.1.0/client/clparse.c
--- dhcp-4.0.0/client/clparse.c.dho 2007-12-29 06:32:16.000000000 -1000 --- dhcp-4.1.0/client/clparse.c.requested 2009-01-06 10:40:46.000000000 -1000
+++ dhcp-4.0.0/client/clparse.c 2007-12-29 06:35:41.000000000 -1000 +++ dhcp-4.1.0/client/clparse.c 2009-01-06 10:40:47.000000000 -1000
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
struct client_config top_level_config; struct client_config top_level_config;
@ -10,7 +10,7 @@ diff -up dhcp-4.0.0/client/clparse.c.dho dhcp-4.0.0/client/clparse.c
struct option *default_requested_options[NUM_DEFAULT_REQUESTED_OPTS + 1]; struct option *default_requested_options[NUM_DEFAULT_REQUESTED_OPTS + 1];
static void parse_client_default_duid(struct parse *cfile); static void parse_client_default_duid(struct parse *cfile);
@@ -107,6 +107,21 @@ isc_result_t read_client_conf () @@ -111,6 +111,21 @@ isc_result_t read_client_conf ()
option_code_hash_lookup(&default_requested_options[8], option_code_hash_lookup(&default_requested_options[8],
dhcpv6_universe.code_hash, &code, 0, MDL); dhcpv6_universe.code_hash, &code, 0, MDL);

View File

@ -1,56 +1,7 @@
diff -up dhcp-4.0.0/common/lpf.c.anycast dhcp-4.0.0/common/lpf.c diff -up dhcp-4.1.0/client/clparse.c.anycast dhcp-4.1.0/client/clparse.c
--- dhcp-4.0.0/common/lpf.c.anycast 2007-12-29 06:44:46.000000000 -1000 --- dhcp-4.1.0/client/clparse.c.anycast 2009-01-06 10:43:52.000000000 -1000
+++ dhcp-4.0.0/common/lpf.c 2007-12-29 10:40:11.000000000 -1000 +++ dhcp-4.1.0/client/clparse.c 2009-01-06 10:43:53.000000000 -1000
@@ -331,6 +331,9 @@ ssize_t send_packet (interface, packet, @@ -558,6 +558,17 @@ void parse_client_statement (cfile, ip,
return send_fallback (interface, packet, raw,
len, from, to, hto);
+ if (hto == NULL && interface->anycast_mac_addr.hlen)
+ hto = &interface->anycast_mac_addr;
+
/* Assemble the headers... */
assemble_hw_header (interface, (unsigned char *)hh, &hbufp, hto);
fudge = hbufp % 4; /* IP header must be word-aligned. */
diff -up dhcp-4.0.0/common/conflex.c.anycast dhcp-4.0.0/common/conflex.c
--- dhcp-4.0.0/common/conflex.c.anycast 2007-12-29 06:44:46.000000000 -1000
+++ dhcp-4.0.0/common/conflex.c 2007-12-29 10:39:30.000000000 -1000
@@ -715,6 +715,8 @@ intern(char *atom, enum dhcp_token dfv)
}
if (!strcasecmp (atom + 1, "nd"))
return AND;
+ if (!strcasecmp (atom + 1, "nycast-mac"))
+ return ANYCAST_MAC;
if (!strcasecmp (atom + 1, "ppend"))
return APPEND;
if (!strcasecmp (atom + 1, "llow"))
diff -up dhcp-4.0.0/includes/dhcpd.h.anycast dhcp-4.0.0/includes/dhcpd.h
--- dhcp-4.0.0/includes/dhcpd.h.anycast 2007-12-29 06:44:46.000000000 -1000
+++ dhcp-4.0.0/includes/dhcpd.h 2007-12-29 10:42:56.000000000 -1000
@@ -1188,6 +1188,7 @@ struct interface_info {
int dlpi_sap_length;
struct hardware dlpi_broadcast_addr;
# endif /* DLPI_SEND || DLPI_RECEIVE */
+ struct hardware anycast_mac_addr;
};
struct hardware_link {
diff -up dhcp-4.0.0/includes/dhctoken.h.anycast dhcp-4.0.0/includes/dhctoken.h
--- dhcp-4.0.0/includes/dhctoken.h.anycast 2007-12-29 06:44:46.000000000 -1000
+++ dhcp-4.0.0/includes/dhctoken.h 2007-12-29 10:44:00.000000000 -1000
@@ -346,7 +346,8 @@ enum dhcp_token {
WHITESPACE = 649,
TOKEN_ALSO = 650,
AFTER = 651,
- BOOTP_BROADCAST_ALWAYS = 652
+ BOOTP_BROADCAST_ALWAYS = 652,
+ ANYCAST_MAC = 653
};
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
diff -up dhcp-4.0.0/client/clparse.c.anycast dhcp-4.0.0/client/clparse.c
--- dhcp-4.0.0/client/clparse.c.anycast 2007-12-29 06:44:46.000000000 -1000
+++ dhcp-4.0.0/client/clparse.c 2007-12-29 10:38:55.000000000 -1000
@@ -550,6 +550,17 @@ void parse_client_statement (cfile, ip,
} }
return; return;
@ -68,3 +19,52 @@ diff -up dhcp-4.0.0/client/clparse.c.anycast dhcp-4.0.0/client/clparse.c
case REQUEST: case REQUEST:
token = next_token (&val, (unsigned *)0, cfile); token = next_token (&val, (unsigned *)0, cfile);
if (config -> requested_options == default_requested_options) if (config -> requested_options == default_requested_options)
diff -up dhcp-4.1.0/common/conflex.c.anycast dhcp-4.1.0/common/conflex.c
--- dhcp-4.1.0/common/conflex.c.anycast 2009-01-06 10:43:52.000000000 -1000
+++ dhcp-4.1.0/common/conflex.c 2009-01-06 10:43:53.000000000 -1000
@@ -729,6 +729,8 @@ intern(char *atom, enum dhcp_token dfv)
}
if (!strcasecmp (atom + 1, "nd"))
return AND;
+ if (!strcasecmp (atom + 1, "nycast-mac"))
+ return ANYCAST_MAC;
if (!strcasecmp (atom + 1, "ppend"))
return APPEND;
if (!strcasecmp (atom + 1, "llow"))
diff -up dhcp-4.1.0/common/lpf.c.anycast dhcp-4.1.0/common/lpf.c
--- dhcp-4.1.0/common/lpf.c.anycast 2009-01-06 10:43:52.000000000 -1000
+++ dhcp-4.1.0/common/lpf.c 2009-01-06 10:43:53.000000000 -1000
@@ -333,6 +333,9 @@ ssize_t send_packet (interface, packet,
return send_fallback (interface, packet, raw,
len, from, to, hto);
+ if (hto == NULL && interface->anycast_mac_addr.hlen)
+ hto = &interface->anycast_mac_addr;
+
/* Assemble the headers... */
assemble_hw_header (interface, (unsigned char *)hh, &hbufp, hto);
fudge = hbufp % 4; /* IP header must be word-aligned. */
diff -up dhcp-4.1.0/includes/dhcpd.h.anycast dhcp-4.1.0/includes/dhcpd.h
--- dhcp-4.1.0/includes/dhcpd.h.anycast 2009-01-06 10:43:53.000000000 -1000
+++ dhcp-4.1.0/includes/dhcpd.h 2009-01-06 10:43:53.000000000 -1000
@@ -1215,6 +1215,7 @@ struct interface_info {
int dlpi_sap_length;
struct hardware dlpi_broadcast_addr;
# endif /* DLPI_SEND || DLPI_RECEIVE */
+ struct hardware anycast_mac_addr;
};
struct hardware_link {
diff -up dhcp-4.1.0/includes/dhctoken.h.anycast dhcp-4.1.0/includes/dhctoken.h
--- dhcp-4.1.0/includes/dhctoken.h.anycast 2009-01-06 10:43:52.000000000 -1000
+++ dhcp-4.1.0/includes/dhctoken.h 2009-01-06 10:49:12.000000000 -1000
@@ -353,7 +353,8 @@ enum dhcp_token {
TEMPORARY = 656,
PREFIX6 = 657,
FIXED_PREFIX6 = 658,
- BOOTP_BROADCAST_ALWAYS = 659
+ BOOTP_BROADCAST_ALWAYS = 659,
+ ANYCAST_MAC = 660
};
#define is_identifier(x) ((x) >= FIRST_TOKEN && \

View File

@ -1,7 +1,7 @@
diff -up dhcp-4.0.0//client/dhclient.c.backoff dhcp-4.0.0//client/dhclient.c diff -up dhcp-4.1.0/client/dhclient.c.backoff dhcp-4.1.0/client/dhclient.c
--- dhcp-4.0.0//client/dhclient.c.backoff 2008-08-01 10:09:17.000000000 -1000 --- dhcp-4.1.0/client/dhclient.c.backoff 2009-01-06 10:08:07.000000000 -1000
+++ dhcp-4.0.0//client/dhclient.c 2008-08-01 10:10:10.000000000 -1000 +++ dhcp-4.1.0/client/dhclient.c 2009-01-06 10:10:27.000000000 -1000
@@ -1003,6 +1003,7 @@ void state_init (cpp) @@ -1185,6 +1185,7 @@ void state_init (cpp)
void *cpp; void *cpp;
{ {
struct client_state *client = cpp; struct client_state *client = cpp;
@ -9,7 +9,7 @@ diff -up dhcp-4.0.0//client/dhclient.c.backoff dhcp-4.0.0//client/dhclient.c
ASSERT_STATE(state, S_INIT); ASSERT_STATE(state, S_INIT);
@@ -1015,9 +1016,16 @@ void state_init (cpp) @@ -1197,9 +1198,16 @@ void state_init (cpp)
client -> first_sending = cur_time; client -> first_sending = cur_time;
client -> interval = client -> config -> initial_interval; client -> interval = client -> config -> initial_interval;
@ -28,8 +28,8 @@ diff -up dhcp-4.0.0//client/dhclient.c.backoff dhcp-4.0.0//client/dhclient.c
+ } + }
} }
/* state_selecting is called when one or more DHCPOFFER packets have been /*
@@ -1284,6 +1292,7 @@ void bind_lease (client) @@ -1478,6 +1486,7 @@ void bind_lease (client)
send_decline (client); send_decline (client);
destroy_client_lease (client -> new); destroy_client_lease (client -> new);
client -> new = (struct client_lease *)0; client -> new = (struct client_lease *)0;
@ -37,7 +37,7 @@ diff -up dhcp-4.0.0//client/dhclient.c.backoff dhcp-4.0.0//client/dhclient.c
state_init (client); state_init (client);
return; return;
} }
@@ -3439,6 +3448,7 @@ void client_location_changed () @@ -3680,6 +3689,7 @@ void client_location_changed ()
case S_INIT: case S_INIT:
case S_REBINDING: case S_REBINDING:
case S_STOPPED: case S_STOPPED:
@ -45,10 +45,10 @@ diff -up dhcp-4.0.0//client/dhclient.c.backoff dhcp-4.0.0//client/dhclient.c
break; break;
} }
client -> state = S_INIT; client -> state = S_INIT;
diff -up dhcp-4.0.0//includes/dhcpd.h.backoff dhcp-4.0.0//includes/dhcpd.h diff -up dhcp-4.1.0/includes/dhcpd.h.backoff dhcp-4.1.0/includes/dhcpd.h
--- dhcp-4.0.0//includes/dhcpd.h.backoff 2008-08-01 10:09:01.000000000 -1000 --- dhcp-4.1.0/includes/dhcpd.h.backoff 2009-01-06 10:08:07.000000000 -1000
+++ dhcp-4.0.0//includes/dhcpd.h 2008-08-01 10:10:10.000000000 -1000 +++ dhcp-4.1.0/includes/dhcpd.h 2009-01-06 10:08:07.000000000 -1000
@@ -992,7 +992,8 @@ enum dhcp_state { @@ -1016,7 +1016,8 @@ enum dhcp_state {
S_BOUND = 5, S_BOUND = 5,
S_RENEWING = 6, S_RENEWING = 6,
S_REBINDING = 7, S_REBINDING = 7,

View File

@ -0,0 +1,14 @@
diff -up dhcp-4.1.0/client/dhclient.c.usage dhcp-4.1.0/client/dhclient.c
--- dhcp-4.1.0/client/dhclient.c.usage 2009-01-06 10:36:55.000000000 -1000
+++ dhcp-4.1.0/client/dhclient.c 2009-01-06 10:39:58.000000000 -1000
@@ -990,6 +990,10 @@ static void usage()
"[-s server]");
log_error(" [-cf config-file] [-lf lease-file]%s",
"[-pf pid-file] [-e VAR=val]");
+ log_error(" [-I <dhcp-client-identifier>] [-B]");
+ log_error(" [-H <host-name> | -F <fqdn.fqdn>] [-timeout <timeout>]");
+ log_error(" [-V <vendor-class-identifier>]");
+ log_error(" [-R <request option list>]");
log_fatal(" [-sf script-file] [interface]");
}

View File

@ -1,6 +1,6 @@
diff -up dhcp-4.0.0//omapip/errwarn.c.errwarn dhcp-4.0.0//omapip/errwarn.c diff -up dhcp-4.1.0/omapip/errwarn.c.errwarn dhcp-4.1.0/omapip/errwarn.c
--- dhcp-4.0.0//omapip/errwarn.c.errwarn 2007-07-12 20:43:42.000000000 -1000 --- dhcp-4.1.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 +++ dhcp-4.1.0/omapip/errwarn.c 2009-01-06 07:02:20.000000000 -1000
@@ -76,20 +76,13 @@ void log_fatal (const char * fmt, ... ) @@ -76,20 +76,13 @@ void log_fatal (const char * fmt, ... )
#if !defined (NOMINUM) #if !defined (NOMINUM)

View File

@ -1,7 +1,7 @@
diff -up dhcp-4.0.0//server/confpars.c.failover dhcp-4.0.0//server/confpars.c diff -up dhcp-4.1.0/server/confpars.c.failover dhcp-4.1.0/server/confpars.c
--- dhcp-4.0.0//server/confpars.c.failover 2008-08-01 10:07:46.000000000 -1000 --- dhcp-4.1.0/server/confpars.c.failover 2009-01-06 10:24:38.000000000 -1000
+++ dhcp-4.0.0//server/confpars.c 2008-08-01 10:14:03.000000000 -1000 +++ dhcp-4.1.0/server/confpars.c 2009-01-06 10:24:38.000000000 -1000
@@ -1065,10 +1065,17 @@ void parse_failover_peer (cfile, group, @@ -1142,10 +1142,17 @@ void parse_failover_peer (cfile, group,
parse_warn (cfile, "peer address may not be omitted"); parse_warn (cfile, "peer address may not be omitted");
/* XXX - when/if we get a port number assigned, just set as default */ /* XXX - when/if we get a port number assigned, just set as default */

View File

@ -1,7 +1,7 @@
diff -up dhcp-4.0.0//common/tables.c.garbage dhcp-4.0.0//common/tables.c diff -up dhcp-4.1.0/common/tables.c.garbage dhcp-4.1.0/common/tables.c
--- dhcp-4.0.0//common/tables.c.garbage 2007-12-03 09:10:19.000000000 -1000 --- dhcp-4.1.0/common/tables.c.garbage 2008-01-23 16:43:04.000000000 -1000
+++ dhcp-4.0.0//common/tables.c 2008-08-05 14:59:08.000000000 -1000 +++ dhcp-4.1.0/common/tables.c 2009-01-06 12:09:41.000000000 -1000
@@ -201,7 +201,7 @@ static struct option dhcp_options[] = { @@ -207,7 +207,7 @@ static struct option dhcp_options[] = {
{ "netinfo-server-tag", "t", &dhcp_universe, 113, 1 }, { "netinfo-server-tag", "t", &dhcp_universe, 113, 1 },
{ "default-url", "t", &dhcp_universe, 114, 1 }, { "default-url", "t", &dhcp_universe, 114, 1 },
{ "subnet-selection", "I", &dhcp_universe, 118, 1 }, { "subnet-selection", "I", &dhcp_universe, 118, 1 },

View File

@ -1,7 +1,7 @@
diff -up dhcp-4.0.0/client/dhclient.c.inherit dhcp-4.0.0/client/dhclient.c diff -up dhcp-4.1.0/client/dhclient.c.inherit dhcp-4.1.0/client/dhclient.c
--- dhcp-4.0.0/client/dhclient.c.inherit 2008-08-01 11:34:29.000000000 -1000 --- dhcp-4.1.0/client/dhclient.c.inherit 2009-01-06 12:08:56.000000000 -1000
+++ dhcp-4.0.0/client/dhclient.c 2008-08-01 11:34:42.000000000 -1000 +++ dhcp-4.1.0/client/dhclient.c 2009-01-06 12:08:57.000000000 -1000
@@ -2296,6 +2296,7 @@ void send_request (cpp) @@ -2299,6 +2299,7 @@ void send_request (cpp)
{ {
struct client_state *client = cpp; struct client_state *client = cpp;
@ -9,7 +9,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.inherit dhcp-4.0.0/client/dhclient.c
int result; int result;
int interval; int interval;
struct sockaddr_in destination; struct sockaddr_in destination;
@@ -2354,6 +2355,22 @@ void send_request (cpp) @@ -2358,6 +2359,22 @@ void send_request (cpp)
/* Now do a preinit on the interface so that we can /* Now do a preinit on the interface so that we can
discover a new address. */ discover a new address. */
script_init (client, "PREINIT", (struct string_list *)0); script_init (client, "PREINIT", (struct string_list *)0);

View File

@ -1,6 +1,6 @@
diff -up dhcp-4.0.0/client/dhclient.conf.invalid dhcp-4.0.0/client/dhclient.conf diff -up dhcp-4.1.0/client/dhclient.conf.supersede dhcp-4.1.0/client/dhclient.conf
--- dhcp-4.0.0/client/dhclient.conf.invalid 1997-06-02 12:50:44.000000000 -1000 --- dhcp-4.1.0/client/dhclient.conf.supersede 1997-06-02 12:50:44.000000000 -1000
+++ dhcp-4.0.0/client/dhclient.conf 2008-10-23 10:01:58.000000000 -1000 +++ dhcp-4.1.0/client/dhclient.conf 2009-01-06 12:27:08.000000000 -1000
@@ -1,10 +1,10 @@ @@ -1,10 +1,10 @@
send host-name "andare.fugue.com"; send host-name "andare.fugue.com";
send dhcp-client-identifier 1:0:a0:24:ab:fb:9c; send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;

View File

@ -1,41 +1,377 @@
diff -up dhcp-4.0.0/server/Makefile.am.ldap dhcp-4.0.0/server/Makefile.am diff -up dhcp-4.1.0/common/conflex.c.ldap dhcp-4.1.0/common/conflex.c
--- dhcp-4.0.0/server/Makefile.am.ldap 2007-05-29 06:32:11.000000000 -1000 --- dhcp-4.1.0/common/conflex.c.ldap 2008-03-07 10:12:44.000000000 -1000
+++ dhcp-4.0.0/server/Makefile.am 2008-02-06 14:34:44.000000000 -1000 +++ dhcp-4.1.0/common/conflex.c 2009-01-06 07:03:13.000000000 -1000
@@ -4,12 +4,10 @@ dist_sysconf_DATA = dhcpd.conf @@ -43,6 +43,7 @@ static enum dhcp_token read_string PROTO
sbin_PROGRAMS = dhcpd static enum dhcp_token read_number PROTO ((int, struct parse *));
dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \ static enum dhcp_token read_num_or_name PROTO ((int, struct parse *));
omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c \ static enum dhcp_token intern PROTO ((char *, enum dhcp_token));
- dhcpv6.c mdb6.c +static int read_function PROTO ((struct parse *));
+ dhcpv6.c mdb6.c ldap.c ldap_casa.c
-# libomapi.a this is here twice to handle circular library dependencies :( isc_result_t new_parse (cfile, file, inbuf, buflen, name, eolp)
-dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a ../dst/libdst.a \ struct parse **cfile;
- ../dhcpctl/libdhcpctl.a ../minires/libres.a \ @@ -73,6 +74,10 @@ isc_result_t new_parse (cfile, file, inb
- ../omapip/libomapi.a tmp->file = file;
+dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a ../minires/libres.a \ tmp->eol_token = eolp;
+ ../dhcpctl/libdhcpctl.a ../dst/libdstnomd5.a -lldap
man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5 + if (file != -1) {
EXTRA_DIST = $(man_MANS) + tmp -> read_function = read_function;
diff -up dhcp-4.0.0/server/mdb.c.ldap dhcp-4.0.0/server/mdb.c + }
--- dhcp-4.0.0/server/mdb.c.ldap 2007-11-30 11:51:43.000000000 -1000
+++ dhcp-4.0.0/server/mdb.c 2008-02-06 14:34:44.000000000 -1000
@@ -600,6 +600,12 @@ int find_hosts_by_haddr (struct host_dec
const char *file, int line)
{
struct hardware h;
+ int ret;
+ +
if (inbuf != NULL) {
tmp->inbuf = inbuf;
tmp->buflen = buflen;
@@ -177,9 +182,13 @@ static int get_char (cfile)
/* My kingdom for WITH... */
int c;
- if (cfile->bufix == cfile->buflen)
- c = EOF;
- else {
+ if (cfile->bufix == cfile->buflen) {
+ if (cfile -> read_function) {
+ c = cfile -> read_function (cfile);
+ } else {
+ c = EOF;
+ }
+ } else {
c = cfile->inbuf [cfile->bufix];
cfile->bufix++;
}
@@ -1443,3 +1452,25 @@ intern(char *atom, enum dhcp_token dfv)
}
return dfv;
}
+
+static int
+read_function (struct parse * cfile)
+{
+ int c;
+
+ ssize_t n = read (cfile -> file, cfile -> inbuf, cfile -> bufsiz);
+ if (n == 0) {
+ c = EOF;
+ cfile -> bufix = 0;
+ cfile -> buflen = 0;
+ } else if (n < 0) {
+ c = EOF;
+ cfile -> bufix = cfile -> buflen = 0;
+ } else {
+ c = cfile -> inbuf [0];
+ cfile -> bufix = 1;
+ cfile -> buflen = n;
+ }
+
+ return c;
+}
diff -up dhcp-4.1.0/common/print.c.ldap dhcp-4.1.0/common/print.c
--- dhcp-4.1.0/common/print.c.ldap 2007-10-01 04:47:35.000000000 -1000
+++ dhcp-4.1.0/common/print.c 2009-01-06 07:03:13.000000000 -1000
@@ -163,9 +163,9 @@ char *print_base64 (const unsigned char
}
char *print_hw_addr (htype, hlen, data)
- int htype;
- int hlen;
- unsigned char *data;
+ const int htype;
+ const int hlen;
+ const unsigned char *data;
{
static char habuf [49];
char *s;
diff -up dhcp-4.1.0/dst/Makefile.am.ldap dhcp-4.1.0/dst/Makefile.am
--- dhcp-4.1.0/dst/Makefile.am.ldap 2007-05-29 06:32:10.000000000 -1000
+++ dhcp-4.1.0/dst/Makefile.am 2009-01-06 07:03:13.000000000 -1000
@@ -2,7 +2,12 @@ AM_CPPFLAGS = -DMINIRES_LIB -DHMAC_MD5
lib_LIBRARIES = libdst.a
+noinst_LIBRARIES = libdstnomd5.a
+
libdst_a_SOURCES = dst_support.c dst_api.c hmac_link.c md5_dgst.c \
base64.c prandom.c
+libdstnomd5_a_SOURCES = dst_support.c dst_api.c hmac_link.c \
+ base64.c prandom.c
+
EXTRA_DIST = dst_internal.h md5.h md5_locl.h
diff -up dhcp-4.1.0/includes/dhcpd.h.ldap dhcp-4.1.0/includes/dhcpd.h
--- dhcp-4.1.0/includes/dhcpd.h.ldap 2008-08-29 07:48:57.000000000 -1000
+++ dhcp-4.1.0/includes/dhcpd.h 2009-01-06 07:03:13.000000000 -1000
@@ -102,6 +102,11 @@ typedef time_t TIME;
#include <isc-dhcp/result.h>
#include <omapip/omapip_p.h>
+#if defined(LDAP_CONFIGURATION) +#if defined(LDAP_CONFIGURATION)
+ if ((ret = find_haddr_in_ldap (hp, htype, hlen, haddr, file, line))) +# include <ldap.h>
+ return ret; +# include <sys/utsname.h> /* for uname() */
+#endif
+
#if !defined (BYTE_NAME_HASH_SIZE)
# define BYTE_NAME_HASH_SIZE 401 /* Default would be ridiculous. */
#endif
@@ -291,6 +296,8 @@ struct parse {
size_t bufsiz;
struct parse *saved_state;
+
+ int (*read_function) (struct parse *);
};
/* Variable-length array of data. */
@@ -422,6 +429,32 @@ struct hardware {
u_int8_t hbuf [17];
};
+#if defined(LDAP_CONFIGURATION)
+# define LDAP_BUFFER_SIZE 8192
+# define LDAP_METHOD_STATIC 0
+# define LDAP_METHOD_DYNAMIC 1
+#if defined (USE_SSL)
+# define LDAP_SSL_OFF 0
+# define LDAP_SSL_ON 1
+# define LDAP_SSL_TLS 2
+# define LDAP_SSL_LDAPS 3
+#endif
+
+/* This is a tree of the current configuration we are building from LDAP */
+struct ldap_config_stack {
+ LDAPMessage * res; /* Pointer returned from ldap_search */
+ LDAPMessage * ldent; /* Current item in LDAP that we're processing.
+ in res */
+ int close_brace; /* Put a closing } after we're through with
+ this item */
+ int processed; /* We set this flag if this base item has been
+ processed. After this base item is processed,
+ we can start processing the children */
+ struct ldap_config_stack *children;
+ struct ldap_config_stack *next;
+};
+#endif
+
typedef enum {
server_startup = 0,
server_running = 1,
@@ -642,6 +675,29 @@ struct lease_state {
# define DEFAULT_ACK_DELAY_USECS 250000 /* 1/4 of a second */
#endif
+#if defined(LDAP_CONFIGURATION)
+# define SV_LDAP_SERVER 57
+# define SV_LDAP_PORT 58
+# define SV_LDAP_USERNAME 59
+# define SV_LDAP_PASSWORD 60
+# define SV_LDAP_BASE_DN 61
+# define SV_LDAP_METHOD 62
+# define SV_LDAP_DEBUG_FILE 63
+# define SV_LDAP_DHCP_SERVER_CN 64
+# define SV_LDAP_REFERRALS 65
+#if defined (USE_SSL)
+# define SV_LDAP_SSL 66
+# define SV_LDAP_TLS_REQCERT 67
+# define SV_LDAP_TLS_CA_FILE 68
+# define SV_LDAP_TLS_CA_DIR 69
+# define SV_LDAP_TLS_CERT 70
+# define SV_LDAP_TLS_KEY 71
+# define SV_LDAP_TLS_CRLCHECK 72
+# define SV_LDAP_TLS_CIPHERS 73
+# define SV_LDAP_TLS_RANDFILE 74
+#endif
+#endif
+
#if !defined (DEFAULT_DEFAULT_LEASE_TIME)
# define DEFAULT_DEFAULT_LEASE_TIME 43200
#endif
@@ -2107,7 +2163,7 @@ extern int db_time_format;
char *quotify_string (const char *, const char *, int);
char *quotify_buf (const unsigned char *, unsigned, const char *, int);
char *print_base64 (const unsigned char *, unsigned, const char *, int);
-char *print_hw_addr PROTO ((int, int, unsigned char *));
+char *print_hw_addr PROTO ((const int, const int, const unsigned char *));
void print_lease PROTO ((struct lease *));
void dump_raw PROTO ((const unsigned char *, unsigned));
void dump_packet_option (struct option_cache *, struct packet *,
@@ -3228,6 +3284,20 @@ OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_l
const char *binding_state_print (enum failover_state);
+/* ldap.c */
+#if defined(LDAP_CONFIGURATION)
+extern struct enumeration ldap_methods;
+#if defined (USE_SSL)
+extern struct enumeration ldap_ssl_usage_enum;
+extern struct enumeration ldap_tls_reqcert_enum;
+extern struct enumeration ldap_tls_crlcheck_enum;
+#endif
+isc_result_t ldap_read_config (void);
+int find_haddr_in_ldap (struct host_decl **, int, unsigned,
+ const unsigned char *, const char *, int);
+int find_subclass_in_ldap (struct class *, struct class **,
+ struct data_string *);
+#endif +#endif
h.hlen = hlen + 1; /* mdb6.c */
h.hbuf [0] = htype; HASH_FUNCTIONS_DECL(ia, unsigned char *, struct ia_xx, ia_hash_t);
diff -up /dev/null dhcp-4.0.0/server/ldap_casa.c diff -up /dev/null dhcp-4.1.0/includes/ldap_casa.h
--- /dev/null 2008-02-04 11:13:29.142014072 -1000 --- /dev/null 2009-01-06 04:53:53.119052255 -1000
+++ dhcp-4.0.0/server/ldap_casa.c 2008-02-06 14:34:44.000000000 -1000 +++ dhcp-4.1.0/includes/ldap_casa.h 2009-01-06 07:03:13.000000000 -1000
@@ -0,0 +1,83 @@
+/* ldap_casa.h
+
+ Definition for CASA modules... */
+
+/* Copyright (c) 2004 Internet Systems Consorium, Inc. ("ISC")
+ * Copyright (c) 1995-2003 Internet Software Consortium.
+ * Copyright (c) 2006 Novell, Inc.
+
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1.Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2.Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3.Neither the name of ISC, ISC DHCP, nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+
+ * THIS SOFTWARE IS PROVIDED BY INTERNET SYSTEMS CONSORTIUM AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ISC OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+
+ * This file was written by S Kalyanasundaram <skalyanasundaram@novell.com>
+ */
+
+#if defined(LDAP_CASA_AUTH)
+#ifndef __LDAP_CASA_H__
+#define __LDAP_CASA_H__
+
+#include <micasa_mgmd.h>
+#include <dlfcn.h>
+#include <string.h>
+
+#define MICASA_LIB "libmicasa.so.1"
+
+SSCS_TYPEDEF_LIBCALL(int, CASA_GetCredential_T)
+(
+ uint32_t ssFlags,
+ SSCS_SECRET_ID_T *appSecretID,
+ SSCS_SECRET_ID_T *sharedSecretID,
+ uint32_t *credentialType,
+ void *credential,
+ SSCS_EXT_T *ext
+);
+SSCS_TYPEDEF_LIBCALL(int, CASA_SetCredential_T)
+(
+ uint32_t ssFlags,
+ SSCS_SECRET_ID_T *appSecretID,
+ SSCS_SECRET_ID_T *sharedSecretID,
+ uint32_t credentialType,
+ void *credential,
+ SSCS_EXT_T *ext
+);
+
+SSCS_TYPEDEF_LIBCALL(int, CASA_RemoveCredential_T)
+(
+ uint32_t ssFlags,
+ SSCS_SECRET_ID_T *appSecretID,
+ SSCS_SECRET_ID_T *sharedSecretID,
+ SSCS_EXT_T *ext
+);
+static CASA_GetCredential_T p_miCASAGetCredential = NULL;
+static CASA_SetCredential_T p_miCASASetCredential = NULL;
+static CASA_RemoveCredential_T p_miCASARemoveCredential = NULL;
+static void *casaIDK = NULL;
+
+int load_casa(void);
+static void release_casa(void);
+int load_uname_pwd_from_miCASA(char **, char **);
+
+#endif /* __LDAP_CASA_H__ */
+#endif /* LDAP_CASA_AUTH */
+
diff -up dhcp-4.1.0/server/class.c.ldap dhcp-4.1.0/server/class.c
--- dhcp-4.1.0/server/class.c.ldap 2007-09-05 07:32:10.000000000 -1000
+++ dhcp-4.1.0/server/class.c 2009-01-06 07:03:13.000000000 -1000
@@ -84,6 +84,7 @@ int check_collection (packet, lease, col
int matched = 0;
int status;
int ignorep;
+ int classfound;
for (class = collection -> classes; class; class = class -> nic) {
#if defined (DEBUG_CLASS_MATCHING)
@@ -129,9 +130,15 @@ int check_collection (packet, lease, col
class -> submatch, MDL));
if (status && data.len) {
nc = (struct class *)0;
- if (class_hash_lookup (&nc, class -> hash,
- (const char *)data.data,
- data.len, MDL)) {
+ classfound = class_hash_lookup (&nc, class -> hash,
+ (const char *)data.data, data.len, MDL);
+
+#ifdef LDAP_CONFIGURATION
+ if (!classfound && find_subclass_in_ldap (class, &nc, &data))
+ classfound = 1;
+#endif
+
+ if (classfound) {
#if defined (DEBUG_CLASS_MATCHING)
log_info ("matches subclass %s.",
print_hex_1 (data.len,
diff -up dhcp-4.1.0/server/confpars.c.ldap dhcp-4.1.0/server/confpars.c
--- dhcp-4.1.0/server/confpars.c.ldap 2008-10-22 01:41:57.000000000 -1000
+++ dhcp-4.1.0/server/confpars.c 2009-01-06 07:03:13.000000000 -1000
@@ -61,7 +61,17 @@ void parse_trace_setup ()
isc_result_t readconf ()
{
- return read_conf_file (path_dhcpd_conf, root_group, ROOT_GROUP, 0);
+ isc_result_t res;
+
+ res = read_conf_file (path_dhcpd_conf, root_group, ROOT_GROUP, 0);
+#if defined(LDAP_CONFIGURATION)
+ if (res != ISC_R_SUCCESS)
+ return (res);
+
+ return ldap_read_config ();
+#else
+ return (res);
+#endif
}
isc_result_t read_conf_file (const char *filename, struct group *group,
diff -up dhcp-4.1.0/server/dhcpd.c.ldap dhcp-4.1.0/server/dhcpd.c
--- dhcp-4.1.0/server/dhcpd.c.ldap 2008-03-18 08:28:14.000000000 -1000
+++ dhcp-4.1.0/server/dhcpd.c 2009-01-06 07:03:13.000000000 -1000
@@ -598,6 +598,14 @@ main(int argc, char **argv) {
/* Add the ddns update style enumeration prior to parsing. */
add_enumeration (&ddns_styles);
add_enumeration (&syslog_enum);
+#if defined (LDAP_CONFIGURATION)
+ add_enumeration (&ldap_methods);
+#if defined (USE_SSL)
+ add_enumeration (&ldap_ssl_usage_enum);
+ add_enumeration (&ldap_tls_reqcert_enum);
+ add_enumeration (&ldap_tls_crlcheck_enum);
+#endif
+#endif
if (!group_allocate (&root_group, MDL))
log_fatal ("Can't allocate root group!");
diff -up /dev/null dhcp-4.1.0/server/ldap_casa.c
--- /dev/null 2009-01-06 04:53:53.119052255 -1000
+++ dhcp-4.1.0/server/ldap_casa.c 2009-01-06 07:03:13.000000000 -1000
@@ -0,0 +1,138 @@ @@ -0,0 +1,138 @@
+/* ldap_casa.c +/* ldap_casa.c
+ +
@ -175,27 +511,9 @@ diff -up /dev/null dhcp-4.0.0/server/ldap_casa.c
+ +
+#endif /* LDAP_CASA_AUTH */ +#endif /* LDAP_CASA_AUTH */
+ +
diff -up dhcp-4.0.0/server/dhcpd.c.ldap dhcp-4.0.0/server/dhcpd.c diff -up /dev/null dhcp-4.1.0/server/ldap.c
--- dhcp-4.0.0/server/dhcpd.c.ldap 2007-11-30 11:51:43.000000000 -1000 --- /dev/null 2009-01-06 04:53:53.119052255 -1000
+++ dhcp-4.0.0/server/dhcpd.c 2008-02-06 14:34:44.000000000 -1000 +++ dhcp-4.1.0/server/ldap.c 2009-01-06 07:03:13.000000000 -1000
@@ -505,6 +505,14 @@ main(int argc, char **argv) {
/* Add the ddns update style enumeration prior to parsing. */
add_enumeration (&ddns_styles);
add_enumeration (&syslog_enum);
+#if defined (LDAP_CONFIGURATION)
+ add_enumeration (&ldap_methods);
+#if defined (USE_SSL)
+ add_enumeration (&ldap_ssl_usage_enum);
+ add_enumeration (&ldap_tls_reqcert_enum);
+ add_enumeration (&ldap_tls_crlcheck_enum);
+#endif
+#endif
if (!group_allocate (&root_group, MDL))
log_fatal ("Can't allocate root group!");
diff -up /dev/null dhcp-4.0.0/server/ldap.c
--- /dev/null 2008-02-04 11:13:29.142014072 -1000
+++ dhcp-4.0.0/server/ldap.c 2008-02-06 14:35:19.000000000 -1000
@@ -0,0 +1,2004 @@ @@ -0,0 +1,2004 @@
+/* ldap.c +/* ldap.c
+ +
@ -2201,106 +2519,89 @@ diff -up /dev/null dhcp-4.0.0/server/ldap.c
+} +}
+ +
+#endif +#endif
diff -up dhcp-4.0.0/server/confpars.c.ldap dhcp-4.0.0/server/confpars.c diff -up dhcp-4.1.0/server/Makefile.am.ldap dhcp-4.1.0/server/Makefile.am
--- dhcp-4.0.0/server/confpars.c.ldap 2007-11-30 11:51:43.000000000 -1000 --- dhcp-4.1.0/server/Makefile.am.ldap 2007-05-29 06:32:11.000000000 -1000
+++ dhcp-4.0.0/server/confpars.c 2008-02-06 14:34:44.000000000 -1000 +++ dhcp-4.1.0/server/Makefile.am 2009-01-06 07:03:12.000000000 -1000
@@ -60,7 +60,17 @@ void parse_trace_setup () @@ -4,12 +4,10 @@ dist_sysconf_DATA = dhcpd.conf
sbin_PROGRAMS = dhcpd
dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \
omapi.c mdb.c stables.c salloc.c ddns.c dhcpleasequery.c \
- dhcpv6.c mdb6.c
+ dhcpv6.c mdb6.c ldap.c ldap_casa.c
isc_result_t readconf () -# libomapi.a this is here twice to handle circular library dependencies :(
-dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a ../dst/libdst.a \
- ../dhcpctl/libdhcpctl.a ../minires/libres.a \
- ../omapip/libomapi.a
+dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a ../minires/libres.a \
+ ../dhcpctl/libdhcpctl.a ../dst/libdstnomd5.a -lldap
man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5
EXTRA_DIST = $(man_MANS)
diff -up dhcp-4.1.0/server/mdb.c.ldap dhcp-4.1.0/server/mdb.c
--- dhcp-4.1.0/server/mdb.c.ldap 2008-02-28 11:21:56.000000000 -1000
+++ dhcp-4.1.0/server/mdb.c 2009-01-06 07:03:13.000000000 -1000
@@ -600,6 +600,12 @@ int find_hosts_by_haddr (struct host_dec
const char *file, int line)
{ {
- return read_conf_file (path_dhcpd_conf, root_group, ROOT_GROUP, 0); struct hardware h;
+ isc_result_t res; + int ret;
+ +
+ res = read_conf_file (path_dhcpd_conf, root_group, ROOT_GROUP, 0);
+#if defined(LDAP_CONFIGURATION) +#if defined(LDAP_CONFIGURATION)
+ if (res != ISC_R_SUCCESS) + if ((ret = find_haddr_in_ldap (hp, htype, hlen, haddr, file, line)))
+ return (res); + return ret;
+
+ return ldap_read_config ();
+#else
+ return (res);
+#endif +#endif
}
isc_result_t read_conf_file (const char *filename, struct group *group, h.hlen = hlen + 1;
diff -up dhcp-4.0.0/server/class.c.ldap dhcp-4.0.0/server/class.c h.hbuf [0] = htype;
--- dhcp-4.0.0/server/class.c.ldap 2007-09-05 07:32:10.000000000 -1000 diff -up dhcp-4.1.0/server/stables.c.ldap dhcp-4.1.0/server/stables.c
+++ dhcp-4.0.0/server/class.c 2008-02-06 14:34:44.000000000 -1000 --- dhcp-4.1.0/server/stables.c.ldap 2008-11-03 08:13:58.000000000 -1000
@@ -84,6 +84,7 @@ int check_collection (packet, lease, col +++ dhcp-4.1.0/server/stables.c 2009-01-06 07:56:33.000000000 -1000
int matched = 0; @@ -244,9 +244,107 @@ static struct option server_options[] =
int status; { "delayed-ack", "S", &server_universe, 58, 1 },
int ignorep; { "max-ack-delay", "L", &server_universe, 59, 1 },
+ int classfound; #endif
for (class = collection -> classes; class; class = class -> nic) {
#if defined (DEBUG_CLASS_MATCHING)
@@ -129,9 +130,15 @@ int check_collection (packet, lease, col
class -> submatch, MDL));
if (status && data.len) {
nc = (struct class *)0;
- if (class_hash_lookup (&nc, class -> hash,
- (const char *)data.data,
- data.len, MDL)) {
+ classfound = class_hash_lookup (&nc, class -> hash,
+ (const char *)data.data, data.len, MDL);
+
+#ifdef LDAP_CONFIGURATION
+ if (!classfound && find_subclass_in_ldap (class, &nc, &data))
+ classfound = 1;
+#endif
+
+ if (classfound) {
#if defined (DEBUG_CLASS_MATCHING)
log_info ("matches subclass %s.",
print_hex_1 (data.len,
diff -up dhcp-4.0.0/server/stables.c.ldap dhcp-4.0.0/server/stables.c
--- dhcp-4.0.0/server/stables.c.ldap 2007-11-20 08:34:37.000000000 -1000
+++ dhcp-4.0.0/server/stables.c 2008-02-06 14:34:44.000000000 -1000
@@ -238,9 +238,107 @@ static struct option server_options[] =
{ "dhcpv6-lease-file-name", "t", &server_universe, 54, 1 },
{ "dhcpv6-pid-file-name", "t", &server_universe, 55, 1 },
{ "limit-addrs-per-ia", "L", &server_universe, 56, 1 },
+#if defined(LDAP_CONFIGURATION) +#if defined(LDAP_CONFIGURATION)
+ { "ldap-server", "t", &server_universe, 57, 1 }, + { "ldap-server", "t", &server_universe, 60, 1 },
+ { "ldap-port", "d", &server_universe, 58, 1 }, + { "ldap-port", "d", &server_universe, 61, 1 },
+ { "ldap-username", "t", &server_universe, 59, 1 }, + { "ldap-username", "t", &server_universe, 62, 1 },
+ { "ldap-password", "t", &server_universe, 60, 1 }, + { "ldap-password", "t", &server_universe, 63, 1 },
+ { "ldap-base-dn", "t", &server_universe, 61, 1 }, + { "ldap-base-dn", "t", &server_universe, 64, 1 },
+ { "ldap-method", "Nldap-methods.", &server_universe, 62, 1 }, + { "ldap-method", "Nldap-methods.", &server_universe, 65, 1 },
+ { "ldap-debug-file", "t", &server_universe, 63, 1 }, + { "ldap-debug-file", "t", &server_universe, 66, 1 },
+ { "ldap-dhcp-server-cn", "t", &server_universe, 64, 1 }, + { "ldap-dhcp-server-cn", "t", &server_universe, 67, 1 },
+ { "ldap-referrals", "f", &server_universe, 65, 1 }, + { "ldap-referrals", "f", &server_universe, 68, 1 },
+#if defined(USE_SSL) +#if defined(USE_SSL)
+ { "ldap-ssl", "Nldap-ssl-usage.", &server_universe, 66, 1 }, + { "ldap-ssl", "Nldap-ssl-usage.", &server_universe, 69, 1 },
+ { "ldap-tls-reqcert", "Nldap-tls-reqcert.", &server_universe, 67, 1 }, + { "ldap-tls-reqcert", "Nldap-tls-reqcert.", &server_universe, 70, 1 },
+ { "ldap-tls-ca-file", "t", &server_universe, 68, 1 }, + { "ldap-tls-ca-file", "t", &server_universe, 71, 1 },
+ { "ldap-tls-ca-dir", "t", &server_universe, 69, 1 }, + { "ldap-tls-ca-dir", "t", &server_universe, 72, 1 },
+ { "ldap-tls-cert", "t", &server_universe, 70, 1 }, + { "ldap-tls-cert", "t", &server_universe, 73, 1 },
+ { "ldap-tls-key", "t", &server_universe, 71, 1 }, + { "ldap-tls-key", "t", &server_universe, 74, 1 },
+ { "ldap-tls-crlcheck", "Nldap-tls-crlcheck.", &server_universe, 72, 1 }, + { "ldap-tls-crlcheck", "Nldap-tls-crlcheck.", &server_universe, 75, 1 },
+ { "ldap-tls-ciphers", "t", &server_universe, 73, 1 }, + { "ldap-tls-ciphers", "t", &server_universe, 76, 1 },
+ { "ldap-tls-randfile", "t", &server_universe, 74, 1 }, + { "ldap-tls-randfile", "t", &server_universe, 77, 1 },
+#else +#else
+ { "unknown-66", "X", &server_universe, 66, 1 },
+ { "unknown-67", "X", &server_universe, 67, 1 },
+ { "unknown-68", "X", &server_universe, 68, 1 },
+ { "unknown-69", "X", &server_universe, 69, 1 }, + { "unknown-69", "X", &server_universe, 69, 1 },
+ { "unknown-70", "X", &server_universe, 70, 1 }, + { "unknown-70", "X", &server_universe, 70, 1 },
+ { "unknown-71", "X", &server_universe, 71, 1 }, + { "unknown-71", "X", &server_universe, 71, 1 },
+ { "unknown-72", "X", &server_universe, 72, 1 }, + { "unknown-72", "X", &server_universe, 72, 1 },
+ { "unknown-73", "X", &server_universe, 73, 1 }, + { "unknown-73", "X", &server_universe, 73, 1 },
+ { "unknown-74", "X", &server_universe, 74, 1 }, + { "unknown-74", "X", &server_universe, 74, 1 },
+ { "unknown-75", "X", &server_universe, 75, 1 },
+ { "unknown-76", "X", &server_universe, 76, 1 },
+ { "unknown-77", "X", &server_universe, 77, 1 },
+#endif +#endif
+#else +#else
+ { "unknown-57", "X", &server_universe, 57, 1 },
+ { "unknown-58", "X", &server_universe, 58, 1 },
+ { "unknown-59", "X", &server_universe, 59, 1 },
+ { "unknown-60", "X", &server_universe, 60, 1 }, + { "unknown-60", "X", &server_universe, 60, 1 },
+ { "unknown-61", "X", &server_universe, 61, 1 }, + { "unknown-61", "X", &server_universe, 61, 1 },
+ { "unknown-62", "X", &server_universe, 62, 1 }, + { "unknown-62", "X", &server_universe, 62, 1 },
+ { "unknown-63", "X", &server_universe, 63, 1 }, + { "unknown-63", "X", &server_universe, 63, 1 },
+ { "unknown-64", "X", &server_universe, 64, 1 }, + { "unknown-64", "X", &server_universe, 64, 1 },
+ { "unknown-65", "X", &server_universe, 65, 1 }, + { "unknown-65", "X", &server_universe, 65, 1 },
+ { "unknown-66", "X", &server_universe, 66, 1 },
+ { "unknown-67", "X", &server_universe, 67, 1 },
+ { "unknown-68", "X", &server_universe, 68, 1 },
+#endif +#endif
{ NULL, NULL, NULL, 0, 0 } { NULL, NULL, NULL, 0, 0 }
}; };
@ -2364,321 +2665,3 @@ diff -up dhcp-4.0.0/server/stables.c.ldap dhcp-4.0.0/server/stables.c
struct enumeration_value ddns_styles_values [] = { struct enumeration_value ddns_styles_values [] = {
{ "none", 0 }, { "none", 0 },
{ "ad-hoc", 1 }, { "ad-hoc", 1 },
diff -up dhcp-4.0.0/dst/Makefile.am.ldap dhcp-4.0.0/dst/Makefile.am
--- dhcp-4.0.0/dst/Makefile.am.ldap 2007-05-29 06:32:10.000000000 -1000
+++ dhcp-4.0.0/dst/Makefile.am 2008-02-06 14:34:44.000000000 -1000
@@ -2,7 +2,12 @@ AM_CPPFLAGS = -DMINIRES_LIB -DHMAC_MD5
lib_LIBRARIES = libdst.a
+noinst_LIBRARIES = libdstnomd5.a
+
libdst_a_SOURCES = dst_support.c dst_api.c hmac_link.c md5_dgst.c \
base64.c prandom.c
+libdstnomd5_a_SOURCES = dst_support.c dst_api.c hmac_link.c \
+ base64.c prandom.c
+
EXTRA_DIST = dst_internal.h md5.h md5_locl.h
diff -up dhcp-4.0.0/common/print.c.ldap dhcp-4.0.0/common/print.c
--- dhcp-4.0.0/common/print.c.ldap 2007-10-01 04:47:35.000000000 -1000
+++ dhcp-4.0.0/common/print.c 2008-02-06 14:34:44.000000000 -1000
@@ -163,9 +163,9 @@ char *print_base64 (const unsigned char
}
char *print_hw_addr (htype, hlen, data)
- int htype;
- int hlen;
- unsigned char *data;
+ const int htype;
+ const int hlen;
+ const unsigned char *data;
{
static char habuf [49];
char *s;
diff -up dhcp-4.0.0/common/conflex.c.ldap dhcp-4.0.0/common/conflex.c
--- dhcp-4.0.0/common/conflex.c.ldap 2007-10-31 09:13:33.000000000 -1000
+++ dhcp-4.0.0/common/conflex.c 2008-02-06 14:34:44.000000000 -1000
@@ -43,6 +43,7 @@ static enum dhcp_token read_string PROTO
static enum dhcp_token read_number PROTO ((int, struct parse *));
static enum dhcp_token read_num_or_name PROTO ((int, struct parse *));
static enum dhcp_token intern PROTO ((char *, enum dhcp_token));
+static int read_function PROTO ((struct parse *));
isc_result_t new_parse (cfile, file, inbuf, buflen, name, eolp)
struct parse **cfile;
@@ -76,6 +77,10 @@ isc_result_t new_parse (cfile, file, inb
tmp->file = file;
tmp->eol_token = eolp;
+ if (file != -1) {
+ tmp -> read_function = read_function;
+ }
+
if (inbuf != NULL) {
tmp->inbuf = inbuf;
tmp->buflen = buflen;
@@ -170,9 +175,13 @@ static int get_char (cfile)
/* My kingdom for WITH... */
int c;
- if (cfile->bufix == cfile->buflen)
- c = EOF;
- else {
+ if (cfile->bufix == cfile->buflen) {
+ if (cfile -> read_function) {
+ c = cfile -> read_function (cfile);
+ } else {
+ c = EOF;
+ }
+ } else {
c = cfile->inbuf [cfile->bufix];
cfile->bufix++;
}
@@ -1415,3 +1424,25 @@ intern(char *atom, enum dhcp_token dfv)
}
return dfv;
}
+
+static int
+read_function (struct parse * cfile)
+{
+ int c;
+
+ ssize_t n = read (cfile -> file, cfile -> inbuf, cfile -> bufsiz);
+ if (n == 0) {
+ c = EOF;
+ cfile -> bufix = 0;
+ cfile -> buflen = 0;
+ } else if (n < 0) {
+ c = EOF;
+ cfile -> bufix = cfile -> buflen = 0;
+ } else {
+ c = cfile -> inbuf [0];
+ cfile -> bufix = 1;
+ cfile -> buflen = n;
+ }
+
+ return c;
+}
diff -up dhcp-4.0.0/includes/dhcpd.h.ldap dhcp-4.0.0/includes/dhcpd.h
--- dhcp-4.0.0/includes/dhcpd.h.ldap 2007-12-08 09:36:00.000000000 -1000
+++ dhcp-4.0.0/includes/dhcpd.h 2008-02-06 14:34:44.000000000 -1000
@@ -101,6 +101,11 @@ typedef time_t TIME;
#include <isc-dhcp/result.h>
#include <omapip/omapip_p.h>
+#if defined(LDAP_CONFIGURATION)
+# include <ldap.h>
+# include <sys/utsname.h> /* for uname() */
+#endif
+
#if !defined (BYTE_NAME_HASH_SIZE)
# define BYTE_NAME_HASH_SIZE 401 /* Default would be ridiculous. */
#endif
@@ -290,6 +295,8 @@ struct parse {
size_t bufsiz;
struct parse *saved_state;
+
+ int (*read_function) (struct parse *);
};
/* Variable-length array of data. */
@@ -421,6 +428,32 @@ struct hardware {
u_int8_t hbuf [17];
};
+#if defined(LDAP_CONFIGURATION)
+# define LDAP_BUFFER_SIZE 8192
+# define LDAP_METHOD_STATIC 0
+# define LDAP_METHOD_DYNAMIC 1
+#if defined (USE_SSL)
+# define LDAP_SSL_OFF 0
+# define LDAP_SSL_ON 1
+# define LDAP_SSL_TLS 2
+# define LDAP_SSL_LDAPS 3
+#endif
+
+/* This is a tree of the current configuration we are building from LDAP */
+struct ldap_config_stack {
+ LDAPMessage * res; /* Pointer returned from ldap_search */
+ LDAPMessage * ldent; /* Current item in LDAP that we're processing.
+ in res */
+ int close_brace; /* Put a closing } after we're through with
+ this item */
+ int processed; /* We set this flag if this base item has been
+ processed. After this base item is processed,
+ we can start processing the children */
+ struct ldap_config_stack *children;
+ struct ldap_config_stack *next;
+};
+#endif
+
typedef enum {
server_startup = 0,
server_running = 1,
@@ -626,6 +659,29 @@ struct lease_state {
# define DEFAULT_PING_TIMEOUT 1
#endif
+#if defined(LDAP_CONFIGURATION)
+# define SV_LDAP_SERVER 57
+# define SV_LDAP_PORT 58
+# define SV_LDAP_USERNAME 59
+# define SV_LDAP_PASSWORD 60
+# define SV_LDAP_BASE_DN 61
+# define SV_LDAP_METHOD 62
+# define SV_LDAP_DEBUG_FILE 63
+# define SV_LDAP_DHCP_SERVER_CN 64
+# define SV_LDAP_REFERRALS 65
+#if defined (USE_SSL)
+# define SV_LDAP_SSL 66
+# define SV_LDAP_TLS_REQCERT 67
+# define SV_LDAP_TLS_CA_FILE 68
+# define SV_LDAP_TLS_CA_DIR 69
+# define SV_LDAP_TLS_CERT 70
+# define SV_LDAP_TLS_KEY 71
+# define SV_LDAP_TLS_CRLCHECK 72
+# define SV_LDAP_TLS_CIPHERS 73
+# define SV_LDAP_TLS_RANDFILE 74
+#endif
+#endif
+
#if !defined (DEFAULT_DEFAULT_LEASE_TIME)
# define DEFAULT_DEFAULT_LEASE_TIME 43200
#endif
@@ -2035,7 +2091,7 @@ extern int db_time_format;
char *quotify_string (const char *, const char *, int);
char *quotify_buf (const unsigned char *, unsigned, const char *, int);
char *print_base64 (const unsigned char *, unsigned, const char *, int);
-char *print_hw_addr PROTO ((int, int, unsigned char *));
+char *print_hw_addr PROTO ((const int, const int, const unsigned char *));
void print_lease PROTO ((struct lease *));
void dump_raw PROTO ((const unsigned char *, unsigned));
void dump_packet_option (struct option_cache *, struct packet *,
@@ -3158,6 +3214,20 @@ OMAPI_OBJECT_ALLOC_DECL (dhcp_failover_l
const char *binding_state_print (enum failover_state);
+/* ldap.c */
+#if defined(LDAP_CONFIGURATION)
+extern struct enumeration ldap_methods;
+#if defined (USE_SSL)
+extern struct enumeration ldap_ssl_usage_enum;
+extern struct enumeration ldap_tls_reqcert_enum;
+extern struct enumeration ldap_tls_crlcheck_enum;
+#endif
+isc_result_t ldap_read_config (void);
+int find_haddr_in_ldap (struct host_decl **, int, unsigned,
+ const unsigned char *, const char *, int);
+int find_subclass_in_ldap (struct class *, struct class **,
+ struct data_string *);
+#endif
/* mdb6.c */
HASH_FUNCTIONS_DECL(ia_na, unsigned char *, struct ia_na, ia_na_hash_t);
diff -up dhcp-4.0.0/includes/site.h.ldap dhcp-4.0.0/includes/site.h
--- dhcp-4.0.0/includes/site.h.ldap 2006-07-31 12:19:51.000000000 -1000
+++ dhcp-4.0.0/includes/site.h 2008-02-06 14:34:44.000000000 -1000
@@ -183,3 +183,13 @@
traces. */
#define TRACING
+
+/* Define this if you want to read your config from LDAP. Read README.ldap
+ about how to set this up */
+
+#define LDAP_CONFIGURATION
+
+/* Define this if you want to enable LDAP over a SSL connection. You will need
+ to add -lcrypto -lssl to the LIBS= line of server/Makefile */
+
+#define USE_SSL
diff -up /dev/null dhcp-4.0.0/includes/ldap_casa.h
--- /dev/null 2008-02-04 11:13:29.142014072 -1000
+++ dhcp-4.0.0/includes/ldap_casa.h 2008-02-06 14:34:44.000000000 -1000
@@ -0,0 +1,83 @@
+/* ldap_casa.h
+
+ Definition for CASA modules... */
+
+/* Copyright (c) 2004 Internet Systems Consorium, Inc. ("ISC")
+ * Copyright (c) 1995-2003 Internet Software Consortium.
+ * Copyright (c) 2006 Novell, Inc.
+
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1.Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * 2.Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 3.Neither the name of ISC, ISC DHCP, nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+
+ * THIS SOFTWARE IS PROVIDED BY INTERNET SYSTEMS CONSORTIUM AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ISC OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+
+ * This file was written by S Kalyanasundaram <skalyanasundaram@novell.com>
+ */
+
+#if defined(LDAP_CASA_AUTH)
+#ifndef __LDAP_CASA_H__
+#define __LDAP_CASA_H__
+
+#include <micasa_mgmd.h>
+#include <dlfcn.h>
+#include <string.h>
+
+#define MICASA_LIB "libmicasa.so.1"
+
+SSCS_TYPEDEF_LIBCALL(int, CASA_GetCredential_T)
+(
+ uint32_t ssFlags,
+ SSCS_SECRET_ID_T *appSecretID,
+ SSCS_SECRET_ID_T *sharedSecretID,
+ uint32_t *credentialType,
+ void *credential,
+ SSCS_EXT_T *ext
+);
+SSCS_TYPEDEF_LIBCALL(int, CASA_SetCredential_T)
+(
+ uint32_t ssFlags,
+ SSCS_SECRET_ID_T *appSecretID,
+ SSCS_SECRET_ID_T *sharedSecretID,
+ uint32_t credentialType,
+ void *credential,
+ SSCS_EXT_T *ext
+);
+
+SSCS_TYPEDEF_LIBCALL(int, CASA_RemoveCredential_T)
+(
+ uint32_t ssFlags,
+ SSCS_SECRET_ID_T *appSecretID,
+ SSCS_SECRET_ID_T *sharedSecretID,
+ SSCS_EXT_T *ext
+);
+static CASA_GetCredential_T p_miCASAGetCredential = NULL;
+static CASA_SetCredential_T p_miCASASetCredential = NULL;
+static CASA_RemoveCredential_T p_miCASARemoveCredential = NULL;
+static void *casaIDK = NULL;
+
+int load_casa(void);
+static void release_casa(void);
+int load_uname_pwd_from_miCASA(char **, char **);
+
+#endif /* __LDAP_CASA_H__ */
+#endif /* LDAP_CASA_AUTH */
+

View File

@ -1,90 +1,7 @@
diff -up dhcp-4.0.0/client/dhclient-script.8.manpages dhcp-4.0.0/client/dhclient-script.8 diff -up dhcp-4.1.0/client/dhclient.8.man dhcp-4.1.0/client/dhclient.8
--- dhcp-4.0.0/client/dhclient-script.8.manpages 2006-02-24 13:16:27.000000000 -1000 --- dhcp-4.1.0/client/dhclient.8.man 2008-11-20 04:55:14.000000000 -1000
+++ dhcp-4.0.0/client/dhclient-script.8 2008-10-23 09:58:40.000000000 -1000 +++ dhcp-4.1.0/client/dhclient.8 2009-01-06 11:51:30.000000000 -1000
@@ -47,16 +47,16 @@ customizations are needed, they should b @@ -111,6 +111,33 @@ relay
exit hooks provided (see HOOKS for details). These hooks will allow the
user to override the default behaviour of the client in creating a
.B /etc/resolv.conf
-file.
+file, and to handle DHCP options not handled by default.
.PP
No standard client script exists for some operating systems, even though
the actual client may work, so a pioneering user may well need to create
a new script or modify an existing one. In general, customizations specific
to a particular computer should be done in the
-.B ETCDIR/dhclient.conf
+.B /usr/local/etc/dhclient.conf
file. If you find that you can't make such a customization without
customizing
-.B ETCDIR/dhclient.conf
+.B /usr/local/etc/dhclient.conf
or using the enter and exit hooks, please submit a bug report.
.SH HOOKS
When it starts, the client script first defines a shell function,
@@ -68,33 +68,53 @@ the enter hook script.
.PP
On after defining the make_resolv_conf function, the client script checks
for the presence of an executable
-.B ETCDIR/dhclient-enter-hooks
+.B /usr/local/etc/dhclient-enter-hooks
script, and if present, it invokes the script inline, using the Bourne
shell '.' command. The entire environment documented under OPERATION
is available to this script, which may modify the environment if needed
to change the behaviour of the script. If an error occurs during the
execution of the script, it can set the exit_status variable to a nonzero
value, and
-.B CLIENTBINDIR/dhclient-script
+.B /sbin/dhclient-script
will exit with that error code immediately after the client script exits.
.PP
After all processing has completed,
-.B CLIENTBINDIR/dhclient-script
+.B /sbin/dhclient-script
checks for the presence of an executable
-.B ETCDIR/dhclient-exit-hooks
+.B /usr/local/etc/dhclient-exit-hooks
script, which if present is invoked using the '.' command. The exit
status of dhclient-script will be passed to dhclient-exit-hooks in the
exit_status shell variable, and will always be zero if the script
succeeded at the task for which it was invoked. The rest of the
environment as described previously for dhclient-enter-hooks is also
present. The
-.B ETCDIR/dhclient-exit-hooks
+.B /usr/local/etc/dhclient-exit-hooks
script can modify the valid of exit_status to change the exit status
of dhclient-script.
+.PP
+Immediately after dhclient brings an interface UP with a new IP address,
+subnet mask, and routes, in the REBOOT/BOUND states, it will check for the
+existence of an executable
+.B /usr/local/etc/dhclient-up-hooks
+script, and source it if found. This script can handle DHCP options in
+the environment that are not handled by default. A per-interface.
+.B /usr/local/etc/dhclient-${IF}-up-hooks
+script will override the generic script and be sourced when interface
+$IF has been brought up.
+.PP
+Immediately before dhclient brings an interface DOWN, removing its IP
+address, subnet mask, and routes, in the STOP/RELEASE states, it will
+check for the existence of an executable
+.B /usr/local/etc/dhclient-down-hooks
+script, and source it if found. This script can handle DHCP options in
+the environment that are not handled by default. A per-interface
+.B /usr/local/etc/dhclient-${IF}-down-hooks
+script will override the generic script and be sourced when interface
+$IF is about to be brought down.
.SH OPERATION
When dhclient needs to invoke the client configuration script, it
defines a set of variables in the environment, and then invokes
-.B CLIENTBINDIR/dhclient-script.
+.B /sbin/dhclient-script.
In all cases, $reason is set to the name of the reason why the script
has been invoked. The following reasons are currently defined:
MEDIUM, PREINIT, BOUND, RENEW, REBIND, REBOOT, EXPIRE, FAIL, STOP, RELEASE,
diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
--- dhcp-4.0.0/client/dhclient.8.manpages 2007-10-04 07:13:25.000000000 -1000
+++ dhcp-4.0.0/client/dhclient.8 2008-10-23 09:58:40.000000000 -1000
@@ -91,6 +91,33 @@ relay
.B -w .B -w
] ]
[ [
@ -111,14 +28,14 @@ diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
+.I request-option-list +.I request-option-list
+] +]
+[ +[
+.B -T +.B -timeout
+.I timeout +.I timeout
+] +]
+[ +[
.B -v .B -v
] ]
[ [
@@ -118,16 +145,6 @@ important details about the network to w @@ -138,32 +165,6 @@ important details about the network to w
the location of a default router, the location of a name server, and the location of a default router, the location of a name server, and
so on. so on.
.PP .PP
@ -127,7 +44,23 @@ diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
-.PP -.PP
-If given the -6 command line argument, dhclient will use the DHCPv6 -If given the -6 command line argument, dhclient will use the DHCPv6
-protocol to obtain whatever IPv6 addresses are available along with -protocol to obtain whatever IPv6 addresses are available along with
-configuration parameters. Information-request is not yet supported. -configuration parameters. But with
-.B -S
-it uses Information-request to get only (i.e., without address)
-stateless configuration parameters.
-.PP
-The default DHCPv6 behavior is modified too with
-.B -T
-which asks for IPv6 temporary addresses, one set per
-.B -T
-flag.
-.B -P
-enables the IPv6 prefix delegation.
-As temporary addresses or prefix delegation disables the normal
-address query,
-.B -N
-restores it. Note it is not recommended to mix queries of different types
-together, or even to share the lease file between them.
-.PP -.PP
-If given the --version command line argument, dhclient will print its -If given the --version command line argument, dhclient will print its
-version number and exit. -version number and exit.
@ -135,7 +68,7 @@ diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
On startup, dhclient reads the On startup, dhclient reads the
.IR dhclient.conf .IR dhclient.conf
for configuration instructions. It then gets a list of all the for configuration instructions. It then gets a list of all the
@@ -181,67 +198,183 @@ file. If interfaces are specified in t @@ -217,141 +218,259 @@ file. If interfaces are specified in t
only configure interfaces that are either specified in the only configure interfaces that are either specified in the
configuration file or on the command line, and will ignore all other configuration file or on the command line, and will ignore all other
interfaces. interfaces.
@ -147,7 +80,7 @@ diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
-dhclient should use. This is mostly useful for debugging purposes. -dhclient should use. This is mostly useful for debugging purposes.
-If a different port is specified for the client to listen on and -If a different port is specified for the client to listen on and
-transmit on, the client will also use a different destination port - -transmit on, the client will also use a different destination port -
-one greater than the specified destination port. -one less than the specified port.
-.PP -.PP
-The DHCP client normally transmits any protocol messages it sends -The DHCP client normally transmits any protocol messages it sends
-before acquiring an IP address to, 255.255.255.255, the IP limited -before acquiring an IP address to, 255.255.255.255, the IP limited
@ -156,6 +89,7 @@ diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
-be specified with the -be specified with the
-.B -s -.B -s
-flag, followed by the IP address or domain name of the destination. -flag, followed by the IP address or domain name of the destination.
-This feature is not supported by DHCPv6.
-.PP -.PP
-For testing purposes, the giaddr field of all packets that the client -For testing purposes, the giaddr field of all packets that the client
-sends can be set using the -sends can be set using the
@ -196,17 +130,85 @@ diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
-The client normally doesn't release the current lease as it is not -The client normally doesn't release the current lease as it is not
-required by the DHCP protocol. Some cable ISPs require their clients -required by the DHCP protocol. Some cable ISPs require their clients
-to notify the server if they wish to release an assigned IP address. -to notify the server if they wish to release an assigned IP address.
-The
-.B -r
-flag explicitly releases the current lease, and once the lease has been
-released, the client exits.
-.PP
+.SH OPTIONS +.SH OPTIONS
+.TP +.TP
+.BI \-4 +.BI \-4
+Use the DHCPv4 protocol to obtain an IPv4 address and configuration +Use the DHCPv4 protocol to obtain an IPv4 address and configuration
+parameters. +parameters (default).
+ +
+.TP +.TP
+.BI \-6 +.BI \-6
+Use the DHCPv6 protocol to obtain whatever IPv6 addresses are available +Use the DHCPv6 protocol to obtain whatever IPv6 addresses are available
+along with configuration parameters. Information-request is not yet +along with configuration parameters. The functionality of DHCPv6 mode
+supported. +may be modified with the
+.BI \-S
+,
+.BI \-T
+, and
+.BI \-N
+options.
+
+.TP
+.BI \-S
+Perform an information-only request over DHCPv6 to get stateless
+configuration parameters. It is not recommended to combine this option
+with the
+.BI \-N
+,
+.BI \-P
+, or
+.BI \-T
+options or to share lease files between different modes of operation. Only
+valid with the
+.BI \-6
+option.
+
+.TP
+.BI \-N
+Perform a normal (IA_NA) address query over DHCPv6. It is not recommended
+to combine this option with the
+.BI \-P
+,
+.BI \-S
+, or
+.BI \-T
+options or to share lease files between different modes of operation. Only
+valid with the
+.BI \-6
+option.
+
+.TP
+.BI \-T
+Perform a temporary (IA_TA) address query over DHCPv6 (disables normal address
+query). It is not recommended to combine this option with the
+.BI \-N
+,
+.BI \-P
+, or
+.BI \-S
+options or to share lease files between different modes of operation. Only
+valid with the
+.BI \-6
+option.
+
+.TP
+.BI \-P
+Enable IPv6 prefix delegation (disables normal address query). It is not
+not recommended to combine this option with the
+.BI \-N
+,
+.BI \-S
+, or
+.BI \-T
+options or to share lease files between different modes of operation. Only
+valid with the
+.BI \-6
+option.
+ +
+.TP +.TP
+.BI \-p\ <port\ number> +.BI \-p\ <port\ number>
@ -216,7 +218,7 @@ diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
+uses the default port 68. This option is mostly useful for debugging +uses the default port 68. This option is mostly useful for debugging
+purposes. If a different port is specified for the client to listen and +purposes. If a different port is specified for the client to listen and
+transmit on, the client will also use a different destination port - one +transmit on, the client will also use a different destination port - one
+greater than the specified destination port. +less than the specified port.
+ +
+.TP +.TP
+.BI \-d +.BI \-d
@ -228,9 +230,10 @@ diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
+.TP +.TP
+.BI \-e\ VAR=value +.BI \-e\ VAR=value
+Define additional environment variables for the environment where +Define additional environment variables for the environment where
+dhclient-script executes. You may specify multiple +dhclient-script executes. You may specify multiplate
+.B \-e +.B \-e
+options on the command line. +options on the command line. For example:
+.B \-e IF_METRIC=1
+ +
+.TP +.TP
+.BI \-q +.BI \-q
@ -238,7 +241,7 @@ diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
+ +
+.TP +.TP
+.BI \-1 +.BI \-1
+Try one to get a lease. On failure, exit with code 2. +Try once to get a lease. One failure, exit with code 2.
+ +
+.TP +.TP
+.BI \-r +.BI \-r
@ -251,19 +254,19 @@ diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
+.TP +.TP
+.BI \-lf\ <lease-file> +.BI \-lf\ <lease-file>
+Path to the lease database file. If unspecified, the default +Path to the lease database file. If unspecified, the default
+.B /private/var/db/dhclient/dhclient.leases +.B DBDIR/dhclient.leases
+is used. +is used.
+ +
+.TP +.TP
+.BI \-pf\ <pid-file> +.BI \-pf\ <pid-file>
+Path to the process ID file. If unspecified, the default +Path to the process ID file. If unspecified, the default
+.B /private/var/run/dhclient.pid +.B RUNDIR/dhclient.pid
+is used. +is used.
+ +
+.TP +.TP
+.BI \-cf\ <config-file> +.BI \-cf\ <config-file>
+Path to the client configuration file. If unspecified, the default +Path to the client configuration file. If unspecified, the default
+.B /usr/local/etc/dhclient.conf +.B ETCDIR/dhclient.conf
+is used. +is used.
+ +
+.TP +.TP
@ -354,9 +357,9 @@ diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
+ nis-servers, ntp-servers + nis-servers, ntp-servers
+ +
The The
-.B -r -.B -x
-flag explicitly releases the current lease, and once the lease has been -flag tells any currently running client to exit gracefully without
-released, the client exits. -releasing leases first.
+.B -R +.B -R
+option does not append options to the default request, it overrides the +option does not append options to the default request, it overrides the
+default request list. Keep this in mind if you want to request an +default request list. Keep this in mind if you want to request an
@ -366,7 +369,7 @@ diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
+parameter. +parameter.
+ +
+.TP +.TP
+.BI \-T\ <timeout> +.BI \-timeout\ <timeout>
+Specify the time after which +Specify the time after which
+.B dhclient +.B dhclient
+will decide that no DHCP servers can be contacted when no responses have been +will decide that no DHCP servers can be contacted when no responses have been
@ -377,17 +380,32 @@ diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
+Enable verbose log messages. +Enable verbose log messages.
+ +
.PP .PP
If the client is killed by a signal (for example at shutdown or reboot) -If the client is killed by a signal (for example at shutdown or reboot)
it won't execute the -it won't execute the
@@ -253,57 +386,7 @@ or +If the client is killed by a signale (for example at shutdown or reboot), it
+will not execute the
.B dhclient-script (8)
-at exit. However if you shut the client down gracefully with
-.B -r
+at exit. However, if you shut the client down gracefully with
+.BI \-r
or
-.B -x
+.BI \-x
it will execute it will execute
.B dhclient-script (8) .B dhclient-script (8)
at shutdown with the specific reason for calling the script set. -at shutdown with the specific reason for calling the script set.
-.PP -.PP
-The -The
-.B -1 -.B -1
-flag will cause dhclient to try once to get a lease. If it fails, dhclient -flag will cause dhclient to try once to get a lease. If it fails, dhclient
-exits with exit code two. -exits with exit code two. In DHCPv6 the
-.B -1
-flag sets the max duration of the initial exchange to
-.I timeout
-(from
-.IR dhclient.conf ,
-default sixty seconds).
-.PP -.PP
-The DHCP client normally gets its configuration information from -The DHCP client normally gets its configuration information from
-.B ETCDIR/dhclient.conf, -.B ETCDIR/dhclient.conf,
@ -434,26 +452,23 @@ diff -up dhcp-4.0.0/client/dhclient.8.manpages dhcp-4.0.0/client/dhclient.8
-supplying the -supplying the
-.B -nw -.B -nw
-flag. -flag.
+ +at shutdown with the specific reason for calling the script set in the
+environment table.
.SH CONFIGURATION .SH CONFIGURATION
The syntax of the dhclient.conf(5) file is discussed separately. The syntax of the dhclient.conf(5) file is discussed separately.
.SH OMAPI .SH OMAPI
@@ -338,9 +421,9 @@ do a DHCPRELEASE. To pause it, set its @@ -386,7 +505,7 @@ do a DHCPRELEASE. To pause it, set its
resume it, set its state attribute to 4. resume it, set its state attribute to 4.
.PP .PP
.SH FILES .SH FILES
-.B CLIENTBINDIR/dhclient-script, -.B CLIENTBINDIR/dhclient-script,
-.B ETCDIR/dhclient.conf, DBDIR/dhclient.leases, RUNDIR/dhclient.pid,
-.B DBDIR/dhclient.leases~.
+.B /sbin/dhclient-script, +.B /sbin/dhclient-script,
+.B /usr/local/etc/dhclient.conf, /private/var/db/dhclient/dhclient.leases, /private/var/run/dhclient.pid, .B ETCDIR/dhclient.conf, DBDIR/dhclient.leases, RUNDIR/dhclient.pid,
+.B /private/var/db/dhclient/dhclient.leases~. .B DBDIR/dhclient.leases~.
.SH SEE ALSO .SH SEE ALSO
dhcpd(8), dhcrelay(8), dhclient-script(8), dhclient.conf(5), diff -up dhcp-4.1.0/client/dhclient.conf.5.man dhcp-4.1.0/client/dhclient.conf.5
dhclient.leases(5), dhcp-eval(5). --- dhcp-4.1.0/client/dhclient.conf.5.man 2008-03-07 08:58:29.000000000 -1000
diff -up dhcp-4.0.0/client/dhclient.conf.5.manpages dhcp-4.0.0/client/dhclient.conf.5 +++ dhcp-4.1.0/client/dhclient.conf.5 2009-01-06 10:50:40.000000000 -1000
--- dhcp-4.0.0/client/dhclient.conf.5.manpages 2007-08-23 06:06:08.000000000 -1000
+++ dhcp-4.0.0/client/dhclient.conf.5 2008-10-23 10:01:34.000000000 -1000
@@ -186,9 +186,9 @@ responding to the client send the client @@ -186,9 +186,9 @@ responding to the client send the client
options. Only the option names should be specified in the request options. Only the option names should be specified in the request
statement - not option parameters. By default, the DHCP server statement - not option parameters. By default, the DHCP server
@ -467,7 +482,7 @@ diff -up dhcp-4.0.0/client/dhclient.conf.5.manpages dhcp-4.0.0/client/dhclient.c
.PP .PP
In some cases, it may be desirable to send no parameter request list In some cases, it may be desirable to send no parameter request list
at all. To do this, simply write the request statement but specify at all. To do this, simply write the request statement but specify
@@ -626,6 +626,18 @@ database and will record the media type @@ -627,6 +627,18 @@ database and will record the media type
Whenever the client tries to renew the lease, it will use that same Whenever the client tries to renew the lease, it will use that same
media type. The lease must expire before the client will go back to media type. The lease must expire before the client will go back to
cycling through media types. cycling through media types.
@ -486,7 +501,7 @@ diff -up dhcp-4.0.0/client/dhclient.conf.5.manpages dhcp-4.0.0/client/dhclient.c
.SH SAMPLE .SH SAMPLE
The following configuration file is used on a laptop running NetBSD The following configuration file is used on a laptop running NetBSD
1.3. The laptop has an IP alias of 192.5.5.213, and has one 1.3. The laptop has an IP alias of 192.5.5.213, and has one
@@ -647,12 +659,12 @@ interface "ep0" { @@ -648,12 +660,12 @@ interface "ep0" {
send host-name "andare.fugue.com"; send host-name "andare.fugue.com";
send dhcp-client-identifier 1:0:a0:24:ab:fb:9c; send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
send dhcp-lease-time 3600; send dhcp-lease-time 3600;
@ -502,10 +517,93 @@ diff -up dhcp-4.0.0/client/dhclient.conf.5.manpages dhcp-4.0.0/client/dhclient.c
media "media 10baseT/UTP", "media 10base2/BNC"; media "media 10baseT/UTP", "media 10base2/BNC";
} }
diff -up dhcp-4.0.0/common/dhcp-options.5.manpages dhcp-4.0.0/common/dhcp-options.5 diff -up dhcp-4.1.0/client/dhclient-script.8.man dhcp-4.1.0/client/dhclient-script.8
--- dhcp-4.0.0/common/dhcp-options.5.manpages 2007-09-17 07:52:01.000000000 -1000 --- dhcp-4.1.0/client/dhclient-script.8.man 2006-02-24 13:16:27.000000000 -1000
+++ dhcp-4.0.0/common/dhcp-options.5 2008-10-23 09:58:40.000000000 -1000 +++ dhcp-4.1.0/client/dhclient-script.8 2009-01-06 10:50:40.000000000 -1000
@@ -896,6 +896,21 @@ classless IP routing - it does not inclu @@ -47,16 +47,16 @@ customizations are needed, they should b
exit hooks provided (see HOOKS for details). These hooks will allow the
user to override the default behaviour of the client in creating a
.B /etc/resolv.conf
-file.
+file, and to handle DHCP options not handled by default.
.PP
No standard client script exists for some operating systems, even though
the actual client may work, so a pioneering user may well need to create
a new script or modify an existing one. In general, customizations specific
to a particular computer should be done in the
-.B ETCDIR/dhclient.conf
+.B /usr/local/etc/dhclient.conf
file. If you find that you can't make such a customization without
customizing
-.B ETCDIR/dhclient.conf
+.B /usr/local/etc/dhclient.conf
or using the enter and exit hooks, please submit a bug report.
.SH HOOKS
When it starts, the client script first defines a shell function,
@@ -68,33 +68,53 @@ the enter hook script.
.PP
On after defining the make_resolv_conf function, the client script checks
for the presence of an executable
-.B ETCDIR/dhclient-enter-hooks
+.B /usr/local/etc/dhclient-enter-hooks
script, and if present, it invokes the script inline, using the Bourne
shell '.' command. The entire environment documented under OPERATION
is available to this script, which may modify the environment if needed
to change the behaviour of the script. If an error occurs during the
execution of the script, it can set the exit_status variable to a nonzero
value, and
-.B CLIENTBINDIR/dhclient-script
+.B /sbin/dhclient-script
will exit with that error code immediately after the client script exits.
.PP
After all processing has completed,
-.B CLIENTBINDIR/dhclient-script
+.B /sbin/dhclient-script
checks for the presence of an executable
-.B ETCDIR/dhclient-exit-hooks
+.B /usr/local/etc/dhclient-exit-hooks
script, which if present is invoked using the '.' command. The exit
status of dhclient-script will be passed to dhclient-exit-hooks in the
exit_status shell variable, and will always be zero if the script
succeeded at the task for which it was invoked. The rest of the
environment as described previously for dhclient-enter-hooks is also
present. The
-.B ETCDIR/dhclient-exit-hooks
+.B /usr/local/etc/dhclient-exit-hooks
script can modify the valid of exit_status to change the exit status
of dhclient-script.
+.PP
+Immediately after dhclient brings an interface UP with a new IP address,
+subnet mask, and routes, in the REBOOT/BOUND states, it will check for the
+existence of an executable
+.B /usr/local/etc/dhclient-up-hooks
+script, and source it if found. This script can handle DHCP options in
+the environment that are not handled by default. A per-interface.
+.B /usr/local/etc/dhclient-${IF}-up-hooks
+script will override the generic script and be sourced when interface
+$IF has been brought up.
+.PP
+Immediately before dhclient brings an interface DOWN, removing its IP
+address, subnet mask, and routes, in the STOP/RELEASE states, it will
+check for the existence of an executable
+.B /usr/local/etc/dhclient-down-hooks
+script, and source it if found. This script can handle DHCP options in
+the environment that are not handled by default. A per-interface
+.B /usr/local/etc/dhclient-${IF}-down-hooks
+script will override the generic script and be sourced when interface
+$IF is about to be brought down.
.SH OPERATION
When dhclient needs to invoke the client configuration script, it
defines a set of variables in the environment, and then invokes
-.B CLIENTBINDIR/dhclient-script.
+.B /sbin/dhclient-script.
In all cases, $reason is set to the name of the reason why the script
has been invoked. The following reasons are currently defined:
MEDIUM, PREINIT, BOUND, RENEW, REBIND, REBOOT, EXPIRE, FAIL, STOP, RELEASE,
diff -up dhcp-4.1.0/common/dhcp-options.5.man dhcp-4.1.0/common/dhcp-options.5
--- dhcp-4.1.0/common/dhcp-options.5.man 2008-11-21 03:59:56.000000000 -1000
+++ dhcp-4.1.0/common/dhcp-options.5 2009-01-06 10:50:40.000000000 -1000
@@ -905,6 +905,21 @@ classless IP routing - it does not inclu
classless IP routing is now the most widely deployed routing standard, classless IP routing is now the most widely deployed routing standard,
this option is virtually useless, and is not implemented by any of the this option is virtually useless, and is not implemented by any of the
popular DHCP clients, for example the Microsoft DHCP client. popular DHCP clients, for example the Microsoft DHCP client.
@ -527,10 +625,10 @@ diff -up dhcp-4.0.0/common/dhcp-options.5.manpages dhcp-4.0.0/common/dhcp-option
.RE .RE
.PP .PP
.nf .nf
diff -up dhcp-4.0.0/server/dhcpd.conf.5.manpages dhcp-4.0.0/server/dhcpd.conf.5 diff -up dhcp-4.1.0/server/dhcpd.conf.5.man dhcp-4.1.0/server/dhcpd.conf.5
--- dhcp-4.0.0/server/dhcpd.conf.5.manpages 2007-11-20 08:34:37.000000000 -1000 --- dhcp-4.1.0/server/dhcpd.conf.5.man 2008-11-03 08:13:58.000000000 -1000
+++ dhcp-4.0.0/server/dhcpd.conf.5 2008-10-23 09:58:40.000000000 -1000 +++ dhcp-4.1.0/server/dhcpd.conf.5 2009-01-06 10:50:40.000000000 -1000
@@ -513,6 +513,9 @@ pool { @@ -519,6 +519,9 @@ pool {
}; };
.fi .fi
.PP .PP
@ -540,7 +638,7 @@ diff -up dhcp-4.0.0/server/dhcpd.conf.5.manpages dhcp-4.0.0/server/dhcpd.conf.5
The server currently does very little sanity checking, so if you The server currently does very little sanity checking, so if you
configure it wrong, it will just fail in odd ways. I would recommend configure it wrong, it will just fail in odd ways. I would recommend
therefore that you either do failover or don't do failover, but don't therefore that you either do failover or don't do failover, but don't
@@ -527,9 +530,9 @@ primary server might look like this: @@ -533,9 +536,9 @@ primary server might look like this:
failover peer "foo" { failover peer "foo" {
primary; primary;
address anthrax.rc.vix.com; address anthrax.rc.vix.com;
@ -552,7 +650,7 @@ diff -up dhcp-4.0.0/server/dhcpd.conf.5.manpages dhcp-4.0.0/server/dhcpd.conf.5
max-response-delay 60; max-response-delay 60;
max-unacked-updates 10; max-unacked-updates 10;
mclt 3600; mclt 3600;
@@ -588,9 +591,7 @@ statement @@ -594,9 +597,7 @@ statement
.B port \fIport-number\fR\fB;\fR .B port \fIport-number\fR\fB;\fR
.PP .PP
The \fBport\fR statement declares the TCP port on which the server The \fBport\fR statement declares the TCP port on which the server
@ -563,7 +661,7 @@ diff -up dhcp-4.0.0/server/dhcpd.conf.5.manpages dhcp-4.0.0/server/dhcpd.conf.5
.RE .RE
.PP .PP
The The
@@ -602,10 +603,8 @@ statement @@ -608,10 +609,8 @@ statement
.PP .PP
The \fBpeer port\fR statement declares the TCP port to which the The \fBpeer port\fR statement declares the TCP port to which the
server should connect to reach its failover peer for failover server should connect to reach its failover peer for failover
@ -576,7 +674,7 @@ diff -up dhcp-4.0.0/server/dhcpd.conf.5.manpages dhcp-4.0.0/server/dhcpd.conf.5
.RE .RE
.PP .PP
The The
@@ -1272,7 +1271,7 @@ the zone containing PTR records - for IS @@ -1278,7 +1277,7 @@ the zone containing PTR records - for IS
.PP .PP
.nf .nf
key DHCP_UPDATER { key DHCP_UPDATER {
@ -585,7 +683,7 @@ diff -up dhcp-4.0.0/server/dhcpd.conf.5.manpages dhcp-4.0.0/server/dhcpd.conf.5
secret pRP5FapFoJ95JEL06sv4PQ==; secret pRP5FapFoJ95JEL06sv4PQ==;
}; };
@@ -1295,7 +1294,7 @@ dhcpd.conf file: @@ -1301,7 +1300,7 @@ dhcpd.conf file:
.PP .PP
.nf .nf
key DHCP_UPDATER { key DHCP_UPDATER {
@ -594,7 +692,7 @@ diff -up dhcp-4.0.0/server/dhcpd.conf.5.manpages dhcp-4.0.0/server/dhcpd.conf.5
secret pRP5FapFoJ95JEL06sv4PQ==; secret pRP5FapFoJ95JEL06sv4PQ==;
}; };
@@ -2240,7 +2239,7 @@ statement @@ -2302,7 +2301,7 @@ statement
.PP .PP
.I Name .I Name
should be the name of the DHCP server's lease file. By default, this should be the name of the DHCP server's lease file. By default, this
@ -603,7 +701,7 @@ diff -up dhcp-4.0.0/server/dhcpd.conf.5.manpages dhcp-4.0.0/server/dhcpd.conf.5
scope of the configuration file - if it appears in some other scope, scope of the configuration file - if it appears in some other scope,
it will have no effect. Furthermore, it has no effect if overridden it will have no effect. Furthermore, it has no effect if overridden
by the by the
@@ -2275,7 +2274,7 @@ statement @@ -2337,7 +2336,7 @@ statement
.PP .PP
.I Name .I Name
is the name of the lease file to use if and only if the server is running is the name of the lease file to use if and only if the server is running
@ -612,7 +710,7 @@ diff -up dhcp-4.0.0/server/dhcpd.conf.5.manpages dhcp-4.0.0/server/dhcpd.conf.5
like like
.I lease-file-name, .I lease-file-name,
\fBmust\fR appear in the outer scope of the configuration file. It \fBmust\fR appear in the outer scope of the configuration file. It
@@ -2433,7 +2432,8 @@ statement @@ -2495,7 +2494,8 @@ statement
The \fInext-server\fR statement is used to specify the host address of The \fInext-server\fR statement is used to specify the host address of
the server from which the initial boot file (specified in the the server from which the initial boot file (specified in the
\fIfilename\fR statement) is to be loaded. \fIServer-name\fR should \fIfilename\fR statement) is to be loaded. \fIServer-name\fR should
@ -622,7 +720,7 @@ diff -up dhcp-4.0.0/server/dhcpd.conf.5.manpages dhcp-4.0.0/server/dhcpd.conf.5
.RE .RE
.PP .PP
The The
@@ -2478,7 +2478,7 @@ statement @@ -2540,7 +2540,7 @@ statement
.I Name .I Name
should be the name of the DHCP server's process ID file. This is the should be the name of the DHCP server's process ID file. This is the
file in which the DHCP server's process ID is stored when the server file in which the DHCP server's process ID is stored when the server
@ -631,7 +729,7 @@ diff -up dhcp-4.0.0/server/dhcpd.conf.5.manpages dhcp-4.0.0/server/dhcpd.conf.5
.I lease-file-name .I lease-file-name
statement, this statement must appear in the outer scope statement, this statement must appear in the outer scope
of the configuration file. It has no effect if overridden by the of the configuration file. It has no effect if overridden by the
@@ -2496,7 +2496,7 @@ statement @@ -2558,7 +2558,7 @@ statement
.PP .PP
.I Name .I Name
is the name of the pid file to use if and only if the server is running is the name of the pid file to use if and only if the server is running

37
dhcp-4.1.0-memory.patch Normal file
View File

@ -0,0 +1,37 @@
diff -up dhcp-4.1.0/common/lpf.c.memory dhcp-4.1.0/common/lpf.c
--- dhcp-4.1.0/common/lpf.c.memory 2008-03-18 08:28:14.000000000 -1000
+++ dhcp-4.1.0/common/lpf.c 2009-01-06 07:57:54.000000000 -1000
@@ -247,6 +247,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.1.0/common/packet.c.memory dhcp-4.1.0/common/packet.c
--- dhcp-4.1.0/common/packet.c.memory 2007-11-30 11:51:43.000000000 -1000
+++ dhcp-4.1.0/common/packet.c 2009-01-06 07:57:54.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.1.0/minires/ns_name.c.memory dhcp-4.1.0/minires/ns_name.c
--- dhcp-4.1.0/minires/ns_name.c.memory 2005-03-17 10:15:17.000000000 -1000
+++ dhcp-4.1.0/minires/ns_name.c 2009-01-06 07:57:54.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. */

View File

@ -1,45 +1,41 @@
diff -up dhcp-4.0.0/common/conflex.c.options dhcp-4.0.0/common/conflex.c diff -up dhcp-4.1.0/client/clparse.c.options dhcp-4.1.0/client/clparse.c
--- dhcp-4.0.0/common/conflex.c.options 2007-12-29 11:13:51.000000000 -1000 --- dhcp-4.1.0/client/clparse.c.options 2008-05-23 03:22:23.000000000 -1000
+++ dhcp-4.0.0/common/conflex.c 2007-12-29 11:13:51.000000000 -1000 +++ dhcp-4.1.0/client/clparse.c 2009-01-06 07:59:14.000000000 -1000
@@ -769,6 +769,8 @@ intern(char *atom, enum dhcp_token dfv) @@ -136,6 +136,7 @@ isc_result_t read_client_conf ()
return BALANCE; /* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache)
if (!strcasecmp (atom + 1, "ound")) */
return BOUND; top_level_config.requested_lease = 7200;
+ if (!strcasecmp (atom + 1, "ootp-broadcast-always")) + top_level_config.bootp_broadcast_always = 0;
+ return BOOTP_BROADCAST_ALWAYS;
break; group_allocate (&top_level_config.on_receipt, MDL);
case 'c': if (!top_level_config.on_receipt)
if (!strcasecmp (atom + 1, "ase")) @@ -303,7 +304,8 @@ void read_client_leases ()
diff -up dhcp-4.0.0/includes/dhcpd.h.options dhcp-4.0.0/includes/dhcpd.h interface-declaration |
--- dhcp-4.0.0/includes/dhcpd.h.options 2007-12-29 11:13:51.000000000 -1000 LEASE client-lease-statement |
+++ dhcp-4.0.0/includes/dhcpd.h 2007-12-29 11:13:51.000000000 -1000 ALIAS client-lease-statement |
@@ -1055,6 +1055,9 @@ struct client_config { - KEY key-definition */
int do_forward_update; /* If nonzero, and if we have the + KEY key-definition |
information we need, update the + BOOTP_BROADCAST_ALWAYS */
A record for the address we get. */
void parse_client_statement (cfile, ip, config)
struct parse *cfile;
@@ -693,6 +695,12 @@ void parse_client_statement (cfile, ip,
parse_reject_statement (cfile, config);
return;
+ case BOOTP_BROADCAST_ALWAYS:
+ token = next_token(&val, (unsigned*)0, cfile);
+ config -> bootp_broadcast_always = 1;
+ parse_semi (cfile);
+ return;
+ +
+ int bootp_broadcast_always; /* If nonzero, always set the BOOTP_BROADCAST default:
+ flag in requests */ lose = 0;
}; stmt = (struct executable_statement *)0;
diff -up dhcp-4.1.0/client/dhclient.c.options dhcp-4.1.0/client/dhclient.c
/* Per-interface state used in the dhcp client... */ --- dhcp-4.1.0/client/dhclient.c.options 2008-06-11 10:17:10.000000000 -1000
diff -up dhcp-4.0.0/includes/dhctoken.h.options dhcp-4.0.0/includes/dhctoken.h +++ dhcp-4.1.0/client/dhclient.c 2009-01-06 08:27:57.000000000 -1000
--- dhcp-4.0.0/includes/dhctoken.h.options 2007-10-31 09:13:33.000000000 -1000 @@ -38,6 +38,12 @@
+++ dhcp-4.0.0/includes/dhctoken.h 2007-12-29 11:13:51.000000000 -1000
@@ -345,7 +345,8 @@ enum dhcp_token {
RANGE6 = 648,
WHITESPACE = 649,
TOKEN_ALSO = 650,
- AFTER = 651
+ AFTER = 651,
+ BOOTP_BROADCAST_ALWAYS = 652
};
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
--- dhcp-4.0.0/client/dhclient.c.options 2007-11-30 11:51:42.000000000 -1000
+++ dhcp-4.0.0/client/dhclient.c 2007-12-29 11:14:15.000000000 -1000
@@ -37,6 +37,12 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <limits.h> #include <limits.h>
@ -52,19 +48,19 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
TIME default_lease_time = 43200; /* 12 hours... */ TIME default_lease_time = 43200; /* 12 hours... */
TIME max_lease_time = 86400; /* 24 hours... */ TIME max_lease_time = 86400; /* 24 hours... */
@@ -75,6 +81,9 @@ int onetry=0; @@ -80,6 +86,9 @@ int wanted_ia_na = -1; /* the absolute
int quiet=1; int wanted_ia_ta = 0;
int nowait=0; int wanted_ia_pd = 0;
char *mockup_relay = NULL; char *mockup_relay = NULL;
+int bootp_broadcast_always = 0; +int bootp_broadcast_always = 0;
+ +
+extern u_int32_t default_requested_options[]; +extern u_int32_t default_requested_options[];
static void usage PROTO ((void)); void run_stateless(int exit_mode);
@@ -100,6 +109,15 @@ main(int argc, char **argv) { @@ -110,6 +119,15 @@ main(int argc, char **argv) {
int no_dhclient_script = 0;
int local_family_set = 0; int local_family_set = 0;
#endif /* DHCPv6 */
char *s; char *s;
+ char *dhcp_client_identifier_arg = NULL; + char *dhcp_client_identifier_arg = NULL;
+ char *dhcp_host_name_arg = NULL; + char *dhcp_host_name_arg = NULL;
@ -78,14 +74,14 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
/* Initialize client globals. */ /* Initialize client globals. */
memset(&default_duid, 0, sizeof(default_duid)); memset(&default_duid, 0, sizeof(default_duid));
@@ -224,6 +242,88 @@ main(int argc, char **argv) { @@ -274,6 +292,88 @@ main(int argc, char **argv) {
} else if (!strcmp (argv [i], "--version")) { } else if (!strcmp(argv[i], "--version")) {
log_info ("isc-dhclient-%s", PACKAGE_VERSION); log_info("isc-dhclient-%s", PACKAGE_VERSION);
exit (0); exit(0);
+ } else if (!strcmp (argv [i], "-I")) { + } else if (!strcmp(argv[i], "-I")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) { + if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
+ usage (); + usage();
+ return EXIT_FAILURE; + exit(1);
+ } + }
+ +
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) { + if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
@ -94,12 +90,12 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
+ } + }
+ +
+ dhcp_client_identifier_arg = argv[i]; + dhcp_client_identifier_arg = argv[i];
+ } else if (!strcmp (argv [i], "-B")) { + } else if (!strcmp(argv[i], "-B")) {
+ bootp_broadcast_always = 1; + bootp_broadcast_always = 1;
+ } else if (!strcmp (argv [i], "-H")) { + } else if (!strcmp(argv[i], "-H")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) { + if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
+ usage (); + usage();
+ return EXIT_FAILURE; + exit(1);
+ } + }
+ +
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) { + if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
@ -113,10 +109,10 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
+ } + }
+ +
+ dhcp_host_name_arg = argv[i]; + dhcp_host_name_arg = argv[i];
+ } else if (!strcmp (argv [i], "-F")) { + } else if (!strcmp(argv[i], "-F")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) { + if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
+ usage (); + usage();
+ return EXIT_FAILURE; + exit(1);
+ } + }
+ +
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) { + if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
@ -135,20 +131,20 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
+ } + }
+ +
+ dhcp_fqdn_arg = argv[i]; + dhcp_fqdn_arg = argv[i];
+ } else if (!strcmp (argv [i], "-T")) { + } else if (!strcmp(argv[i], "-timeout")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) { + if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
+ usage (); + usage();
+ return EXIT_FAILURE; + exit(1);
+ } + }
+ +
+ if ((timeout_arg = atoi(argv[i])) <= 0) { + if ((timeout_arg = atoi(argv[i])) <= 0) {
+ log_error("-T timeout option must be > 0 - bad value: %s",argv[i]); + log_error("-T timeout option must be > 0 - bad value: %s",argv[i]);
+ exit(1); + exit(1);
+ } + }
+ } else if (!strcmp (argv [i], "-V")) { + } else if (!strcmp(argv[i], "-V")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) { + if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
+ usage (); + usage();
+ return EXIT_FAILURE; + exit(1);
+ } + }
+ +
+ if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) { + if (strlen(argv[i]) >= DHCP_MAX_OPTION_LEN) {
@ -157,19 +153,19 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
+ } + }
+ +
+ dhcp_vendor_class_identifier_arg = argv[i]; + dhcp_vendor_class_identifier_arg = argv[i];
+ } else if (!strcmp (argv [i], "-R")) { + } else if (!strcmp(argv[i], "-R")) {
+ if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) { + if ((++i == argc) || (argv[i] == NULL) || (*(argv[i])=='\0')) {
+ usage (); + usage();
+ return EXIT_FAILURE; + exit(1);
+ } + }
+ +
+ dhclient_request_options=argv[i]; + dhclient_request_options = argv[i];
} else if (argv [i][0] == '-') { } else if (argv[i][0] == '-') {
usage (); usage();
} else { } else if (interfaces_requested < 0) {
@@ -370,6 +470,166 @@ main(int argc, char **argv) { @@ -443,6 +543,166 @@ main(int argc, char **argv) {
/* Parse the dhclient.conf file. */ /* Parse the dhclient.conf file. */
read_client_conf (); read_client_conf();
+ /* Parse any extra command line configuration arguments: */ + /* Parse any extra command line configuration arguments: */
+ if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) { + if ((dhcp_client_identifier_arg != NULL) && (*dhcp_client_identifier_arg != '\0')) {
@ -188,7 +184,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
+ } else { + } else {
+ char *last_arg_conf = arg_conf; + char *last_arg_conf = arg_conf;
+ arg_conf = NULL; + arg_conf = NULL;
+ arg_conf_len = asprintf( &arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg); + arg_conf_len = asprintf(&arg_conf, "%s\nsend host-name \"%s\";", last_arg_conf, dhcp_host_name_arg);
+ +
+ if ((arg_conf == 0) || (arg_conf_len <= 0)) + if ((arg_conf == 0) || (arg_conf_len <= 0))
+ log_fatal("Unable to send -H option host-name"); + log_fatal("Unable to send -H option host-name");
@ -206,7 +202,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
+ } else { + } else {
+ char *last_arg_conf = arg_conf; + char *last_arg_conf = arg_conf;
+ arg_conf = NULL; + arg_conf = NULL;
+ arg_conf_len = asprintf( &arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg); + arg_conf_len = asprintf(&arg_conf, "%s\nsend fqdn.fqdn \"%s\";", last_arg_conf, dhcp_fqdn_arg);
+ +
+ if ((arg_conf == 0) || (arg_conf_len <= 0)) + if ((arg_conf == 0) || (arg_conf_len <= 0))
+ log_fatal("Unable to send -F option fqdn.fqdn"); + log_fatal("Unable to send -F option fqdn.fqdn");
@ -220,14 +216,14 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
+ arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg); + arg_conf_len = asprintf(&arg_conf, "timeout %d;", timeout_arg);
+ +
+ if ((arg_conf == 0) || (arg_conf_len <= 0)) + if ((arg_conf == 0) || (arg_conf_len <= 0))
+ log_fatal("Unable to process -T timeout argument"); + log_fatal("Unable to process -timeout timeout argument");
+ } else { + } else {
+ char *last_arg_conf = arg_conf; + char *last_arg_conf = arg_conf;
+ arg_conf = NULL; + arg_conf = NULL;
+ arg_conf_len = asprintf( &arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg); + arg_conf_len = asprintf(&arg_conf, "%s\ntimeout %d;", last_arg_conf, timeout_arg);
+ +
+ if ((arg_conf == 0) || (arg_conf_len == 0)) + if ((arg_conf == 0) || (arg_conf_len == 0))
+ log_fatal("Unable to process -T timeout argument"); + log_fatal("Unable to process -timeout timeout argument");
+ +
+ free(last_arg_conf); + free(last_arg_conf);
+ } + }
@ -273,7 +269,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
+ if (arg_conf_len == 0) + if (arg_conf_len == 0)
+ if ((arg_conf_len = strlen(arg_conf)) == 0) + if ((arg_conf_len = strlen(arg_conf)) == 0)
+ /* huh ? cannot happen ! */ + /* huh ? cannot happen ! */
+ log_fatal("Unable to process -I/-H/-F/-T/-V/-R configuration arguments"); + log_fatal("Unable to process -I/-H/-F/-timeout/-V/-R configuration arguments");
+ +
+ /* parse the extra dhclient.conf configuration arguments + /* parse the extra dhclient.conf configuration arguments
+ * into top level config: */ + * into top level config: */
@ -281,23 +277,23 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
+ const char *val = NULL; + const char *val = NULL;
+ int token; + int token;
+ +
+ status = new_parse (&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-T/-V/-R configuration arguments", 0); + status = new_parse(&cfile, -1, arg_conf, arg_conf_len, "extra dhclient -I/-H/-F/-timeout/-V/-R configuration arguments", 0);
+ +
+ if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred)) + if ((status != ISC_R_SUCCESS) || (cfile -> warnings_occurred))
+ log_fatal("Cannot parse -I/-H/-F/-T/-V/-R configuration arguments !"); + log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
+ /* more detailed parse failures will be logged */ + /* more detailed parse failures will be logged */
+ +
+ do { + do {
+ token = peek_token (&val, (unsigned *)0, cfile); + token = peek_token(&val, (unsigned *)0, cfile);
+ if (token == END_OF_FILE) + if (token == END_OF_FILE)
+ break; + break;
+ +
+ parse_client_statement (cfile, (struct interface_info *)0, &top_level_config); + parse_client_statement(cfile, (struct interface_info *)0, &top_level_config);
+ } while (1); + } while (1);
+ +
+ if (cfile -> warnings_occurred) + if (cfile -> warnings_occurred)
+ log_fatal ("Cannot parse -I/-H/-F/-T/-V/-R configuration arguments !"); + log_fatal("Cannot parse -I/-H/-F/-timeout/-V/-R configuration arguments !");
+ end_parse (&cfile); + end_parse(&cfile);
+ +
+ if (timeout_arg) { + if (timeout_arg) {
+ /* we just set the toplevel timeout, but per-client + /* we just set the toplevel timeout, but per-client
@ -308,7 +304,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
+ if ((top_level_config.backoff_cutoff == 15) && (top_level_config.backoff_cutoff > (timeout_arg / 2))) + if ((top_level_config.backoff_cutoff == 15) && (top_level_config.backoff_cutoff > (timeout_arg / 2)))
+ top_level_config.backoff_cutoff = (((unsigned long)(timeout_arg / 2)) == 0) ? timeout_arg : (unsigned long)(timeout_arg / 2); + top_level_config.backoff_cutoff = (((unsigned long)(timeout_arg / 2)) == 0) ? timeout_arg : (unsigned long)(timeout_arg / 2);
+ +
+ for (ip = interfaces; ip; ip = ip -> next) { + for (ip=interfaces; ip; ip = ip->next) {
+ if (ip->client->config->timeout == 60) + if (ip->client->config->timeout == 60)
+ ip->client->config->timeout = timeout_arg; + ip->client->config->timeout = timeout_arg;
+ +
@ -320,7 +316,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
+ } + }
+ +
+ if ((dhclient_request_options != 0) && (top_level_config.requested_options != default_requested_options)) { + if ((dhclient_request_options != 0) && (top_level_config.requested_options != default_requested_options)) {
+ for (ip = interfaces; ip; ip = ip -> next) { + for (ip=interfaces; ip; ip = ip->next) {
+ if (ip->client->config->requested_options == default_requested_options) + if (ip->client->config->requested_options == default_requested_options)
+ ip->client->config->requested_options = top_level_config.requested_options; + ip->client->config->requested_options = top_level_config.requested_options;
+ } + }
@ -332,9 +328,9 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
+ } + }
+ +
/* Parse the lease database. */ /* Parse the lease database. */
read_client_leases (); read_client_leases();
@@ -2105,7 +2365,8 @@ void make_discover (client, lease) @@ -2313,7 +2573,8 @@ void make_discover (client, lease)
client -> packet.xid = random (); client -> packet.xid = random ();
client -> packet.secs = 0; /* filled in by send_discover. */ client -> packet.secs = 0; /* filled in by send_discover. */
@ -344,7 +340,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
client -> packet.flags = 0; client -> packet.flags = 0;
else else
client -> packet.flags = htons (BOOTP_BROADCAST); client -> packet.flags = htons (BOOTP_BROADCAST);
@@ -2189,7 +2450,9 @@ void make_request (client, lease) @@ -2397,7 +2658,9 @@ void make_request (client, lease)
} else { } else {
memset (&client -> packet.ciaddr, 0, memset (&client -> packet.ciaddr, 0,
sizeof client -> packet.ciaddr); sizeof client -> packet.ciaddr);
@ -355,7 +351,7 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
client -> packet.flags = 0; client -> packet.flags = 0;
else else
client -> packet.flags = htons (BOOTP_BROADCAST); client -> packet.flags = htons (BOOTP_BROADCAST);
@@ -2248,7 +2511,8 @@ void make_decline (client, lease) @@ -2459,7 +2722,8 @@ void make_decline (client, lease)
client -> packet.hops = 0; client -> packet.hops = 0;
client -> packet.xid = client -> xid; client -> packet.xid = client -> xid;
client -> packet.secs = 0; /* Filled in by send_request. */ client -> packet.secs = 0; /* Filled in by send_request. */
@ -365,37 +361,41 @@ diff -up dhcp-4.0.0/client/dhclient.c.options dhcp-4.0.0/client/dhclient.c
client -> packet.flags = 0; client -> packet.flags = 0;
else else
client -> packet.flags = htons (BOOTP_BROADCAST); client -> packet.flags = htons (BOOTP_BROADCAST);
diff -up dhcp-4.0.0/client/clparse.c.options dhcp-4.0.0/client/clparse.c diff -up dhcp-4.1.0/common/conflex.c.options dhcp-4.1.0/common/conflex.c
--- dhcp-4.0.0/client/clparse.c.options 2007-12-08 09:36:00.000000000 -1000 --- dhcp-4.1.0/common/conflex.c.options 2009-01-06 07:59:13.000000000 -1000
+++ dhcp-4.0.0/client/clparse.c 2007-12-29 11:13:51.000000000 -1000 +++ dhcp-4.1.0/common/conflex.c 2009-01-06 07:59:14.000000000 -1000
@@ -132,6 +132,7 @@ isc_result_t read_client_conf () @@ -783,6 +783,8 @@ intern(char *atom, enum dhcp_token dfv)
/* Requested lease time, used by DHCPv6 (DHCPv4 uses the option cache) return BALANCE;
*/ if (!strcasecmp (atom + 1, "ound"))
top_level_config.requested_lease = 7200; return BOUND;
+ top_level_config.bootp_broadcast_always = 0; + if (!strcasecmp (atom + 1, "ootp-broadcast-always"))
+ return BOOTP_BROADCAST_ALWAYS;
group_allocate (&top_level_config.on_receipt, MDL); break;
if (!top_level_config.on_receipt) case 'c':
@@ -295,7 +296,8 @@ void read_client_leases () if (!strcasecmp (atom + 1, "ase"))
interface-declaration | diff -up dhcp-4.1.0/includes/dhcpd.h.options dhcp-4.1.0/includes/dhcpd.h
LEASE client-lease-statement | --- dhcp-4.1.0/includes/dhcpd.h.options 2009-01-06 07:59:13.000000000 -1000
ALIAS client-lease-statement | +++ dhcp-4.1.0/includes/dhcpd.h 2009-01-06 07:59:14.000000000 -1000
- KEY key-definition */ @@ -1079,6 +1079,9 @@ struct client_config {
+ KEY key-definition | int do_forward_update; /* If nonzero, and if we have the
+ BOOTP_BROADCAST_ALWAYS */ information we need, update the
A record for the address we get. */
void parse_client_statement (cfile, ip, config)
struct parse *cfile;
@@ -685,6 +687,12 @@ void parse_client_statement (cfile, ip,
parse_reject_statement (cfile, config);
return;
+ case BOOTP_BROADCAST_ALWAYS:
+ token = next_token(&val, (unsigned*)0, cfile);
+ config -> bootp_broadcast_always = 1;
+ parse_semi (cfile);
+ return;
+ +
default: + int bootp_broadcast_always; /* If nonzero, always set the BOOTP_BROADCAST
lose = 0; + flag in requests */
stmt = (struct executable_statement *)0; };
/* Per-interface state used in the dhcp client... */
diff -up dhcp-4.1.0/includes/dhctoken.h.options dhcp-4.1.0/includes/dhctoken.h
--- dhcp-4.1.0/includes/dhctoken.h.options 2008-02-20 02:45:53.000000000 -1000
+++ dhcp-4.1.0/includes/dhctoken.h 2009-01-06 08:00:51.000000000 -1000
@@ -352,7 +352,8 @@ enum dhcp_token {
ZEROLEN = 655,
TEMPORARY = 656,
PREFIX6 = 657,
- FIXED_PREFIX6 = 658
+ FIXED_PREFIX6 = 658,
+ BOOTP_BROADCAST_ALWAYS = 659
};
#define is_identifier(x) ((x) >= FIRST_TOKEN && \

View File

@ -1,7 +1,7 @@
diff -up dhcp-4.0.0/includes/dhcpd.h.path dhcp-4.0.0/includes/dhcpd.h diff -up dhcp-4.1.0/includes/dhcpd.h.paths dhcp-4.1.0/includes/dhcpd.h
--- dhcp-4.0.0/includes/dhcpd.h.path 2008-08-23 18:25:54.000000000 -1000 --- dhcp-4.1.0/includes/dhcpd.h.paths 2009-01-06 11:52:57.000000000 -1000
+++ dhcp-4.0.0/includes/dhcpd.h 2008-08-23 18:26:21.000000000 -1000 +++ dhcp-4.1.0/includes/dhcpd.h 2009-01-06 11:52:57.000000000 -1000
@@ -1302,15 +1302,15 @@ typedef unsigned char option_mask [16]; @@ -1340,15 +1340,15 @@ typedef unsigned char option_mask [16];
#else /* !DEBUG */ #else /* !DEBUG */
#ifndef _PATH_DHCPD_CONF #ifndef _PATH_DHCPD_CONF
@ -20,7 +20,7 @@ diff -up dhcp-4.0.0/includes/dhcpd.h.path dhcp-4.0.0/includes/dhcpd.h
#endif #endif
#ifndef _PATH_DHCPD_PID #ifndef _PATH_DHCPD_PID
@@ -1324,7 +1324,7 @@ typedef unsigned char option_mask [16]; @@ -1362,7 +1362,7 @@ typedef unsigned char option_mask [16];
#endif /* DEBUG */ #endif /* DEBUG */
#ifndef _PATH_DHCLIENT_CONF #ifndef _PATH_DHCLIENT_CONF
@ -29,7 +29,7 @@ diff -up dhcp-4.0.0/includes/dhcpd.h.path dhcp-4.0.0/includes/dhcpd.h
#endif #endif
#ifndef _PATH_DHCLIENT_SCRIPT #ifndef _PATH_DHCLIENT_SCRIPT
@@ -1340,11 +1340,11 @@ typedef unsigned char option_mask [16]; @@ -1378,11 +1378,11 @@ typedef unsigned char option_mask [16];
#endif #endif
#ifndef _PATH_DHCLIENT_DB #ifndef _PATH_DHCLIENT_DB

View File

@ -1,18 +1,18 @@
diff -up dhcp-4.0.0/client/dhclient.c.port dhcp-4.0.0/client/dhclient.c diff -up dhcp-4.1.0/client/dhclient.c.validate dhcp-4.1.0/client/dhclient.c
--- dhcp-4.0.0/client/dhclient.c.port 2008-10-29 13:27:33.000000000 -1000 --- dhcp-4.1.0/client/dhclient.c.validate 2009-01-06 12:11:44.000000000 -1000
+++ dhcp-4.0.0/client/dhclient.c 2008-10-29 13:27:33.000000000 -1000 +++ dhcp-4.1.0/client/dhclient.c 2009-01-06 12:25:06.000000000 -1000
@@ -218,7 +218,7 @@ int main(int argc, char **argv, char **e @@ -190,7 +190,7 @@ main(int argc, char **argv) {
} else if (!strcmp (argv [i], "-p")) { } else if (!strcmp(argv[i], "-p")) {
if (++i == argc) if (++i == argc)
usage (); usage();
- local_port = htons (atoi (argv [i])); - local_port = htons(atoi(argv[i]));
+ local_port = validate_port(argv[i]); + local_port = validate_port(argv[i]);
log_debug ("binding to user-specified port %d", log_debug("binding to user-specified port %d",
ntohs (local_port)); ntohs(local_port));
} else if (!strcmp (argv [i], "-d")) { } else if (!strcmp(argv[i], "-d")) {
diff -up dhcp-4.0.0/common/inet.c.port dhcp-4.0.0/common/inet.c diff -up dhcp-4.1.0/common/inet.c.validate dhcp-4.1.0/common/inet.c
--- dhcp-4.0.0/common/inet.c.port 2007-07-12 20:43:41.000000000 -1000 --- dhcp-4.1.0/common/inet.c.validate 2007-07-12 20:43:41.000000000 -1000
+++ dhcp-4.0.0/common/inet.c 2008-10-29 13:27:33.000000000 -1000 +++ dhcp-4.1.0/common/inet.c 2009-01-06 12:11:44.000000000 -1000
@@ -604,3 +604,20 @@ piaddrcidr(const struct iaddr *addr, uns @@ -604,3 +604,20 @@ piaddrcidr(const struct iaddr *addr, uns
return ret; return ret;
} }
@ -34,10 +34,10 @@ diff -up dhcp-4.0.0/common/inet.c.port dhcp-4.0.0/common/inet.c
+ +
+ return htons(local_port); + return htons(local_port);
+} +}
diff -up dhcp-4.0.0/includes/dhcpd.h.port dhcp-4.0.0/includes/dhcpd.h diff -up dhcp-4.1.0/includes/dhcpd.h.validate dhcp-4.1.0/includes/dhcpd.h
--- dhcp-4.0.0/includes/dhcpd.h.port 2008-10-29 13:27:33.000000000 -1000 --- dhcp-4.1.0/includes/dhcpd.h.validate 2009-01-06 12:11:43.000000000 -1000
+++ dhcp-4.0.0/includes/dhcpd.h 2008-10-29 13:28:57.000000000 -1000 +++ dhcp-4.1.0/includes/dhcpd.h 2009-01-06 12:11:44.000000000 -1000
@@ -64,6 +64,7 @@ @@ -65,6 +65,7 @@
#endif #endif
#include <setjmp.h> #include <setjmp.h>
@ -45,7 +45,7 @@ diff -up dhcp-4.0.0/includes/dhcpd.h.port dhcp-4.0.0/includes/dhcpd.h
#include "cdefs.h" #include "cdefs.h"
#include "osdep.h" #include "osdep.h"
@@ -2432,6 +2433,7 @@ isc_result_t free_iaddrcidrnetlist(struc @@ -2511,6 +2512,7 @@ isc_result_t free_iaddrcidrnetlist(struc
const char *piaddr PROTO ((struct iaddr)); const char *piaddr PROTO ((struct iaddr));
char *piaddrmask(struct iaddr *, struct iaddr *); char *piaddrmask(struct iaddr *, struct iaddr *);
char *piaddrcidr(const struct iaddr *, unsigned int); char *piaddrcidr(const struct iaddr *, unsigned int);
@ -53,22 +53,22 @@ diff -up dhcp-4.0.0/includes/dhcpd.h.port dhcp-4.0.0/includes/dhcpd.h
/* dhclient.c */ /* dhclient.c */
extern int nowait; extern int nowait;
diff -up dhcp-4.0.0/relay/dhcrelay.c.port dhcp-4.0.0/relay/dhcrelay.c diff -up dhcp-4.1.0/relay/dhcrelay.c.validate dhcp-4.1.0/relay/dhcrelay.c
--- dhcp-4.0.0/relay/dhcrelay.c.port 2008-10-29 13:27:33.000000000 -1000 --- dhcp-4.1.0/relay/dhcrelay.c.validate 2009-01-06 12:11:43.000000000 -1000
+++ dhcp-4.0.0/relay/dhcrelay.c 2008-10-29 13:27:33.000000000 -1000 +++ dhcp-4.1.0/relay/dhcrelay.c 2009-01-06 12:23:29.000000000 -1000
@@ -141,7 +141,7 @@ main(int argc, char **argv) { @@ -222,7 +222,7 @@ main(int argc, char **argv) {
if (!strcmp (argv [i], "-p")) { } else if (!strcmp(argv[i], "-p")) {
if (++i == argc) if (++i == argc)
usage (); usage();
- local_port = htons (atoi (argv [i])); - local_port = htons(atoi (argv[i]));
+ local_port = validate_port(argv[i]); + local_port = validate_port(argv[i]);
log_debug ("binding to user-specified port %d", log_debug("binding to user-specified port %d",
ntohs (local_port)); ntohs(local_port));
} else if (!strcmp (argv [i], "-d")) { } else if (!strcmp(argv[i], "-c")) {
diff -up dhcp-4.0.0/server/dhcpd.c.port dhcp-4.0.0/server/dhcpd.c diff -up dhcp-4.1.0/server/dhcpd.c.validate dhcp-4.1.0/server/dhcpd.c
--- dhcp-4.0.0/server/dhcpd.c.port 2008-10-29 13:27:33.000000000 -1000 --- dhcp-4.1.0/server/dhcpd.c.validate 2009-01-06 12:11:43.000000000 -1000
+++ dhcp-4.0.0/server/dhcpd.c 2008-10-29 13:27:33.000000000 -1000 +++ dhcp-4.1.0/server/dhcpd.c 2009-01-06 12:11:44.000000000 -1000
@@ -257,15 +257,7 @@ main(int argc, char **argv) { @@ -298,15 +298,7 @@ main(int argc, char **argv) {
if (!strcmp (argv [i], "-p")) { if (!strcmp (argv [i], "-p")) {
if (++i == argc) if (++i == argc)
usage (); usage ();
@ -85,7 +85,7 @@ diff -up dhcp-4.0.0/server/dhcpd.c.port dhcp-4.0.0/server/dhcpd.c
log_debug ("binding to user-specified port %d", log_debug ("binding to user-specified port %d",
ntohs (local_port)); ntohs (local_port));
} else if (!strcmp (argv [i], "-f")) { } else if (!strcmp (argv [i], "-f")) {
@@ -438,7 +430,7 @@ main(int argc, char **argv) { @@ -531,7 +523,7 @@ main(int argc, char **argv) {
if (!local_port) if (!local_port)
{ {
if ((s = getenv ("DHCPD_PORT"))) { if ((s = getenv ("DHCPD_PORT"))) {

View File

@ -1,7 +1,7 @@
diff -up dhcp-4.0.0//client/dhclient.c.release dhcp-4.0.0//client/dhclient.c diff -up dhcp-4.1.0/client/dhclient.c.ifup dhcp-4.1.0/client/dhclient.c
--- dhcp-4.0.0//client/dhclient.c.release 2008-08-01 10:09:01.000000000 -1000 --- dhcp-4.1.0/client/dhclient.c.ifup 2009-01-06 08:29:14.000000000 -1000
+++ dhcp-4.0.0//client/dhclient.c 2008-08-01 10:09:17.000000000 -1000 +++ dhcp-4.1.0/client/dhclient.c 2009-01-06 10:07:08.000000000 -1000
@@ -412,9 +412,81 @@ main(int argc, char **argv) { @@ -474,9 +474,81 @@ main(int argc, char **argv) {
kill(oldpid, SIGTERM); kill(oldpid, SIGTERM);
} }
fclose(pidfd); fclose(pidfd);
@ -81,5 +81,5 @@ diff -up dhcp-4.0.0//client/dhclient.c.release dhcp-4.0.0//client/dhclient.c
+ write_client_pid_file(); + write_client_pid_file();
+ +
if (!quiet) { if (!quiet) {
log_info ("%s %s", message, PACKAGE_VERSION); log_info("%s %s", message, PACKAGE_VERSION);
log_info (copyright); log_info(copyright);

View File

@ -1,6 +1,6 @@
diff -up dhcp-4.0.0//server/bootp.c.unicast dhcp-4.0.0//server/bootp.c diff -up dhcp-4.1.0/server/bootp.c.unicast dhcp-4.1.0/server/bootp.c
--- dhcp-4.0.0//server/bootp.c.unicast 2007-10-26 12:46:50.000000000 -1000 --- dhcp-4.1.0/server/bootp.c.unicast 2008-08-20 13:07:19.000000000 -1000
+++ dhcp-4.0.0//server/bootp.c 2008-08-01 10:12:38.000000000 -1000 +++ dhcp-4.1.0/server/bootp.c 2009-01-06 10:13:29.000000000 -1000
@@ -58,6 +58,7 @@ void bootp (packet) @@ -58,6 +58,7 @@ void bootp (packet)
char msgbuf [1024]; char msgbuf [1024];
int ignorep; int ignorep;
@ -18,7 +18,7 @@ diff -up dhcp-4.0.0//server/bootp.c.unicast dhcp-4.0.0//server/bootp.c
log_info ("%s: network unknown", msgbuf); log_info ("%s: network unknown", msgbuf);
return; return;
} }
@@ -384,6 +385,13 @@ void bootp (packet) @@ -390,6 +391,13 @@ void bootp (packet)
from, &to, &hto); from, &to, &hto);
goto out; goto out;
} }
@ -32,10 +32,10 @@ diff -up dhcp-4.0.0//server/bootp.c.unicast dhcp-4.0.0//server/bootp.c
/* If it comes from a client that already knows its address /* If it comes from a client that already knows its address
and is not requesting a broadcast response, and we can 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 diff -up dhcp-4.1.0/server/dhcp.c.unicast dhcp-4.1.0/server/dhcp.c
--- dhcp-4.0.0//server/dhcp.c.unicast 2007-11-02 12:09:02.000000000 -1000 --- dhcp-4.1.0/server/dhcp.c.unicast 2008-11-03 08:13:58.000000000 -1000
+++ dhcp-4.0.0//server/dhcp.c 2008-08-01 10:12:38.000000000 -1000 +++ dhcp-4.1.0/server/dhcp.c 2009-01-06 10:13:29.000000000 -1000
@@ -3904,6 +3904,7 @@ int locate_network (packet) @@ -4111,6 +4111,7 @@ int locate_network (packet)
struct data_string data; struct data_string data;
struct subnet *subnet = (struct subnet *)0; struct subnet *subnet = (struct subnet *)0;
struct option_cache *oc; struct option_cache *oc;
@ -43,7 +43,7 @@ diff -up dhcp-4.0.0//server/dhcp.c.unicast dhcp-4.0.0//server/dhcp.c
/* See if there's a Relay Agent Link Selection Option, or a /* See if there's a Relay Agent Link Selection Option, or a
* Subnet Selection Option. The Link-Select and Subnet-Select * Subnet Selection Option. The Link-Select and Subnet-Select
@@ -3919,12 +3920,24 @@ int locate_network (packet) @@ -4126,12 +4127,24 @@ int locate_network (packet)
from the interface, if there is one. If not, fail. */ from the interface, if there is one. If not, fail. */
if (!oc && !packet -> raw -> giaddr.s_addr) { if (!oc && !packet -> raw -> giaddr.s_addr) {
if (packet -> interface -> shared_network) { if (packet -> interface -> shared_network) {
@ -73,7 +73,7 @@ diff -up dhcp-4.0.0//server/dhcp.c.unicast dhcp-4.0.0//server/dhcp.c
} }
/* If there's an option indicating link connection, and it's valid, /* If there's an option indicating link connection, and it's valid,
@@ -3947,7 +3960,10 @@ int locate_network (packet) @@ -4154,7 +4167,10 @@ int locate_network (packet)
data_string_forget (&data, MDL); data_string_forget (&data, MDL);
} else { } else {
ia.len = 4; ia.len = 4;
@ -85,7 +85,7 @@ diff -up dhcp-4.0.0//server/dhcp.c.unicast dhcp-4.0.0//server/dhcp.c
} }
/* If we know the subnet on which the IP address lives, use it. */ /* If we know the subnet on which the IP address lives, use it. */
@@ -3955,7 +3971,10 @@ int locate_network (packet) @@ -4162,7 +4178,10 @@ int locate_network (packet)
shared_network_reference (&packet -> shared_network, shared_network_reference (&packet -> shared_network,
subnet -> shared_network, MDL); subnet -> shared_network, MDL);
subnet_dereference (&subnet, MDL); subnet_dereference (&subnet, MDL);

View File

@ -1,18 +1,18 @@
diff -up dhcp-4.0.0/common/nit.c.xen dhcp-4.0.0/common/nit.c diff -up dhcp-4.1.0/common/bpf.c.xen dhcp-4.1.0/common/bpf.c
--- dhcp-4.0.0/common/nit.c.xen 2007-09-05 07:32:10.000000000 -1000 --- dhcp-4.1.0/common/bpf.c.xen 2007-08-22 23:49:51.000000000 -1000
+++ dhcp-4.0.0/common/nit.c 2007-12-29 06:39:16.000000000 -1000 +++ dhcp-4.1.0/common/bpf.c 2009-01-06 10:41:32.000000000 -1000
@@ -366,7 +366,7 @@ ssize_t receive_packet (interface, buf, @@ -482,7 +482,7 @@ ssize_t receive_packet (interface, buf,
offset = decode_udp_ip_header (interface,
/* Decode the IP and UDP headers... */ interface -> rbuf,
offset = decode_udp_ip_header (interface, ibuf, bufix, interface -> rbuf_offset,
- from, length, &paylen); - from, hdr.bh_caplen, &paylen);
+ from, length, &paylen, 0); + from, hdr.bh_caplen, &paylen, 0);
/* If the IP or UDP checksum was bad, skip the packet... */ /* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0) if (offset < 0) {
diff -up dhcp-4.0.0/common/dlpi.c.xen dhcp-4.0.0/common/dlpi.c diff -up dhcp-4.1.0/common/dlpi.c.xen dhcp-4.1.0/common/dlpi.c
--- dhcp-4.0.0/common/dlpi.c.xen 2007-10-08 04:27:53.000000000 -1000 --- dhcp-4.1.0/common/dlpi.c.xen 2008-02-29 13:57:56.000000000 -1000
+++ dhcp-4.0.0/common/dlpi.c 2007-12-29 06:39:13.000000000 -1000 +++ dhcp-4.1.0/common/dlpi.c 2009-01-06 10:41:32.000000000 -1000
@@ -689,7 +689,7 @@ ssize_t receive_packet (interface, buf, @@ -689,7 +689,7 @@ ssize_t receive_packet (interface, buf,
length -= offset; length -= offset;
#endif #endif
@ -22,21 +22,9 @@ diff -up dhcp-4.0.0/common/dlpi.c.xen dhcp-4.0.0/common/dlpi.c
/* If the IP or UDP checksum was bad, skip the packet... */ /* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0) { if (offset < 0) {
diff -up dhcp-4.0.0/common/upf.c.xen dhcp-4.0.0/common/upf.c diff -up dhcp-4.1.0/common/lpf.c.xen dhcp-4.1.0/common/lpf.c
--- dhcp-4.0.0/common/upf.c.xen 2007-07-12 20:43:42.000000000 -1000 --- dhcp-4.1.0/common/lpf.c.xen 2009-01-06 10:41:31.000000000 -1000
+++ dhcp-4.0.0/common/upf.c 2007-12-29 06:39:24.000000000 -1000 +++ dhcp-4.1.0/common/lpf.c 2009-01-06 10:41:32.000000000 -1000
@@ -317,7 +317,7 @@ ssize_t receive_packet (interface, buf,
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix,
- from, length, &paylen);
+ from, length, &paylen, 0);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff -up dhcp-4.0.0/common/lpf.c.xen dhcp-4.0.0/common/lpf.c
--- dhcp-4.0.0/common/lpf.c.xen 2007-12-29 06:37:53.000000000 -1000
+++ dhcp-4.0.0/common/lpf.c 2007-12-29 06:43:08.000000000 -1000
@@ -29,18 +29,33 @@ @@ -29,18 +29,33 @@
#include "dhcpd.h" #include "dhcpd.h"
#if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE) #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE)
@ -127,7 +115,7 @@ diff -up dhcp-4.0.0/common/lpf.c.xen dhcp-4.0.0/common/lpf.c
#if defined (HAVE_TR_SUPPORT) #if defined (HAVE_TR_SUPPORT)
if (info -> hw_address.hbuf [0] == HTYPE_IEEE802) if (info -> hw_address.hbuf [0] == HTYPE_IEEE802)
lpf_tr_filter_setup (info); lpf_tr_filter_setup (info);
@@ -291,7 +324,6 @@ ssize_t send_packet (interface, packet, @@ -293,7 +326,6 @@ ssize_t send_packet (interface, packet,
double hh [16]; double hh [16];
double ih [1536 / sizeof (double)]; double ih [1536 / sizeof (double)];
unsigned char *buf = (unsigned char *)ih; unsigned char *buf = (unsigned char *)ih;
@ -135,7 +123,7 @@ diff -up dhcp-4.0.0/common/lpf.c.xen dhcp-4.0.0/common/lpf.c
int result; int result;
int fudge; int fudge;
@@ -309,15 +341,7 @@ ssize_t send_packet (interface, packet, @@ -311,15 +343,7 @@ ssize_t send_packet (interface, packet,
(unsigned char *)raw, len); (unsigned char *)raw, len);
memcpy (buf + ibufp, raw, len); memcpy (buf + ibufp, raw, len);
@ -152,7 +140,7 @@ diff -up dhcp-4.0.0/common/lpf.c.xen dhcp-4.0.0/common/lpf.c
if (result < 0) if (result < 0)
log_error ("send_packet: %m"); log_error ("send_packet: %m");
return result; return result;
@@ -334,14 +358,35 @@ ssize_t receive_packet (interface, buf, @@ -336,14 +360,35 @@ ssize_t receive_packet (interface, buf,
{ {
int length = 0; int length = 0;
int offset = 0; int offset = 0;
@ -189,7 +177,7 @@ diff -up dhcp-4.0.0/common/lpf.c.xen dhcp-4.0.0/common/lpf.c
bufix = 0; bufix = 0;
/* Decode the physical header... */ /* Decode the physical header... */
offset = decode_hw_header (interface, ibuf, bufix, hfrom); offset = decode_hw_header (interface, ibuf, bufix, hfrom);
@@ -358,7 +403,7 @@ ssize_t receive_packet (interface, buf, @@ -360,7 +405,7 @@ ssize_t receive_packet (interface, buf,
/* Decode the IP and UDP headers... */ /* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix, from, offset = decode_udp_ip_header (interface, ibuf, bufix, from,
@ -198,21 +186,21 @@ diff -up dhcp-4.0.0/common/lpf.c.xen dhcp-4.0.0/common/lpf.c
/* If the IP or UDP checksum was bad, skip the packet... */ /* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0) if (offset < 0)
diff -up dhcp-4.0.0/common/bpf.c.xen dhcp-4.0.0/common/bpf.c diff -up dhcp-4.1.0/common/nit.c.xen dhcp-4.1.0/common/nit.c
--- dhcp-4.0.0/common/bpf.c.xen 2007-08-22 23:49:51.000000000 -1000 --- dhcp-4.1.0/common/nit.c.xen 2007-09-05 07:32:10.000000000 -1000
+++ dhcp-4.0.0/common/bpf.c 2007-12-29 06:39:09.000000000 -1000 +++ dhcp-4.1.0/common/nit.c 2009-01-06 10:41:32.000000000 -1000
@@ -482,7 +482,7 @@ ssize_t receive_packet (interface, buf, @@ -366,7 +366,7 @@ ssize_t receive_packet (interface, buf,
offset = decode_udp_ip_header (interface,
interface -> rbuf, /* Decode the IP and UDP headers... */
interface -> rbuf_offset, offset = decode_udp_ip_header (interface, ibuf, bufix,
- from, hdr.bh_caplen, &paylen); - from, length, &paylen);
+ from, hdr.bh_caplen, &paylen, 0); + from, length, &paylen, 0);
/* If the IP or UDP checksum was bad, skip the packet... */ /* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0) { if (offset < 0)
diff -up dhcp-4.0.0/common/packet.c.xen dhcp-4.0.0/common/packet.c diff -up dhcp-4.1.0/common/packet.c.xen dhcp-4.1.0/common/packet.c
--- dhcp-4.0.0/common/packet.c.xen 2007-12-29 06:37:53.000000000 -1000 --- dhcp-4.1.0/common/packet.c.xen 2009-01-06 10:41:31.000000000 -1000
+++ dhcp-4.0.0/common/packet.c 2007-12-29 06:39:20.000000000 -1000 +++ dhcp-4.1.0/common/packet.c 2009-01-06 10:41:32.000000000 -1000
@@ -210,7 +210,7 @@ ssize_t @@ -210,7 +210,7 @@ ssize_t
decode_udp_ip_header(struct interface_info *interface, decode_udp_ip_header(struct interface_info *interface,
unsigned char *buf, unsigned bufix, unsigned char *buf, unsigned bufix,
@ -231,10 +219,22 @@ diff -up dhcp-4.0.0/common/packet.c.xen dhcp-4.0.0/common/packet.c
udp_packets_bad_checksum++; udp_packets_bad_checksum++;
if (udp_packets_seen > 4 && if (udp_packets_seen > 4 &&
(udp_packets_seen / udp_packets_bad_checksum) < 2) { (udp_packets_seen / udp_packets_bad_checksum) < 2) {
diff -up dhcp-4.0.0/includes/dhcpd.h.xen dhcp-4.0.0/includes/dhcpd.h diff -up dhcp-4.1.0/common/upf.c.xen dhcp-4.1.0/common/upf.c
--- dhcp-4.0.0/includes/dhcpd.h.xen 2007-12-29 06:37:53.000000000 -1000 --- dhcp-4.1.0/common/upf.c.xen 2007-07-12 20:43:42.000000000 -1000
+++ dhcp-4.0.0/includes/dhcpd.h 2007-12-29 06:39:27.000000000 -1000 +++ dhcp-4.1.0/common/upf.c 2009-01-06 10:41:32.000000000 -1000
@@ -2561,7 +2561,7 @@ ssize_t decode_hw_header PROTO ((struct @@ -317,7 +317,7 @@ ssize_t receive_packet (interface, buf,
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix,
- from, length, &paylen);
+ from, length, &paylen, 0);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff -up dhcp-4.1.0/includes/dhcpd.h.xen dhcp-4.1.0/includes/dhcpd.h
--- dhcp-4.1.0/includes/dhcpd.h.xen 2009-01-06 10:41:32.000000000 -1000
+++ dhcp-4.1.0/includes/dhcpd.h 2009-01-06 10:41:32.000000000 -1000
@@ -2640,7 +2640,7 @@ ssize_t decode_hw_header PROTO ((struct
unsigned, struct hardware *)); unsigned, struct hardware *));
ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *, ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
unsigned, struct sockaddr_in *, unsigned, struct sockaddr_in *,

139
dhcp.spec
View File

@ -1,23 +1,18 @@
# vendor string (e.g., Fedora, EL) # vendor string (e.g., Fedora, EL)
%define vvendor Fedora %define vvendor Fedora
# Make it easy for package rebuilders to select LPF or sockets # Make it easy for package rebuilders to enable DHCPv6 support
%define netmethod USE_LPF %define dhcpv6opt --disable-dhcpv6
%define with_USE_SOCKETS %{?_with_USE_SOCKETS: 1} %{?!_with_USE_SOCKETS: 0} %define with_DHCPv6 %{?_with_DHCPv6: 1} %{?!_with_DHCPv6: 0}
%if %{with_USE_SOCKETS} %if %{with_DHCPv6}
%define netmethod USE_SOCKETS %define dhcpv6opt --enable-dhcpv6
%endif
%define with_USE_LPF %{?_with_USE_LPF: 1} %{?!_with_USE_LPF: 0}
%if %{with_USE_LPF}
%define netmethod USE_LPF
%endif %endif
Summary: Dynamic host configuration protocol software Summary: Dynamic host configuration protocol software
Name: dhcp Name: dhcp
Version: 4.0.0 Version: 4.1.0
Release: 34%{?dist} Release: 1%{?dist}
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
# dcantrell maintaining the package) made incorrect use of the epoch and # dcantrell maintaining the package) made incorrect use of the epoch and
# that's why it is at 12 now. It should have never been used, but it was. # that's why it is at 12 now. It should have never been used, but it was.
@ -36,28 +31,25 @@ Source8: dhclient-script
Source9: dhcp.schema Source9: dhcp.schema
Source10: get-ldap-patch.sh Source10: get-ldap-patch.sh
Patch0: %{name}-4.0.0-errwarn-message.patch Patch0: %{name}-4.1.0-errwarn-message.patch
Patch1: %{name}-4.0.0-ldap-configuration.patch Patch1: %{name}-4.1.0-ldap-configuration.patch
Patch2: %{name}-4.0.0-memory.patch Patch2: %{name}-4.1.0-memory.patch
Patch3: %{name}-4.0.0-options.patch Patch3: %{name}-4.1.0-options.patch
Patch4: %{name}-4.0.0-release-by-ifup.patch Patch4: %{name}-4.1.0-release-by-ifup.patch
Patch5: %{name}-4.0.0-dhclient-decline-backoff.patch Patch5: %{name}-4.1.0-dhclient-decline-backoff.patch
Patch6: %{name}-4.0.0-enable-timeout-functions.patch Patch6: %{name}-4.1.0-unicast-bootp.patch
Patch7: %{name}-4.0.0-unicast-bootp.patch Patch7: %{name}-4.1.0-failover-ports.patch
Patch8: %{name}-4.0.0-fast-timeout.patch Patch8: %{name}-4.1.0-dhclient-usage.patch
Patch9: %{name}-4.0.0-failover-ports.patch Patch9: %{name}-4.1.0-default-requested-options.patch
Patch10: %{name}-4.0.0-dhclient-usage.patch Patch10: %{name}-4.1.0-xen-checksum.patch
Patch11: %{name}-4.0.0-default-requested-options.patch Patch11: %{name}-4.1.0-dhclient-anycast.patch
Patch12: %{name}-4.0.0-xen-checksum.patch Patch12: %{name}-4.1.0-manpages.patch
Patch13: %{name}-4.0.0-dhclient-anycast.patch Patch13: %{name}-4.1.0-paths.patch
Patch14: %{name}-4.0.0-manpages.patch Patch14: %{name}-4.1.0-CLOEXEC.patch
Patch15: %{name}-4.0.0-paths.patch Patch15: %{name}-4.1.0-inherit-leases.patch
Patch16: %{name}-4.0.0-NetworkManager-crash.patch Patch16: %{name}-4.1.0-garbage-chars.patch
Patch17: %{name}-4.0.0-CLOEXEC.patch Patch17: %{name}-4.1.0-port-validation.patch
Patch18: %{name}-4.0.0-inherit-leases.patch Patch18: %{name}-4.1.0-invalid-dhclient-conf.patch
Patch19: %{name}-4.0.0-garbage-chars.patch
Patch20: %{name}-4.0.0-port-validation.patch
Patch21: %{name}-4.0.0-invalid-dhclient-conf.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: autoconf BuildRequires: autoconf
@ -111,16 +103,6 @@ Header files and API documentation for using the ISC DHCP libraries. The
libdhcpctl and libomapi static libraries are also included in this package. libdhcpctl and libomapi static libraries are also included in this package.
%prep %prep
case "%{netmethod}" in
USE_LPF|USE_SOCKETS)
continue ;;
*)
echo >&2
echo "ERROR: Only --with options supported: USE_LPF, USE_SOCKETS" >&2
echo >&2
exit 1 ;;
esac
%setup -q %setup -q
# Replace the standard ISC warning message about requesting help with an # Replace the standard ISC warning message about requesting help with an
@ -138,7 +120,7 @@ esac
# Init struct sock_prog in common/lpf.c to NULL # Init struct sock_prog in common/lpf.c to NULL
%patch2 -p1 %patch2 -p1
# Add more dhclient options (-I, -B, -H, -F, -T, -V, and -R) # Add more dhclient options (-I, -B, -H, -F, -timeout, -V, and -R)
%patch3 -p1 %patch3 -p1
# Handle releasing interfaces requested by /sbin/ifup # Handle releasing interfaces requested by /sbin/ifup
@ -149,62 +131,52 @@ esac
# backoff for an amount of time before trying again # backoff for an amount of time before trying again
%patch5 -p1 %patch5 -p1
# Enable cancel_all_timeouts() and relinquish_timeouts() regardless of
# the DEBUG_MEMORY_LEAKAGE_ON_EXIT macro
%patch6 -p1
# Support unicast BOOTP for IBM pSeries systems (and maybe others) # Support unicast BOOTP for IBM pSeries systems (and maybe others)
%patch7 -p1 %patch6 -p1
# Fast timeout for dhclient
%patch8 -p1
# Use the following IANA-registered failover ports: # Use the following IANA-registered failover ports:
# dhcp-failover 647/tcp # dhcp-failover 647/tcp
# dhcp-failover 647/udp # dhcp-failover 647/udp
# dhcp-failover 847/tcp # dhcp-failover 847/tcp
# dhcp-failover 847/udp # dhcp-failover 847/udp
%patch9 -p1 %patch7 -p1
# Update the usage screen for dhclient(8) indicating new options # Update the usage screen for dhclient(8) indicating new options
# Use printf() rather than log_info() to display the information # Use printf() rather than log_info() to display the information
# Also, return EXIT_FAILURE when the usage() screen is displayed (stop parsing) # Also, return EXIT_FAILURE when the usage() screen is displayed (stop parsing)
%patch10 -p1 %patch8 -p1
# Add NIS domain, NIS servers, and NTP servers to the list of default # Add NIS domain, NIS servers, and NTP servers to the list of default
# requested DHCP options # requested DHCP options
%patch11 -p1 %patch9 -p1
# Handle Xen partial UDP checksums # Handle Xen partial UDP checksums
%patch12 -p1 %patch10 -p1
# Add anycast support to dhclient (for OLPC) # Add anycast support to dhclient (for OLPC)
%patch13 -p1 %patch11 -p1
# Patch man page contents # Patch man page contents
%patch14 -p1 %patch12 -p1
# Change paths to conform to our standards # Change paths to conform to our standards
%patch15 -p1 %patch13 -p1
# Avoid crash when dhclient is run with NetworkManager
%patch16 -p1
# Make sure all open file descriptors are closed-on-exec for SELinux (#446632) # Make sure all open file descriptors are closed-on-exec for SELinux (#446632)
%patch17 -p1 %patch14 -p1
# If we have an active lease, do not down the interface (#453982) # If we have an active lease, do not down the interface (#453982)
%patch18 -p1 %patch15 -p1
# Fix 'garbage in format string' error (#450052) # Fix 'garbage in format string' error (#450052)
%patch19 -p1 %patch16 -p1
# Validate port numbers specified for dhclient, dhcpd, and dhcrelay # Validate port numbers specified for dhclient, dhcpd, and dhcrelay
# to make sure they are within 1-65535, inclusive. (#438149) # to make sure they are within 1-65535, inclusive. (#438149)
%patch20 -p1 %patch17 -p1
# The sample dhclient.conf should say 'supersede domain-search' (#467955) # The sample dhclient.conf should say 'supersede domain-search' (#467955)
%patch21 -p1 %patch18 -p1
# Copy in documentation and example scripts for LDAP patch to dhcpd # Copy in documentation and example scripts for LDAP patch to dhcpd
%{__install} -p -m 0644 %{SOURCE3} . %{__install} -p -m 0644 %{SOURCE3} .
@ -249,14 +221,14 @@ for page in client/dhclient.conf.5 client/dhclient.leases.5 \
%{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \ %{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \
-e 's|RUNDIR|%{_localstatedir}/run|g' \ -e 's|RUNDIR|%{_localstatedir}/run|g' \
-e 's|DBDIR|%{_localstatedir}/db/dhclient|g' \ -e 's|DBDIR|%{_localstatedir}/db/dhclient|g' \
-e 's|ETCDIR|%{_sysconfdir}|g' $page -e 's|ETCDIR|%{_sysconfdir}/dhcp|g' $page
done done
for page in server/dhcpd.conf.5 server/dhcpd.leases.5 server/dhcpd.8 ; do for page in server/dhcpd.conf.5 server/dhcpd.leases.5 server/dhcpd.8 ; do
%{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \ %{__sed} -i -e 's|CLIENTBINDIR|/sbin|g' \
-e 's|RUNDIR|%{_localstatedir}/run|g' \ -e 's|RUNDIR|%{_localstatedir}/run|g' \
-e 's|DBDIR|%{_localstatedir}/db/dhcpd|g' \ -e 's|DBDIR|%{_localstatedir}/db/dhcpd|g' \
-e 's|ETCDIR|%{_sysconfdir}|g' $page -e 's|ETCDIR|%{_sysconfdir}/dhcp|g' $page
done done
aclocal aclocal
@ -266,9 +238,9 @@ autoheader
automake --foreign --add-missing --copy automake --foreign --add-missing --copy
%build %build
CFLAGS="%{optflags} -fPIC -D_GNU_SOURCE -DUSE_SSL=1 -D%{netmethod}=1" \ CFLAGS="%{optflags} -fPIC -D_GNU_SOURCE -DLDAP_CONFIGURATION -DUSE_SSL" \
%configure \ %configure \
--disable-dhcpv6 \ %{dhcpv6opt} \
--with-srv-lease-file=%{_localstatedir}/lib/dhcpd/dhcpd.leases \ --with-srv-lease-file=%{_localstatedir}/lib/dhcpd/dhcpd.leases \
--with-cli-lease-file=%{_localstatedir}/lib/dhclient/dhclient.leases \ --with-cli-lease-file=%{_localstatedir}/lib/dhclient/dhclient.leases \
--with-srv-pid-file=%{_localstatedir}/run/dhcpd.pid \ --with-srv-pid-file=%{_localstatedir}/run/dhcpd.pid \
@ -336,9 +308,23 @@ EOF
%{__rm} -rf %{buildroot} %{__rm} -rf %{buildroot}
%post %post
if [ -f /etc/dhcpd.conf ]; then
/bin/cp -a /etc/dhcpd.conf /etc/dhcp/dhcpd.conf >/dev/null 2>&1
/bin/rm -f /etc/dhcpd.conf >/dev/null 2>&1
fi
/sbin/chkconfig --add dhcpd /sbin/chkconfig --add dhcpd
/sbin/chkconfig --add dhcrelay || : /sbin/chkconfig --add dhcrelay || :
%post -n dhclient
/bin/ls -1 /etc/dhclient* >/dev/null 2>&1
if [ $? = 0 ]; then
/bin/ls -1 /etc/dhclient* 2>/dev/null | while read etcfile ; do
/bin/cp -a "${etcfile}" /etc/dhcp
/bin/rm -f "${etcfile}"
done || :
fi || :
%preun %preun
if [ $1 = 0 ]; then if [ $1 = 0 ]; then
/sbin/service dhcpd status >/dev/null 2>&1 /sbin/service dhcpd status >/dev/null 2>&1
@ -410,6 +396,15 @@ fi
%attr(0644,root,root) %{_mandir}/man3/omapi.3.gz %attr(0644,root,root) %{_mandir}/man3/omapi.3.gz
%changelog %changelog
* Tue Jan 06 2009 David Cantrell <dcantrell@redhat.com> - 12:4.1.0-1
- Upgraded to ISC dhcp-4.1.0
- Had to rename the -T option to -timeout as ISC is now using -T
- Allow package rebuilders to easily enable DHCPv6 support with:
rpmbuild --with DHCPv6 dhcp.spec
Note that Fedora is still using the 'dhcpv6' package, but some
users may want to experiment with the ISC DHCPv6 implementation
locally.
* Thu Dec 18 2008 David Cantrell <dcantrell@redhat.com> - 12:4.0.0-34 * Thu Dec 18 2008 David Cantrell <dcantrell@redhat.com> - 12:4.0.0-34
- Move /etc/dhclient.conf to /etc/dhcp/dhclient.conf - Move /etc/dhclient.conf to /etc/dhcp/dhclient.conf
- Move /etc/dhcpd.conf to /etc/dhcp/dhcpd.conf - Move /etc/dhcpd.conf to /etc/dhcp/dhcpd.conf

View File

@ -46,7 +46,7 @@ findConfig() {
continue continue
fi fi
done done
echo "/etc/dhcpd.conf" echo "/etc/dhcp/dhcpd.conf"
} }
conf="$(findConfig "$DHCPDARGS")" conf="$(findConfig "$DHCPDARGS")"

View File

@ -1 +1 @@
31d79b27ce4a94089a0b9ce7f72307fa dhcp-4.0.0.tar.gz 1fffed2e8c3d67b111316d6a9b33db7a dhcp-4.1.0.tar.gz