From ae22e956cf13bb0c7950b54d60ae413a57ce93c1 Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Jan 23 2014 14:56:58 +0000 Subject: 4.2.6b1 --- diff --git a/.gitignore b/.gitignore index 28a1b93..851ff0b 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ /dhcp-4.2.4-P2.tar.gz /dhcp-4.2.5rc1.tar.gz /dhcp-4.2.5.tar.gz +/dhcp-4.2.6b1.tar.gz diff --git a/dhcp-4.2.0-errwarn-message.patch b/dhcp-4.2.0-errwarn-message.patch deleted file mode 100644 index a0f70cd..0000000 --- a/dhcp-4.2.0-errwarn-message.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff -up dhcp-4.2.0/omapip/errwarn.c.errwarn dhcp-4.2.0/omapip/errwarn.c ---- dhcp-4.2.0/omapip/errwarn.c.errwarn 2009-07-23 20:52:21.000000000 +0200 -+++ dhcp-4.2.0/omapip/errwarn.c 2010-07-21 13:23:47.000000000 +0200 -@@ -76,20 +76,13 @@ void log_fatal (const char * fmt, ... ) - - #if !defined (NOMINUM) - log_error ("%s", ""); -- log_error ("If you did not get this software from ftp.isc.org, please"); -- log_error ("get the latest from ftp.isc.org and install that before"); -- log_error ("requesting help."); -+ log_error ("This version of ISC DHCP is based on the release available"); -+ log_error ("on ftp.isc.org. Features have been added and other changes"); -+ log_error ("have been made to the base software release in order to make"); -+ log_error ("it work better with this distribution."); - log_error ("%s", ""); -- log_error ("If you did get this software from ftp.isc.org and have not"); -- log_error ("yet read the README, please read it before requesting help."); -- log_error ("If you intend to request help from the dhcp-server@isc.org"); -- log_error ("mailing list, please read the section on the README about"); -- log_error ("submitting bug reports and requests for help."); -- log_error ("%s", ""); -- log_error ("Please do not under any circumstances send requests for"); -- log_error ("help directly to the authors of this software - please"); -- log_error ("send them to the appropriate mailing list as described in"); -- log_error ("the README file."); -+ log_error ("Please report for this software via the Red Hat Bugzilla site:"); -+ log_error (" http://bugzilla.redhat.com"); - log_error ("%s", ""); - log_error ("exiting."); - #endif diff --git a/dhcp-4.2.0-release-by-ifup.patch b/dhcp-4.2.0-release-by-ifup.patch deleted file mode 100644 index 300c5f3..0000000 --- a/dhcp-4.2.0-release-by-ifup.patch +++ /dev/null @@ -1,85 +0,0 @@ -diff -up dhcp-4.2.0/client/dhclient.c.ifup dhcp-4.2.0/client/dhclient.c ---- dhcp-4.2.0/client/dhclient.c.ifup 2010-07-21 13:30:10.000000000 +0200 -+++ dhcp-4.2.0/client/dhclient.c 2010-07-21 13:37:03.000000000 +0200 -@@ -497,9 +497,81 @@ main(int argc, char **argv) { - kill(oldpid, SIGTERM); - } - fclose(pidfd); -+ } else { -+ /* handle release for interfaces requested with Red Hat -+ * /sbin/ifup - pidfile will be /var/run/dhclient-$interface.pid -+ */ -+ -+ if ((path_dhclient_pid == NULL) || (*path_dhclient_pid == '\0')) -+ path_dhclient_pid = "/var/run/dhclient.pid"; -+ -+ char *new_path_dhclient_pid; -+ struct interface_info *ip; -+ int pdp_len = strlen(path_dhclient_pid), pfx, dpfx; -+ -+ /* find append point: beginning of any trailing '.pid' -+ * or '-$IF.pid' */ -+ for (pfx=pdp_len; (pfx >= 0) && (path_dhclient_pid[pfx] != '.') && (path_dhclient_pid[pfx] != '/'); pfx--); -+ if (pfx == -1) -+ pfx = pdp_len; -+ -+ if (path_dhclient_pid[pfx] == '/') -+ pfx += 1; -+ -+ for (dpfx=pfx; (dpfx >= 0) && (path_dhclient_pid[dpfx] != '-') && (path_dhclient_pid[dpfx] != '/'); dpfx--); -+ if ((dpfx > -1) && (path_dhclient_pid[dpfx] != '/')) -+ pfx = dpfx; -+ -+ for (ip = interfaces; ip; ip = ip->next) { -+ if (interfaces_requested && (ip->flags & (INTERFACE_REQUESTED))) { -+ int n_len = strlen(ip->name); -+ -+ new_path_dhclient_pid = (char*) malloc(pfx + n_len + 6); -+ strncpy(new_path_dhclient_pid, path_dhclient_pid, pfx); -+ sprintf(new_path_dhclient_pid + pfx, "-%s.pid", ip->name); -+ -+ if ((pidfd = fopen(new_path_dhclient_pid, "r")) != NULL) { -+ e = fscanf(pidfd, "%ld\n", &temp); -+ oldpid = (pid_t)temp; -+ -+ if (e != 0 && e != EOF) { -+ if (oldpid) { -+ if (kill(oldpid, SIGTERM) == 0) -+ unlink(path_dhclient_pid); -+ } -+ } -+ -+ fclose(pidfd); -+ } -+ -+ free(new_path_dhclient_pid); -+ } -+ } -+ } -+ } else { -+ FILE *pidfp = NULL; -+ long temp = 0; -+ pid_t dhcpid = 0; -+ int dhc_running = 0; -+ char procfn[256] = ""; -+ -+ if ((pidfp = fopen(path_dhclient_pid, "r")) != NULL) { -+ if ((fscanf(pidfp, "%ld", &temp)==1) && ((dhcpid=(pid_t)temp) > 0)) { -+ snprintf(procfn,256,"/proc/%u",dhcpid); -+ dhc_running = (access(procfn, F_OK) == 0); -+ } -+ -+ fclose(pidfp); -+ } -+ -+ if (dhc_running) { -+ log_fatal("dhclient(%u) is already running - exiting. ", dhcpid); -+ return(1); - } - } - -+ write_client_pid_file(); -+ - if (!quiet) { - log_info("%s %s", message, PACKAGE_VERSION); - log_info(copyright); diff --git a/dhcp-4.2.2-CLOEXEC.patch b/dhcp-4.2.2-CLOEXEC.patch deleted file mode 100644 index 1f4538e..0000000 --- a/dhcp-4.2.2-CLOEXEC.patch +++ /dev/null @@ -1,342 +0,0 @@ -diff -up dhcp-4.2.2b1/client/clparse.c.cloexec dhcp-4.2.2b1/client/clparse.c ---- dhcp-4.2.2b1/client/clparse.c.cloexec 2011-07-01 14:13:30.973887714 +0200 -+++ dhcp-4.2.2b1/client/clparse.c 2011-07-01 14:15:15.021580693 +0200 -@@ -246,7 +246,7 @@ int read_client_conf_file (const char *n - int token; - isc_result_t status; - -- if ((file = open (name, O_RDONLY)) < 0) -+ if ((file = open (name, O_RDONLY | O_CLOEXEC)) < 0) - return uerr2isc (errno); - - cfile = NULL; -@@ -283,7 +283,7 @@ void read_client_leases () - - /* Open the lease file. If we can't open it, just return - - 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 | O_CLOEXEC)) < 0) - return; - - cfile = NULL; -diff -up dhcp-4.2.2b1/client/dhclient.c.cloexec dhcp-4.2.2b1/client/dhclient.c ---- dhcp-4.2.2b1/client/dhclient.c.cloexec 2011-07-01 14:13:30.970887717 +0200 -+++ dhcp-4.2.2b1/client/dhclient.c 2011-07-01 14:16:51.485930388 +0200 -@@ -148,11 +148,11 @@ main(int argc, char **argv) { - /* Make sure that file descriptors 0 (stdin), 1, (stdout), and - 2 (stderr) are open. To do this, we assume that when we - open a file the lowest available file descriptor is used. */ -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 0) -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 1) -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 2) - log_perror = 0; /* No sense logging to /dev/null. */ - else if (fd != -1) -@@ -506,7 +506,7 @@ main(int argc, char **argv) { - int e; - - oldpid = 0; -- if ((pidfd = fopen(path_dhclient_pid, "r")) != NULL) { -+ if ((pidfd = fopen(path_dhclient_pid, "re")) != NULL) { - e = fscanf(pidfd, "%ld\n", &temp); - oldpid = (pid_t)temp; - -@@ -548,7 +548,7 @@ main(int argc, char **argv) { - strncpy(new_path_dhclient_pid, path_dhclient_pid, pfx); - sprintf(new_path_dhclient_pid + pfx, "-%s.pid", ip->name); - -- if ((pidfd = fopen(new_path_dhclient_pid, "r")) != NULL) { -+ if ((pidfd = fopen(new_path_dhclient_pid, "re")) != NULL) { - e = fscanf(pidfd, "%ld\n", &temp); - oldpid = (pid_t)temp; - -@@ -573,7 +573,7 @@ main(int argc, char **argv) { - int dhc_running = 0; - char procfn[256] = ""; - -- if ((pidfp = fopen(path_dhclient_pid, "r")) != NULL) { -+ if ((pidfp = fopen(path_dhclient_pid, "re")) != NULL) { - if ((fscanf(pidfp, "%ld", &temp)==1) && ((dhcpid=(pid_t)temp) > 0)) { - snprintf(procfn,256,"/proc/%u",dhcpid); - dhc_running = (access(procfn, F_OK) == 0); -@@ -2995,7 +2995,7 @@ void rewrite_client_leases () - - if (leaseFile != NULL) - fclose (leaseFile); -- 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; -@@ -3105,7 +3105,7 @@ write_duid(struct data_string *duid) - return DHCP_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; -@@ -3285,7 +3285,7 @@ int write_client_lease (client, lease, r - return 1; - - 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 0; -@@ -3772,9 +3772,9 @@ void go_daemon () - close(2); - - /* Reopen them on /dev/null. */ -- open("/dev/null", O_RDWR); -- open("/dev/null", O_RDWR); -- open("/dev/null", O_RDWR); -+ open("/dev/null", O_RDWR | O_CLOEXEC); -+ open("/dev/null", O_RDWR | O_CLOEXEC); -+ open("/dev/null", O_RDWR | O_CLOEXEC); - - write_client_pid_file (); - -@@ -3791,14 +3791,14 @@ void write_client_pid_file () - return; - } - -- pfdesc = open (path_dhclient_pid, O_CREAT | O_TRUNC | O_WRONLY, 0644); -+ pfdesc = open (path_dhclient_pid, O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, 0644); - - if (pfdesc < 0) { - log_error ("Can't create %s: %m", path_dhclient_pid); - return; - } - -- pf = fdopen (pfdesc, "w"); -+ pf = fdopen (pfdesc, "we"); - if (!pf) { - close(pfdesc); - log_error ("Can't fdopen %s: %m", path_dhclient_pid); -diff -up dhcp-4.2.2b1/common/bpf.c.cloexec dhcp-4.2.2b1/common/bpf.c ---- dhcp-4.2.2b1/common/bpf.c.cloexec 2011-07-01 14:13:30.976887712 +0200 -+++ dhcp-4.2.2b1/common/bpf.c 2011-07-01 14:13:31.030887673 +0200 -@@ -94,7 +94,7 @@ int if_register_bpf (info) - for (b = 0; 1; b++) { - /* %Audit% 31 bytes max. %2004.06.17,Safe% */ - sprintf(filename, BPF_FORMAT, b); -- sock = open (filename, O_RDWR, 0); -+ sock = open (filename, O_RDWR | O_CLOEXEC, 0); - if (sock < 0) { - if (errno == EBUSY) { - continue; -diff -up dhcp-4.2.2b1/common/dlpi.c.cloexec dhcp-4.2.2b1/common/dlpi.c ---- dhcp-4.2.2b1/common/dlpi.c.cloexec 2011-07-01 14:13:30.977887712 +0200 -+++ dhcp-4.2.2b1/common/dlpi.c 2011-07-01 14:13:31.032887673 +0200 -@@ -806,7 +806,7 @@ dlpiopen(const char *ifname) { - } - *dp = '\0'; - -- return open (devname, O_RDWR, 0); -+ return open (devname, O_RDWR | O_CLOEXEC, 0); - } - - /* -diff -up dhcp-4.2.2b1/common/nit.c.cloexec dhcp-4.2.2b1/common/nit.c ---- dhcp-4.2.2b1/common/nit.c.cloexec 2011-07-01 14:13:30.978887712 +0200 -+++ dhcp-4.2.2b1/common/nit.c 2011-07-01 14:13:31.033887672 +0200 -@@ -81,7 +81,7 @@ int if_register_nit (info) - struct strioctl sio; - - /* Open a NIT device */ -- sock = open ("/dev/nit", O_RDWR); -+ sock = open ("/dev/nit", O_RDWR | O_CLOEXEC); - if (sock < 0) - log_fatal ("Can't open NIT device for %s: %m", info -> name); - -diff -up dhcp-4.2.2b1/common/resolv.c.cloexec dhcp-4.2.2b1/common/resolv.c ---- dhcp-4.2.2b1/common/resolv.c.cloexec 2009-11-20 02:49:01.000000000 +0100 -+++ dhcp-4.2.2b1/common/resolv.c 2011-07-01 14:13:31.033887672 +0200 -@@ -49,7 +49,7 @@ void read_resolv_conf (parse_time) - 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 | O_CLOEXEC)) < 0) { - log_error ("Can't open %s: %m", path_resolv_conf); - return; - } -diff -up dhcp-4.2.2b1/common/upf.c.cloexec dhcp-4.2.2b1/common/upf.c ---- dhcp-4.2.2b1/common/upf.c.cloexec 2011-07-01 14:13:30.979887712 +0200 -+++ dhcp-4.2.2b1/common/upf.c 2011-07-01 14:13:31.034887671 +0200 -@@ -77,7 +77,7 @@ int if_register_upf (info) - /* %Audit% Cannot exceed 36 bytes. %2004.06.17,Safe% */ - sprintf(filename, "/dev/pf/pfilt%d", b); - -- sock = open (filename, O_RDWR, 0); -+ sock = open (filename, O_RDWR | O_CLOEXEC, 0); - if (sock < 0) { - if (errno == EBUSY) { - continue; -diff -up dhcp-4.2.2b1/omapip/trace.c.cloexec dhcp-4.2.2b1/omapip/trace.c ---- dhcp-4.2.2b1/omapip/trace.c.cloexec 2010-05-27 02:34:57.000000000 +0200 -+++ dhcp-4.2.2b1/omapip/trace.c 2011-07-01 14:13:31.036887669 +0200 -@@ -141,10 +141,10 @@ isc_result_t trace_begin (const char *fi - return DHCP_R_INVALIDARG; - } - -- traceoutfile = open (filename, O_CREAT | O_WRONLY | O_EXCL, 0600); -+ traceoutfile = open (filename, O_CREAT | O_WRONLY | O_EXCL | O_CLOEXEC, 0600); - if (traceoutfile < 0 && errno == EEXIST) { - log_error ("WARNING: Overwriting trace file \"%s\"", filename); -- traceoutfile = open (filename, O_WRONLY | O_EXCL | O_TRUNC, -+ traceoutfile = open (filename, O_WRONLY | O_EXCL | O_TRUNC | O_CLOEXEC, - 0600); - } - -@@ -431,7 +431,7 @@ void trace_file_replay (const char *file - isc_result_t result; - int len; - -- traceinfile = fopen (filename, "r"); -+ traceinfile = fopen (filename, "re"); - if (!traceinfile) { - log_error("Can't open tracefile %s: %m", filename); - return; -diff -up dhcp-4.2.2b1/relay/dhcrelay.c.cloexec dhcp-4.2.2b1/relay/dhcrelay.c ---- dhcp-4.2.2b1/relay/dhcrelay.c.cloexec 2011-05-10 15:07:37.000000000 +0200 -+++ dhcp-4.2.2b1/relay/dhcrelay.c 2011-07-01 14:18:07.630209767 +0200 -@@ -183,11 +183,11 @@ main(int argc, char **argv) { - /* Make sure that file descriptors 0(stdin), 1,(stdout), and - 2(stderr) are open. To do this, we assume that when we - open a file the lowest available file descriptor is used. */ -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 0) -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 1) -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 2) - log_perror = 0; /* No sense logging to /dev/null. */ - else if (fd != -1) -@@ -540,13 +540,13 @@ main(int argc, char **argv) { - - if (no_pid_file == ISC_FALSE) { - pfdesc = open(path_dhcrelay_pid, -- O_CREAT | O_TRUNC | O_WRONLY, 0644); -+ O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, 0644); - - if (pfdesc < 0) { - log_error("Can't create %s: %m", - path_dhcrelay_pid); - } else { -- pf = fdopen(pfdesc, "w"); -+ pf = fdopen(pfdesc, "we"); - if (!pf) - log_error("Can't fdopen %s: %m", - path_dhcrelay_pid); -diff -up dhcp-4.2.2b1/server/confpars.c.cloexec dhcp-4.2.2b1/server/confpars.c ---- dhcp-4.2.2b1/server/confpars.c.cloexec 2010-10-14 00:34:45.000000000 +0200 -+++ dhcp-4.2.2b1/server/confpars.c 2011-07-01 14:13:31.039887666 +0200 -@@ -116,7 +116,7 @@ isc_result_t read_conf_file (const char - } - #endif - -- if ((file = open (filename, O_RDONLY)) < 0) { -+ if ((file = open (filename, O_RDONLY | O_CLOEXEC)) < 0) { - if (leasep) { - log_error ("Can't open lease database %s: %m --", - path_dhcpd_db); -diff -up dhcp-4.2.2b1/server/db.c.cloexec dhcp-4.2.2b1/server/db.c ---- dhcp-4.2.2b1/server/db.c.cloexec 2010-09-14 00:15:26.000000000 +0200 -+++ dhcp-4.2.2b1/server/db.c 2011-07-01 14:13:31.040887665 +0200 -@@ -1035,7 +1035,7 @@ void db_startup (testp) - } - #endif - if (!testp) { -- db_file = fopen (path_dhcpd_db, "a"); -+ db_file = fopen (path_dhcpd_db, "ae"); - if (!db_file) - log_fatal ("Can't open %s for append.", path_dhcpd_db); - expire_all_pools (); -@@ -1083,12 +1083,12 @@ int new_lease_file () - path_dhcpd_db, (int)t) >= sizeof newfname) - log_fatal("new_lease_file: lease file path too long"); - -- db_fd = open (newfname, O_WRONLY | O_TRUNC | O_CREAT, 0664); -+ db_fd = open (newfname, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, 0664); - if (db_fd < 0) { - log_error ("Can't create new lease file: %m"); - return 0; - } -- if ((new_db_file = fdopen(db_fd, "w")) == NULL) { -+ if ((new_db_file = fdopen(db_fd, "we")) == NULL) { - log_error("Can't fdopen new lease file: %m"); - close(db_fd); - goto fdfail; -diff -up dhcp-4.2.2b1/server/dhcpd.c.cloexec dhcp-4.2.2b1/server/dhcpd.c ---- dhcp-4.2.2b1/server/dhcpd.c.cloexec 2011-04-21 16:08:15.000000000 +0200 -+++ dhcp-4.2.2b1/server/dhcpd.c 2011-07-01 14:19:40.354124505 +0200 -@@ -270,11 +270,11 @@ main(int argc, char **argv) { - /* Make sure that file descriptors 0 (stdin), 1, (stdout), and - 2 (stderr) are open. To do this, we assume that when we - open a file the lowest available file descriptor is used. */ -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 0) -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 1) -- fd = open("/dev/null", O_RDWR); -+ fd = open("/dev/null", O_RDWR | O_CLOEXEC); - if (fd == 2) - log_perror = 0; /* No sense logging to /dev/null. */ - else if (fd != -1) -@@ -793,7 +793,7 @@ main(int argc, char **argv) { - */ - if (no_pid_file == ISC_FALSE) { - /*Read previous pid file. */ -- if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) { -+ if ((i = open (path_dhcpd_pid, O_RDONLY | O_CLOEXEC)) >= 0) { - status = read(i, pbuf, (sizeof pbuf) - 1); - close (i); - if (status > 0) { -@@ -812,7 +812,7 @@ main(int argc, char **argv) { - } - - /* Write new pid file. */ -- i = open(path_dhcpd_pid, O_WRONLY|O_CREAT|O_TRUNC, 0644); -+ i = open(path_dhcpd_pid, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0644); - if (i >= 0) { - sprintf(pbuf, "%d\n", (int) getpid()); - IGNORE_RET (write(i, pbuf, strlen(pbuf))); -@@ -840,9 +840,9 @@ main(int argc, char **argv) { - close(2); - - /* Reopen them on /dev/null. */ -- open("/dev/null", O_RDWR); -- open("/dev/null", O_RDWR); -- open("/dev/null", O_RDWR); -+ open("/dev/null", O_RDWR | O_CLOEXEC); -+ open("/dev/null", O_RDWR | O_CLOEXEC); -+ open("/dev/null", O_RDWR | O_CLOEXEC); - log_perror = 0; /* No sense logging to /dev/null. */ - - IGNORE_RET (chdir("/")); -diff -up dhcp-4.2.2b1/server/ldap.c.cloexec dhcp-4.2.2b1/server/ldap.c ---- dhcp-4.2.2b1/server/ldap.c.cloexec 2010-03-25 16:26:58.000000000 +0100 -+++ dhcp-4.2.2b1/server/ldap.c 2011-07-01 14:13:31.043887665 +0200 -@@ -685,7 +685,7 @@ ldap_start (void) - - if (ldap_debug_file != NULL && ldap_debug_fd == -1) - { -- if ((ldap_debug_fd = open (ldap_debug_file, O_CREAT | O_TRUNC | O_WRONLY, -+ if ((ldap_debug_fd = open (ldap_debug_file, O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, - S_IRUSR | S_IWUSR)) < 0) - log_error ("Error opening debug LDAP log file %s: %s", ldap_debug_file, - strerror (errno)); diff --git a/dhcp-4.2.2-capability.patch b/dhcp-4.2.2-capability.patch deleted file mode 100644 index db2fb38..0000000 --- a/dhcp-4.2.2-capability.patch +++ /dev/null @@ -1,250 +0,0 @@ -diff -up dhcp-4.2.2b1/client/dhclient.8.capability dhcp-4.2.2b1/client/dhclient.8 ---- dhcp-4.2.2b1/client/dhclient.8.capability 2011-07-01 15:09:06.603784531 +0200 -+++ dhcp-4.2.2b1/client/dhclient.8 2011-07-01 15:09:06.663783913 +0200 -@@ -118,6 +118,9 @@ dhclient - Dynamic Host Configuration Pr - .B -w - ] - [ -+.B -nc -+] -+[ - .B -B - ] - [ -@@ -296,6 +299,32 @@ has been added or removed, so that the c - address on that interface. - - .TP -+.BI \-nc -+Do not drop capabilities. -+ -+Normally, if -+.B dhclient -+was compiled with libcap-ng support, -+.B dhclient -+drops most capabilities immediately upon startup. While more secure, -+this greatly restricts the additional actions that hooks in -+.B dhclient-script (8) -+can take. (For example, any daemons that -+.B dhclient-script (8) -+starts or restarts will inherit the restricted capabilities as well, -+which may interfere with their correct operation.) Thus, the -+.BI \-nc -+option can be used to prevent -+.B dhclient -+from dropping capabilities. -+ -+The -+.BI \-nc -+option is ignored if -+.B dhclient -+was not compiled with libcap-ng support. -+ -+.TP - .BI \-B - Set the BOOTP broadcast flag in request packets so servers will always - broadcast replies. -diff -up dhcp-4.2.2b1/client/dhclient.c.capability dhcp-4.2.2b1/client/dhclient.c ---- dhcp-4.2.2b1/client/dhclient.c.capability 2011-07-01 15:09:06.644784107 +0200 -+++ dhcp-4.2.2b1/client/dhclient.c 2011-07-01 15:09:06.664783903 +0200 -@@ -39,6 +39,10 @@ - #include - #include - -+#ifdef HAVE_LIBCAP_NG -+#include -+#endif -+ - /* - * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define - * that when building ISC code. -@@ -141,6 +145,9 @@ main(int argc, char **argv) { - int timeout_arg = 0; - char *arg_conf = NULL; - int arg_conf_len = 0; -+#ifdef HAVE_LIBCAP_NG -+ int keep_capabilities = 0; -+#endif - - /* Initialize client globals. */ - memset(&default_duid, 0, sizeof(default_duid)); -@@ -410,6 +417,10 @@ main(int argc, char **argv) { - } - - dhclient_request_options = argv[i]; -+ } else if (!strcmp(argv[i], "-nc")) { -+#ifdef HAVE_LIBCAP_NG -+ keep_capabilities = 1; -+#endif - } else if (argv[i][0] == '-') { - usage(); - } else if (interfaces_requested < 0) { -@@ -458,6 +469,19 @@ main(int argc, char **argv) { - path_dhclient_script = s; - } - -+#ifdef HAVE_LIBCAP_NG -+ /* Drop capabilities */ -+ if (!keep_capabilities) { -+ capng_clear(CAPNG_SELECT_CAPS); -+ capng_update(CAPNG_ADD, CAPNG_EFFECTIVE|CAPNG_PERMITTED, -+ CAP_DAC_OVERRIDE); // Drop this someday -+ capng_updatev(CAPNG_ADD, CAPNG_EFFECTIVE|CAPNG_PERMITTED, -+ CAP_NET_ADMIN, CAP_NET_RAW, -+ CAP_NET_BIND_SERVICE, CAP_SYS_ADMIN, -1); -+ capng_apply(CAPNG_SELECT_CAPS); -+ } -+#endif -+ - /* Set up the initial dhcp option universe. */ - initialize_common_option_spaces(); - -diff -up dhcp-4.2.2b1/client/dhclient-script.8.capability dhcp-4.2.2b1/client/dhclient-script.8 ---- dhcp-4.2.2b1/client/dhclient-script.8.capability 2011-07-01 15:09:06.604784521 +0200 -+++ dhcp-4.2.2b1/client/dhclient-script.8 2011-07-01 15:09:06.666783883 +0200 -@@ -239,6 +239,16 @@ repeatedly initialized to the values pro - the other. Assuming the information provided by both servers is - valid, this shouldn't cause any real problems, but it could be - confusing. -+.PP -+Normally, if dhclient was compiled with libcap-ng support, -+dhclient drops most capabilities immediately upon startup. -+While more secure, this greatly restricts the additional actions that -+hooks in dhclient-script can take. For example, any daemons that -+dhclient-script starts or restarts will inherit the restricted -+capabilities as well, which may interfere with their correct operation. -+Thus, the -+.BI \-nc -+option can be used to prevent dhclient from dropping capabilities. - .SH SEE ALSO - dhclient(8), dhcpd(8), dhcrelay(8), dhclient.conf(5) and - dhclient.leases(5). -diff -up dhcp-4.2.2b1/client/Makefile.am.capability dhcp-4.2.2b1/client/Makefile.am ---- dhcp-4.2.2b1/client/Makefile.am.capability 2011-07-01 15:09:06.526785327 +0200 -+++ dhcp-4.2.2b1/client/Makefile.am 2011-07-01 15:09:06.667783873 +0200 -@@ -5,7 +5,7 @@ dhclient_SOURCES = clparse.c dhclient.c - scripts/netbsd scripts/nextstep scripts/openbsd \ - scripts/solaris scripts/openwrt - dhclient_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ -- $(BIND9_LIBDIR) -ldns-export -lisc-export -+ $(BIND9_LIBDIR) -ldns-export -lisc-export $(CAPNG_LDADD) - man_MANS = dhclient.8 dhclient-script.8 dhclient.conf.5 dhclient.leases.5 - EXTRA_DIST = $(man_MANS) - -diff -up dhcp-4.2.2b1/configure.ac.capability dhcp-4.2.2b1/configure.ac ---- dhcp-4.2.2b1/configure.ac.capability 2011-07-01 15:09:06.527785317 +0200 -+++ dhcp-4.2.2b1/configure.ac 2011-07-01 15:09:06.667783873 +0200 -@@ -449,6 +449,41 @@ AC_TRY_LINK( - # Look for optional headers. - AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h) - -+# look for capabilities library -+AC_ARG_WITH(libcap-ng, -+ [ --with-libcap-ng=[auto/yes/no] Add Libcap-ng support [default=auto]],, -+ with_libcap_ng=auto) -+ -+# Check for Libcap-ng API -+# -+# libcap-ng detection -+if test x$with_libcap_ng = xno ; then -+ have_libcap_ng=no; -+else -+ # Start by checking for header file -+ AC_CHECK_HEADER(cap-ng.h, capng_headers=yes, capng_headers=no) -+ -+ # See if we have libcap-ng library -+ AC_CHECK_LIB(cap-ng, capng_clear, -+ CAPNG_LDADD=-lcap-ng,) -+ -+ # Check results are usable -+ if test x$with_libcap_ng = xyes -a x$CAPNG_LDADD = x ; then -+ AC_MSG_ERROR(libcap-ng support was requested and the library was not found) -+ fi -+ if test x$CAPNG_LDADD != x -a $capng_headers = no ; then -+ AC_MSG_ERROR(libcap-ng libraries found but headers are missing) -+ fi -+fi -+AC_SUBST(CAPNG_LDADD) -+AC_MSG_CHECKING(whether to use libcap-ng) -+if test x$CAPNG_LDADD != x ; then -+ AC_DEFINE(HAVE_LIBCAP_NG,1,[libcap-ng support]) -+ AC_MSG_RESULT(yes) -+else -+ AC_MSG_RESULT(no) -+fi -+ - # Solaris needs some libraries for functions - AC_SEARCH_LIBS(socket, [socket]) - AC_SEARCH_LIBS(inet_ntoa, [nsl]) -diff -up dhcp-4.2.2b1/relay/dhcrelay.c.capability dhcp-4.2.2b1/relay/dhcrelay.c ---- dhcp-4.2.2b1/relay/dhcrelay.c.capability 2011-07-01 15:09:06.626784295 +0200 -+++ dhcp-4.2.2b1/relay/dhcrelay.c 2011-07-01 15:12:05.362223794 +0200 -@@ -36,6 +36,11 @@ - #include - #include - -+#ifdef HAVE_LIBCAP_NG -+# include -+ int keep_capabilities = 0; -+#endif -+ - TIME default_lease_time = 43200; /* 12 hours... */ - TIME max_lease_time = 86400; /* 24 hours... */ - struct tree_cache *global_options[256]; -@@ -356,6 +361,10 @@ main(int argc, char **argv) { - sl->next = upstreams; - upstreams = sl; - #endif -+ } else if (!strcmp(argv[i], "-nc")) { -+#ifdef HAVE_LIBCAP_NG -+ keep_capabilities = 1; -+#endif - } else if (!strcmp(argv[i], "-pf")) { - if (++i == argc) - usage(); -@@ -426,6 +435,17 @@ main(int argc, char **argv) { - #endif - } - -+#ifdef HAVE_LIBCAP_NG -+ /* Drop capabilities */ -+ if (!keep_capabilities) { -+ capng_clear(CAPNG_SELECT_BOTH); -+ capng_updatev(CAPNG_ADD, CAPNG_EFFECTIVE|CAPNG_PERMITTED, -+ CAP_NET_RAW, CAP_NET_BIND_SERVICE, -1); -+ capng_apply(CAPNG_SELECT_BOTH); -+ log_info ("Dropped all unnecessary capabilities."); -+ } -+#endif -+ - if (!quiet) { - log_info("%s %s", message, PACKAGE_VERSION); - log_info(copyright); -@@ -573,6 +593,15 @@ main(int argc, char **argv) { - dhcpv6_packet_handler = do_packet6; - #endif - -+#ifdef HAVE_LIBCAP_NG -+ /* Drop all capabilities */ -+ if (!keep_capabilities) { -+ capng_clear(CAPNG_SELECT_BOTH); -+ capng_apply(CAPNG_SELECT_BOTH); -+ log_info ("Dropped all capabilities."); -+ } -+#endif -+ - /* Start dispatching packets and timeouts... */ - dispatch(); - -diff -up dhcp-4.2.2b1/relay/Makefile.am.capability dhcp-4.2.2b1/relay/Makefile.am ---- dhcp-4.2.2b1/relay/Makefile.am.capability 2011-07-01 15:09:06.546785121 +0200 -+++ dhcp-4.2.2b1/relay/Makefile.am 2011-07-01 15:09:06.670783841 +0200 -@@ -3,7 +3,7 @@ AM_CPPFLAGS = -DLOCALSTATEDIR='"@localst - sbin_PROGRAMS = dhcrelay - dhcrelay_SOURCES = dhcrelay.c - dhcrelay_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ -- $(BIND9_LIBDIR) -ldns-export -lisc-export -+ $(BIND9_LIBDIR) -ldns-export -lisc-export $(CAPNG_LDADD) - man_MANS = dhcrelay.8 - EXTRA_DIST = $(man_MANS) - diff --git a/dhcp-4.2.4-64_bit_lease_parse.patch b/dhcp-4.2.4-64_bit_lease_parse.patch deleted file mode 100644 index c1b978b..0000000 --- a/dhcp-4.2.4-64_bit_lease_parse.patch +++ /dev/null @@ -1,84 +0,0 @@ -diff -up dhcp-4.2.4b1/common/parse.c.64-bit_lease_parse dhcp-4.2.4b1/common/parse.c ---- dhcp-4.2.4b1/common/parse.c.64-bit_lease_parse 2012-03-09 12:28:10.000000000 +0100 -+++ dhcp-4.2.4b1/common/parse.c 2012-04-16 17:30:55.867045149 +0200 -@@ -906,8 +906,8 @@ TIME - parse_date_core(cfile) - struct parse *cfile; - { -- int guess; -- int tzoff, year, mon, mday, hour, min, sec; -+ TIME guess; -+ long int tzoff, year, mon, mday, hour, min, sec; - const char *val; - enum dhcp_token token; - static int months[11] = { 31, 59, 90, 120, 151, 181, -@@ -933,7 +933,7 @@ parse_date_core(cfile) - } - - token = next_token(&val, NULL, cfile); /* consume number */ -- guess = atoi(val); -+ guess = atol(val); - - return((TIME)guess); - } -@@ -961,7 +961,7 @@ parse_date_core(cfile) - somebody invents a time machine, I think we can safely disregard - it. This actually works around a stupid Y2K bug that was present - in a very early beta release of dhcpd. */ -- year = atoi(val); -+ year = atol(val); - if (year > 1900) - year -= 1900; - -@@ -985,7 +985,7 @@ parse_date_core(cfile) - return((TIME)0); - } - token = next_token(&val, NULL, cfile); /* consume month */ -- mon = atoi(val) - 1; -+ mon = atol(val) - 1; - - /* Slash separating month from day... */ - token = peek_token(&val, NULL, cfile); -@@ -1007,7 +1007,7 @@ parse_date_core(cfile) - return((TIME)0); - } - token = next_token(&val, NULL, cfile); /* consume day of month */ -- mday = atoi(val); -+ mday = atol(val); - - /* Hour... */ - token = peek_token(&val, NULL, cfile); -@@ -1018,7 +1018,7 @@ parse_date_core(cfile) - return((TIME)0); - } - token = next_token(&val, NULL, cfile); /* consume hour */ -- hour = atoi(val); -+ hour = atol(val); - - /* Colon separating hour from minute... */ - token = peek_token(&val, NULL, cfile); -@@ -1040,7 +1040,7 @@ parse_date_core(cfile) - return((TIME)0); - } - token = next_token(&val, NULL, cfile); /* consume minute */ -- min = atoi(val); -+ min = atol(val); - - /* Colon separating minute from second... */ - token = peek_token(&val, NULL, cfile); -@@ -1062,13 +1062,13 @@ parse_date_core(cfile) - return((TIME)0); - } - token = next_token(&val, NULL, cfile); /* consume second */ -- sec = atoi(val); -+ sec = atol(val); - - tzoff = 0; - token = peek_token(&val, NULL, cfile); - if (token == NUMBER) { - token = next_token(&val, NULL, cfile); /* consume tzoff */ -- tzoff = atoi(val); -+ tzoff = atol(val); - } else if (token != SEMI) { - token = next_token(&val, NULL, cfile); - parse_warn(cfile, diff --git a/dhcp-4.2.5-lpf-ib.patch b/dhcp-4.2.5-lpf-ib.patch deleted file mode 100644 index 58b924a..0000000 --- a/dhcp-4.2.5-lpf-ib.patch +++ /dev/null @@ -1,583 +0,0 @@ -diff -up dhcp-4.2.5/client/dhclient.c.lpf-ib dhcp-4.2.5/client/dhclient.c ---- dhcp-4.2.5/client/dhclient.c.lpf-ib 2013-08-26 12:13:31.509170257 +0200 -+++ dhcp-4.2.5/client/dhclient.c 2013-08-26 12:13:31.515170176 +0200 -@@ -113,6 +113,8 @@ static int check_domain_name_list(const - static int check_option_values(struct universe *universe, unsigned int opt, - const char *ptr, size_t len); - -+static void setup_ib_interface(struct interface_info *ip); -+ - int - main(int argc, char **argv) { - int fd; -@@ -909,6 +911,14 @@ main(int argc, char **argv) { - } - srandom(seed + cur_time + (unsigned)getpid()); - -+ /* Setup specific Infiniband options */ -+ for (ip = interfaces; ip; ip = ip->next) { -+ if (ip->client && -+ (ip->hw_address.hbuf[0] == HTYPE_INFINIBAND)) { -+ setup_ib_interface(ip); -+ } -+ } -+ - /* Start a configuration state machine for each interface. */ - #ifdef DHCPv6 - if (local_family == AF_INET6) { -@@ -1185,6 +1195,29 @@ int find_subnet (struct subnet **sp, - return 0; - } - -+static void setup_ib_interface(struct interface_info *ip) -+{ -+ struct group *g; -+ -+ /* Set the broadcast flag */ -+ ip->client->config->bootp_broadcast_always = 1; -+ -+ /* -+ * Find out if a dhcp-client-identifier option was specified either -+ * in the config file or on the command line -+ */ -+ for (g = ip->client->config->on_transmission; g != NULL; g = g->next) { -+ if ((g->statements != NULL) && -+ (strcmp(g->statements->data.option->option->name, -+ "dhcp-client-identifier") == 0)) { -+ return; -+ } -+ } -+ -+ /* No client ID specified */ -+ log_fatal("dhcp-client-identifier must be specified for InfiniBand"); -+} -+ - /* Individual States: - * - * Each routine is called from the dhclient_state_machine() in one of -diff -up dhcp-4.2.5/common/bpf.c.lpf-ib dhcp-4.2.5/common/bpf.c ---- dhcp-4.2.5/common/bpf.c.lpf-ib 2013-08-26 12:13:31.503170337 +0200 -+++ dhcp-4.2.5/common/bpf.c 2013-08-26 12:13:31.515170176 +0200 -@@ -198,11 +198,44 @@ struct bpf_insn dhcp_bpf_filter [] = { - BPF_STMT(BPF_RET+BPF_K, 0), - }; - -+/* Packet filter program for DHCP over Infiniband. -+ * -+ * XXX -+ * Changes to the filter program may require changes to the constant offsets -+ * used in lpf_gen_filter_setup to patch the port in the BPF program! -+ * XXX -+ */ -+struct bpf_insn dhcp_ib_bpf_filter [] = { -+ /* Packet filter for Infiniband */ -+ /* Make sure it's a UDP packet... */ -+ BPF_STMT(BPF_LD + BPF_B + BPF_ABS, 9), -+ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 6), -+ -+ /* Make sure this isn't a fragment... */ -+ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 6), -+ BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 4, 0), -+ -+ /* Get the IP header length... */ -+ BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 0), -+ -+ /* Make sure it's to the right port... */ -+ BPF_STMT(BPF_LD + BPF_H + BPF_IND, 2), -+ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 67, 0, 1), -+ -+ /* If we passed all the tests, ask for the whole packet. */ -+ BPF_STMT(BPF_RET + BPF_K, (u_int)-1), -+ -+ /* Otherwise, drop it. */ -+ BPF_STMT(BPF_RET + BPF_K, 0), -+}; -+ - #if defined (DEC_FDDI) - struct bpf_insn *bpf_fddi_filter; - #endif - - int dhcp_bpf_filter_len = sizeof dhcp_bpf_filter / sizeof (struct bpf_insn); -+int dhcp_ib_bpf_filter_len = sizeof dhcp_ib_bpf_filter / sizeof (struct bpf_insn); -+ - #if defined (HAVE_TR_SUPPORT) - struct bpf_insn dhcp_bpf_tr_filter [] = { - /* accept all token ring packets due to variable length header */ -diff -up dhcp-4.2.5/common/lpf.c.lpf-ib dhcp-4.2.5/common/lpf.c ---- dhcp-4.2.5/common/lpf.c.lpf-ib 2013-08-26 12:13:31.503170337 +0200 -+++ dhcp-4.2.5/common/lpf.c 2013-08-26 12:14:00.196783751 +0200 -@@ -43,6 +43,7 @@ - #include "includes/netinet/udp.h" - #include "includes/netinet/if_ether.h" - #include -+#include - - #ifndef PACKET_AUXDATA - #define PACKET_AUXDATA 8 -@@ -60,6 +61,15 @@ struct tpacket_auxdata - /* Reinitializes the specified interface after an address change. This - is not required for packet-filter APIs. */ - -+/* Default broadcast address for IPoIB */ -+static unsigned char default_ib_bcast_addr[20] = { -+ 0x00, 0xff, 0xff, 0xff, -+ 0xff, 0x12, 0x40, 0x1b, -+ 0x00, 0x00, 0x00, 0x00, -+ 0x00, 0x00, 0x00, 0x00, -+ 0xff, 0xff, 0xff, 0xff -+}; -+ - #ifdef USE_LPF_SEND - void if_reinitialize_send (info) - struct interface_info *info; -@@ -87,10 +97,21 @@ int if_register_lpf (info) - struct sockaddr common; - } sa; - struct ifreq ifr; -+ int type; -+ int protocol; - - /* Make an LPF socket. */ -- if ((sock = socket(PF_PACKET, SOCK_RAW, -- htons((short)ETH_P_ALL))) < 0) { -+ get_hw_addr(info); -+ -+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) { -+ type = SOCK_DGRAM; -+ protocol = ETHERTYPE_IP; -+ } else { -+ type = SOCK_RAW; -+ protocol = ETH_P_ALL; -+ } -+ -+ if ((sock = socket(PF_PACKET, type, htons((short)protocol))) < 0) { - if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || - errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || - errno == EAFNOSUPPORT || errno == EINVAL) { -@@ -113,6 +134,7 @@ int if_register_lpf (info) - /* Bind to the interface name */ - memset (&sa, 0, sizeof sa); - sa.ll.sll_family = AF_PACKET; -+ sa.ll.sll_protocol = htons(protocol); - sa.ll.sll_ifindex = ifr.ifr_ifindex; - if (bind (sock, &sa.common, sizeof sa)) { - if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || -@@ -128,8 +150,6 @@ int if_register_lpf (info) - log_fatal ("Bind socket to interface: %m"); - } - -- get_hw_addr(info->name, &info->hw_address); -- - return sock; - } - #endif /* USE_LPF_SEND || USE_LPF_RECEIVE */ -@@ -184,6 +204,8 @@ void if_deregister_send (info) - in bpf includes... */ - extern struct sock_filter dhcp_bpf_filter []; - extern int dhcp_bpf_filter_len; -+extern struct sock_filter dhcp_ib_bpf_filter []; -+extern int dhcp_ib_bpf_filter_len; - - #if defined (HAVE_TR_SUPPORT) - extern struct sock_filter dhcp_bpf_tr_filter []; -@@ -201,11 +223,13 @@ void if_register_receive (info) - /* Open a LPF device and hang it on this interface... */ - info -> rfdesc = if_register_lpf (info); - -- val = 1; -- if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val, -- sizeof val) < 0) { -- if (errno != ENOPROTOOPT) -- log_fatal ("Failed to set auxiliary packet data: %m"); -+ if (info->hw_address.hbuf[0] != HTYPE_INFINIBAND) { -+ val = 1; -+ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, -+ &val, sizeof val) < 0) { -+ if (errno != ENOPROTOOPT) -+ log_fatal ("Failed to set auxiliary packet data: %m"); -+ } - } - - #if defined (HAVE_TR_SUPPORT) -@@ -251,15 +275,28 @@ static void lpf_gen_filter_setup (info) - - memset(&p, 0, sizeof(p)); - -- /* Set up the bpf filter program structure. This is defined in -- bpf.c */ -- p.len = dhcp_bpf_filter_len; -- p.filter = dhcp_bpf_filter; -- -- /* Patch the server port into the LPF program... -- XXX changes to filter program may require changes -- to the insn number(s) used below! XXX */ -- dhcp_bpf_filter [8].k = ntohs ((short)local_port); -+ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) { -+ /* Set up the bpf filter program structure. */ -+ p.len = dhcp_ib_bpf_filter_len; -+ p.filter = dhcp_ib_bpf_filter; -+ -+ /* Patch the server port into the LPF program... -+ XXX -+ changes to filter program may require changes -+ to the insn number(s) used below! -+ XXX */ -+ dhcp_ib_bpf_filter[6].k = ntohs ((short)local_port); -+ } else { -+ /* Set up the bpf filter program structure. -+ This is defined in bpf.c */ -+ p.len = dhcp_bpf_filter_len; -+ p.filter = dhcp_bpf_filter; -+ -+ /* Patch the server port into the LPF program... -+ XXX changes to filter program may require changes -+ to the insn number(s) used below! XXX */ -+ dhcp_bpf_filter [8].k = ntohs ((short)local_port); -+ } - - if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, &p, - sizeof p) < 0) { -@@ -316,6 +353,54 @@ static void lpf_tr_filter_setup (info) - #endif /* USE_LPF_RECEIVE */ - - #ifdef USE_LPF_SEND -+ssize_t send_packet_ib(interface, packet, raw, len, from, to, hto) -+ struct interface_info *interface; -+ struct packet *packet; -+ struct dhcp_packet *raw; -+ size_t len; -+ struct in_addr from; -+ struct sockaddr_in *to; -+ struct hardware *hto; -+{ -+ unsigned ibufp = 0; -+ double ih [1536 / sizeof (double)]; -+ unsigned char *buf = (unsigned char *)ih; -+ ssize_t result; -+ -+ union sockunion { -+ struct sockaddr sa; -+ struct sockaddr_ll sll; -+ struct sockaddr_storage ss; -+ } su; -+ -+ assemble_udp_ip_header (interface, buf, &ibufp, from.s_addr, -+ to->sin_addr.s_addr, to->sin_port, -+ (unsigned char *)raw, len); -+ memcpy (buf + ibufp, raw, len); -+ -+ memset(&su, 0, sizeof(su)); -+ su.sll.sll_family = AF_PACKET; -+ su.sll.sll_protocol = htons(ETHERTYPE_IP); -+ -+ if (!(su.sll.sll_ifindex = if_nametoindex(interface->name))) { -+ errno = ENOENT; -+ log_error ("send_packet_ib: %m - failed to get if index"); -+ return -1; -+ } -+ -+ su.sll.sll_hatype = htons(HTYPE_INFINIBAND); -+ su.sll.sll_halen = sizeof(interface->bcast_addr); -+ memcpy(&su.sll.sll_addr, interface->bcast_addr, 20); -+ -+ result = sendto(interface->wfdesc, buf, ibufp + len, 0, -+ &su.sa, sizeof(su)); -+ -+ if (result < 0) -+ log_error ("send_packet_ib: %m"); -+ -+ return result; -+} -+ - ssize_t send_packet (interface, packet, raw, len, from, to, hto) - struct interface_info *interface; - struct packet *packet; -@@ -336,6 +421,11 @@ ssize_t send_packet (interface, packet, - return send_fallback (interface, packet, raw, - len, from, to, hto); - -+ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) { -+ return send_packet_ib(interface, packet, raw, len, from, -+ to, hto); -+ } -+ - if (hto == NULL && interface->anycast_mac_addr.hlen) - hto = &interface->anycast_mac_addr; - -@@ -357,6 +447,42 @@ ssize_t send_packet (interface, packet, - #endif /* USE_LPF_SEND */ - - #ifdef USE_LPF_RECEIVE -+ssize_t receive_packet_ib (interface, buf, len, from, hfrom) -+ struct interface_info *interface; -+ unsigned char *buf; -+ size_t len; -+ struct sockaddr_in *from; -+ struct hardware *hfrom; -+{ -+ int length = 0; -+ int offset = 0; -+ unsigned char ibuf [1536]; -+ unsigned bufix = 0; -+ unsigned paylen; -+ -+ length = read(interface->rfdesc, ibuf, sizeof(ibuf)); -+ -+ if (length <= 0) -+ return length; -+ -+ offset = decode_udp_ip_header(interface, ibuf, bufix, from, -+ (unsigned)length, &paylen, 0); -+ -+ if (offset < 0) -+ return 0; -+ -+ bufix += offset; -+ length -= offset; -+ -+ if (length < paylen) -+ log_fatal("Internal inconsistency at %s:%d.", MDL); -+ -+ /* Copy out the data in the packet... */ -+ memcpy(buf, &ibuf[bufix], paylen); -+ -+ return (ssize_t)paylen; -+} -+ - ssize_t receive_packet (interface, buf, len, from, hfrom) - struct interface_info *interface; - unsigned char *buf; -@@ -383,6 +509,10 @@ ssize_t receive_packet (interface, buf, - }; - struct cmsghdr *cmsg; - -+ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) { -+ return receive_packet_ib(interface, buf, len, from, hfrom); -+ } -+ - length = recvmsg (interface -> rfdesc, &msg, 0); - if (length <= 0) - return length; -@@ -462,11 +592,33 @@ void maybe_setup_fallback () - } - } - --void --get_hw_addr(const char *name, struct hardware *hw) { -+struct sockaddr_ll * -+get_ll (struct ifaddrs *ifaddrs, struct ifaddrs **ifa, char *name) -+{ -+ for (*ifa = ifaddrs; *ifa != NULL; *ifa = (*ifa)->ifa_next) { -+ if ((*ifa)->ifa_addr == NULL) -+ continue; -+ -+ if ((*ifa)->ifa_addr->sa_family != AF_PACKET) -+ continue; -+ -+ if ((*ifa)->ifa_flags & IFF_LOOPBACK) -+ continue; -+ -+ if (strcmp((*ifa)->ifa_name, name) == 0) -+ return (struct sockaddr_ll *)(void *)(*ifa)->ifa_addr; -+ } -+ *ifa = NULL; -+ return NULL; -+} -+ -+struct sockaddr_ll * -+ioctl_get_ll(char *name) -+{ - int sock; - struct ifreq tmp; -- struct sockaddr *sa; -+ struct sockaddr *sa = NULL; -+ struct sockaddr_ll *sll = NULL; - - if (strlen(name) >= sizeof(tmp.ifr_name)) { - log_fatal("Device name too long: \"%s\"", name); -@@ -480,16 +632,62 @@ get_hw_addr(const char *name, struct har - memset(&tmp, 0, sizeof(tmp)); - strcpy(tmp.ifr_name, name); - if (ioctl(sock, SIOCGIFHWADDR, &tmp) < 0) { -- log_fatal("Error getting hardware address for \"%s\": %m", -+ log_fatal("Error getting hardware address for \"%s\": %m", - name); - } -+ close(sock); - - sa = &tmp.ifr_hwaddr; -- switch (sa->sa_family) { -+ // needs to be freed outside this function -+ sll = dmalloc (sizeof (struct sockaddr_ll), MDL); -+ if (!sll) -+ log_fatal("Unable to allocate memory for link layer address"); -+ memcpy(&sll->sll_hatype, &sa->sa_family, sizeof (sll->sll_hatype)); -+ memcpy(sll->sll_addr, sa->sa_data, sizeof (sll->sll_addr)); -+ switch (sll->sll_hatype) { -+ case ARPHRD_INFINIBAND: -+ /* ioctl limits hardware addresses to 8 bytes */ -+ sll->sll_halen = 8; -+ break; -+ default: -+ break; -+ } -+ return sll; -+} -+ -+void -+get_hw_addr(struct interface_info *info) -+{ -+ struct hardware *hw = &info->hw_address; -+ char *name = info->name; -+ struct ifaddrs *ifaddrs = NULL; -+ struct ifaddrs *ifa = NULL; -+ struct sockaddr_ll *sll = NULL; -+ int sll_allocated = 0; -+ char *dup = NULL; -+ char *colon = NULL; -+ -+ if (getifaddrs(&ifaddrs) == -1) -+ log_fatal("Failed to get interfaces"); -+ -+ if ((sll = get_ll(ifaddrs, &ifa, name)) == NULL) { -+ /* -+ * We were unable to get link-layer address for name. -+ * Fall back to ioctl(SIOCGIFHWADDR). -+ */ -+ sll = ioctl_get_ll(name); -+ if (sll != NULL) -+ sll_allocated = 1; -+ else -+ // shouldn't happen -+ log_fatal("Unexpected internal error"); -+ } -+ -+ switch (sll->sll_hatype) { - case ARPHRD_ETHER: - hw->hlen = 7; - hw->hbuf[0] = HTYPE_ETHER; -- memcpy(&hw->hbuf[1], sa->sa_data, 6); -+ memcpy(&hw->hbuf[1], sll->sll_addr, 6); - break; - case ARPHRD_IEEE802: - #ifdef ARPHRD_IEEE802_TR -@@ -497,18 +695,48 @@ get_hw_addr(const char *name, struct har - #endif /* ARPHRD_IEEE802_TR */ - hw->hlen = 7; - hw->hbuf[0] = HTYPE_IEEE802; -- memcpy(&hw->hbuf[1], sa->sa_data, 6); -+ memcpy(&hw->hbuf[1], sll->sll_addr, 6); - break; - case ARPHRD_FDDI: - hw->hlen = 7; - hw->hbuf[0] = HTYPE_FDDI; -- memcpy(&hw->hbuf[1], sa->sa_data, 6); -+ memcpy(&hw->hbuf[1], sll->sll_addr, 6); -+ break; -+ case ARPHRD_INFINIBAND: -+ dup = strdup(name); -+ /* Aliased infiniband interface is special case where -+ * neither get_ll() nor ioctl_get_ll() get's correct hw -+ * address, so we have to truncate the :0 and run -+ * get_ll() again for the rest. -+ */ -+ if ((colon = strchr(dup, ':')) != NULL) { -+ *colon = '\0'; -+ if ((sll = get_ll(ifaddrs, &ifa, dup)) == NULL) -+ log_fatal("Error getting hardware address for \"%s\": %m", name); -+ } -+ free (dup); -+ /* For Infiniband, save the broadcast address and store -+ * the port GUID into the hardware address. -+ */ -+ if (ifa && (ifa->ifa_flags & IFF_BROADCAST)) { -+ struct sockaddr_ll *bll; -+ -+ bll = (struct sockaddr_ll *)ifa->ifa_broadaddr; -+ memcpy(&info->bcast_addr, bll->sll_addr, 20); -+ } else { -+ memcpy(&info->bcast_addr, default_ib_bcast_addr, -+ 20); -+ } -+ -+ hw->hlen = 1; -+ hw->hbuf[0] = HTYPE_INFINIBAND; -+ memcpy(&hw->hbuf[1], &sll->sll_addr[sll->sll_halen - 8], 8); - break; - #if defined(ARPHRD_PPP) - case ARPHRD_PPP: - if (local_family != AF_INET6) -- log_fatal("Unsupported device type %d for \"%s\"", -- sa->sa_family, name); -+ log_fatal("local_family != AF_INET6 for \"%s\"", -+ name); - hw->hlen = 0; - hw->hbuf[0] = HTYPE_RESERVED; - /* 0xdeadbeef should never occur on the wire, -@@ -521,10 +749,13 @@ get_hw_addr(const char *name, struct har - break; - #endif - default: -- log_fatal("Unsupported device type %ld for \"%s\"", -- (long int)sa->sa_family, name); -+ freeifaddrs(ifaddrs); -+ log_fatal("Unsupported device type %hu for \"%s\"", -+ sll->sll_hatype, name); - } - -- close(sock); -+ if (sll_allocated) -+ dfree(sll, MDL); -+ freeifaddrs(ifaddrs); - } - #endif -diff -up dhcp-4.2.5/common/socket.c.lpf-ib dhcp-4.2.5/common/socket.c ---- dhcp-4.2.5/common/socket.c.lpf-ib 2013-01-03 01:02:24.000000000 +0100 -+++ dhcp-4.2.5/common/socket.c 2013-08-26 12:13:31.516170162 +0200 -@@ -325,7 +325,7 @@ void if_register_send (info) - info->wfdesc = if_register_socket(info, AF_INET, 0); - /* If this is a normal IPv4 address, get the hardware address. */ - if (strcmp(info->name, "fallback") != 0) -- get_hw_addr(info->name, &info->hw_address); -+ get_hw_addr(info); - #if defined (USE_SOCKET_FALLBACK) - /* Fallback only registers for send, but may need to receive as - well. */ -@@ -388,7 +388,7 @@ void if_register_receive (info) - #endif /* IP_PKTINFO... */ - /* If this is a normal IPv4 address, get the hardware address. */ - if (strcmp(info->name, "fallback") != 0) -- get_hw_addr(info->name, &info->hw_address); -+ get_hw_addr(info); - - if (!quiet_interface_discovery) - log_info ("Listening on Socket/%s%s%s", -@@ -498,7 +498,7 @@ if_register6(struct interface_info *info - if (req_multi) - if_register_multicast(info); - -- get_hw_addr(info->name, &info->hw_address); -+ get_hw_addr(info); - - if (!quiet_interface_discovery) { - if (info->shared_network != NULL) { -diff -up dhcp-4.2.5/includes/dhcpd.h.lpf-ib dhcp-4.2.5/includes/dhcpd.h ---- dhcp-4.2.5/includes/dhcpd.h.lpf-ib 2013-08-26 12:13:31.510170243 +0200 -+++ dhcp-4.2.5/includes/dhcpd.h 2013-08-26 12:13:31.517170149 +0200 -@@ -1249,6 +1249,7 @@ struct interface_info { - struct shared_network *shared_network; - /* Networks connected to this interface. */ - struct hardware hw_address; /* Its physical address. */ -+ u_int8_t bcast_addr[20]; /* Infiniband broadcast address */ - struct in_addr *addresses; /* Addresses associated with this - * interface. - */ -@@ -2372,7 +2373,7 @@ void print_dns_status (int, struct dhcp_ - #endif - const char *print_time(TIME); - --void get_hw_addr(const char *name, struct hardware *hw); -+void get_hw_addr(struct interface_info *info); - - /* socket.c */ - #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \ diff --git a/dhcp-4.2.5-remove-bind.patch b/dhcp-4.2.5-remove-bind.patch deleted file mode 100644 index d3ef6b7..0000000 --- a/dhcp-4.2.5-remove-bind.patch +++ /dev/null @@ -1,164 +0,0 @@ -diff -up dhcp-4.2.5b1/client/Makefile.am.remove-bind dhcp-4.2.5b1/client/Makefile.am ---- dhcp-4.2.5b1/client/Makefile.am.remove-bind 2012-12-05 02:17:38.000000000 +0100 -+++ dhcp-4.2.5b1/client/Makefile.am 2012-12-17 16:20:58.692538252 +0100 -@@ -5,7 +5,7 @@ dhclient_SOURCES = clparse.c dhclient.c - scripts/netbsd scripts/nextstep scripts/openbsd \ - scripts/solaris scripts/openwrt - dhclient_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ -- ../bind/lib/libdns.a ../bind/lib/libisc.a -+ $(BIND9_LIBDIR) -ldns-export -lisc-export - man_MANS = dhclient.8 dhclient-script.8 dhclient.conf.5 dhclient.leases.5 - EXTRA_DIST = $(man_MANS) - -diff -up dhcp-4.2.5b1/common/tests/Makefile.am.remove-bind dhcp-4.2.5b1/common/tests/Makefile.am ---- dhcp-4.2.5b1/common/tests/Makefile.am.remove-bind 2012-12-05 02:17:38.000000000 +0100 -+++ dhcp-4.2.5b1/common/tests/Makefile.am 2012-12-17 16:20:58.693538239 +0100 -@@ -13,8 +13,8 @@ ATF_TESTS += alloc_unittest - alloc_unittest_SOURCES = test_alloc.c $(top_srcdir)/tests/t_api_dhcp.c - alloc_unittest_LDADD = $(ATF_LDFLAGS) - alloc_unittest_LDADD += ../libdhcp.a \ -- ../../omapip/libomapi.a ../../bind/lib/libdns.a \ -- ../../bind/lib/libisc.a -+ ../../omapip/libomapi.a \ -+ $(BIND9_LIBDIR) -ldns-export -lisc-export - - check: $(ATF_TESTS) - atf-run | atf-report -diff -up dhcp-4.2.5b1/configure.ac.remove-bind dhcp-4.2.5b1/configure.ac ---- dhcp-4.2.5b1/configure.ac.remove-bind 2012-12-05 02:18:44.000000000 +0100 -+++ dhcp-4.2.5b1/configure.ac 2012-12-17 16:20:58.693538239 +0100 -@@ -581,20 +581,37 @@ AC_CHECK_MEMBER(struct msghdr.msg_contro - libbind= - AC_ARG_WITH(libbind, - AC_HELP_STRING([--with-libbind=PATH], -- [bind includes and libraries are in PATH -- (default is ./bind)]), -+ [bind includes are in PATH -+ (default is ./bind/includes)]), - use_libbind="$withval", use_libbind="no") - case "$use_libbind" in -+yes|no) -+ libbind="\${top_srcdir}/bind/include" -+ ;; -+*) -+ libbind="$use_libbind" -+ ;; -+esac -+ -+BIND9_LIBDIR='-L$(top_builddir)/bind/lib' -+AC_ARG_WITH(libbind-libs, -+ AC_HELP_STRING([--with-libbind-libs=PATH], -+ [bind9 export libraries are in PATH]), -+ [libbind_libs="$withval"], [libbind_libs='no']) -+case "$libbind_libs" in - yes) -- libbind="\${top_srcdir}/bind" -+ AC_MSG_ERROR([Specify path to bind9 libraries]) - ;; - no) -- libbind="\${top_srcdir}/bind" -+ BUNDLED_BIND=yes - ;; - *) -- libbind="$use_libbind" -+ BIND9_LIBDIR="-L$libbind_libs" -+ BUNDLED_BIND=no - ;; - esac -+AM_CONDITIONAL([BUNDLED_BIND], [test "$BUNDLED_BIND" = yes]) -+AC_SUBST([BIND9_LIBDIR]) - - # OpenLDAP support. - AC_ARG_WITH(ldap, -@@ -631,7 +648,7 @@ fi - CFLAGS="$CFLAGS $STD_CWARNINGS" - - # Try to add the bind include directory --CFLAGS="$CFLAGS -I$libbind/include" -+CFLAGS="$CFLAGS -I$libbind" - - AC_C_FLEXIBLE_ARRAY_MEMBER - -diff -up dhcp-4.2.5b1/dhcpctl/Makefile.am.remove-bind dhcp-4.2.5b1/dhcpctl/Makefile.am ---- dhcp-4.2.5b1/dhcpctl/Makefile.am.remove-bind 2012-12-05 02:17:39.000000000 +0100 -+++ dhcp-4.2.5b1/dhcpctl/Makefile.am 2012-12-17 16:20:58.693538239 +0100 -@@ -6,10 +6,10 @@ EXTRA_DIST = $(man_MANS) - - omshell_SOURCES = omshell.c - omshell_LDADD = libdhcpctl.a ../common/libdhcp.a ../omapip/libomapi.a \ -- ../bind/lib/libdns.a ../bind/lib/libisc.a -+ $(BIND9_LIBDIR) -ldns-export -lisc-export - - libdhcpctl_a_SOURCES = dhcpctl.c callback.c remote.c - - cltest_SOURCES = cltest.c - cltest_LDADD = libdhcpctl.a ../common/libdhcp.a ../omapip/libomapi.a \ -- ../bind/lib/libdns.a ../bind/lib/libisc.a -\ No newline at end of file -+ $(BIND9_LIBDIR) -ldns-export -lisc-export -diff -up dhcp-4.2.5b1/Makefile.am.remove-bind dhcp-4.2.5b1/Makefile.am ---- dhcp-4.2.5b1/Makefile.am.remove-bind 2012-12-05 02:17:38.000000000 +0100 -+++ dhcp-4.2.5b1/Makefile.am 2012-12-17 16:20:58.693538239 +0100 -@@ -22,7 +22,13 @@ EXTRA_DIST = RELNOTES LICENSE \ - bind/Makefile bind/bind.tar.gz bind/version.tmp \ - common/tests/Atffile server/tests/Atffile - --SUBDIRS = bind includes tests common dst omapip client dhcpctl relay server -+if BUNDLED_BIND -+SUBDIRS = bind -+else -+SUBDIRS = -+endif -+ -+SUBDIRS += includes tests common dst omapip client dhcpctl relay server - - nobase_include_HEADERS = dhcpctl/dhcpctl.h - -diff -up dhcp-4.2.5b1/omapip/Makefile.am.remove-bind dhcp-4.2.5b1/omapip/Makefile.am ---- dhcp-4.2.5b1/omapip/Makefile.am.remove-bind 2012-12-05 02:17:39.000000000 +0100 -+++ dhcp-4.2.5b1/omapip/Makefile.am 2012-12-17 16:20:58.693538239 +0100 -@@ -10,5 +10,5 @@ man_MANS = omapi.3 - EXTRA_DIST = $(man_MANS) - - svtest_SOURCES = test.c --svtest_LDADD = libomapi.a ../bind/lib/libdns.a ../bind/lib/libisc.a -+svtest_LDADD = libomapi.a $(BIND9_LIBDIR) -ldns-export -lisc-export - -diff -up dhcp-4.2.5b1/relay/Makefile.am.remove-bind dhcp-4.2.5b1/relay/Makefile.am ---- dhcp-4.2.5b1/relay/Makefile.am.remove-bind 2012-12-05 02:17:39.000000000 +0100 -+++ dhcp-4.2.5b1/relay/Makefile.am 2012-12-17 16:20:58.694538225 +0100 -@@ -3,7 +3,7 @@ AM_CPPFLAGS = -DLOCALSTATEDIR='"@localst - sbin_PROGRAMS = dhcrelay - dhcrelay_SOURCES = dhcrelay.c - dhcrelay_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ -- ../bind/lib/libdns.a ../bind/lib/libisc.a -+ $(BIND9_LIBDIR) -ldns-export -lisc-export - man_MANS = dhcrelay.8 - EXTRA_DIST = $(man_MANS) - -diff -up dhcp-4.2.5b1/server/Makefile.am.remove-bind dhcp-4.2.5b1/server/Makefile.am ---- dhcp-4.2.5b1/server/Makefile.am.remove-bind 2012-12-05 02:17:39.000000000 +0100 -+++ dhcp-4.2.5b1/server/Makefile.am 2012-12-17 16:20:58.694538225 +0100 -@@ -14,8 +14,7 @@ dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c c - - dhcpd_CFLAGS = $(LDAP_CFLAGS) - dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ -- ../dhcpctl/libdhcpctl.a ../bind/lib/libdns.a \ -- ../bind/lib/libisc.a -+ ../dhcpctl/libdhcpctl.a $(BIND9_LIBDIR) -ldns-export -lisc-export - - man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5 - EXTRA_DIST = $(man_MANS) -diff -up dhcp-4.2.5b1/server/tests/Makefile.am.remove-bind dhcp-4.2.5b1/server/tests/Makefile.am ---- dhcp-4.2.5b1/server/tests/Makefile.am.remove-bind 2012-12-05 02:17:39.000000000 +0100 -+++ dhcp-4.2.5b1/server/tests/Makefile.am 2012-12-17 16:26:01.093346768 +0100 -@@ -18,8 +18,7 @@ DHCPSRC = ../dhcp.c ../bootp.c ../confpa - ../ldap.c ../ldap_casa.c ../dhcpd.c - - DHCPLIBS = $(top_builddir)/common/libdhcp.a $(top_builddir)/omapip/libomapi.a \ -- $(top_builddir)/dhcpctl/libdhcpctl.a $(top_builddir)/bind/lib/libdns.a \ -- $(top_builddir)/bind/lib/libisc.a -+ $(top_builddir)/dhcpctl/libdhcpctl.a $(BIND9_LIBDIR) -ldns-export -lisc-export - - ATF_TESTS = - TESTS = diff --git a/dhcp-4.2.5-systemtap.patch b/dhcp-4.2.5-systemtap.patch deleted file mode 100644 index ad774ad..0000000 --- a/dhcp-4.2.5-systemtap.patch +++ /dev/null @@ -1,822 +0,0 @@ -diff -up dhcp-4.2.5b1/configure.ac.systemtap dhcp-4.2.5b1/configure.ac ---- dhcp-4.2.5b1/configure.ac.systemtap 2012-12-17 16:56:40.563881316 +0100 -+++ dhcp-4.2.5b1/configure.ac 2012-12-17 16:56:40.597880870 +0100 -@@ -554,6 +554,35 @@ else - AC_MSG_RESULT(no) - fi - -+AC_MSG_CHECKING([whether to include systemtap tracing support]) -+AC_ARG_ENABLE([systemtap], -+ [AS_HELP_STRING([--enable-systemtap], -+ [Enable inclusion of systemtap trace support])], -+ [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP='no']) -+AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test x$ENABLE_SYSTEMTAP = xyes]) -+AC_MSG_RESULT(${ENABLE_SYSTEMTAP}) -+ -+if test "x${ENABLE_SYSTEMTAP}" = xyes; then -+ # Additional configuration for --enable-systemtap is HERE -+ AC_CHECK_PROGS(DTRACE, dtrace) -+ if test -z "$DTRACE"; then -+ AC_MSG_ERROR([dtrace not found]) -+ fi -+ AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='yes'], -+ [SDT_H_FOUND='no'; -+ AC_MSG_ERROR([systemtap support needs sys/sdt.h header])]) -+ AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using SystemTap probes.]) -+ AC_ARG_WITH([tapset-install-dir], -+ [AS_HELP_STRING([--with-tapset-install-dir], -+ [The absolute path where the tapset dir will be installed])], -+ [if test "x${withval}" = x; then -+ ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset" -+ else -+ ABS_TAPSET_DIR="${withval}" -+ fi], [ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset"]) -+ AC_SUBST(ABS_TAPSET_DIR) -+fi -+ - # Solaris needs some libraries for functions - AC_SEARCH_LIBS(socket, [socket]) - AC_SEARCH_LIBS(inet_ntoa, [nsl]) -@@ -701,6 +730,7 @@ AC_OUTPUT([ - tests/Makefile - server/tests/Makefile - doc/devel/doxyfile -+ tapset/Makefile - ]) - - sh util/bindvar.sh -diff -up dhcp-4.2.5b1/Makefile.am.systemtap dhcp-4.2.5b1/Makefile.am ---- dhcp-4.2.5b1/Makefile.am.systemtap 2012-12-17 16:56:40.461882654 +0100 -+++ dhcp-4.2.5b1/Makefile.am 2012-12-17 16:56:40.597880870 +0100 -@@ -30,5 +30,8 @@ endif - - SUBDIRS += includes tests common omapip client dhcpctl relay server - -+SUBDIRS += tapset -+#DIST_SUBDIRS = $(SUBDIRS) -+ - nobase_include_HEADERS = dhcpctl/dhcpctl.h - -diff -up dhcp-4.2.5b1/server/dhcp.c.systemtap dhcp-4.2.5b1/server/dhcp.c ---- dhcp-4.2.5b1/server/dhcp.c.systemtap 2012-12-17 16:56:40.483882364 +0100 -+++ dhcp-4.2.5b1/server/dhcp.c 2012-12-17 16:56:40.599880842 +0100 -@@ -36,7 +36,7 @@ - #include - #include - #include -- -+#include "trace.h" - static void commit_leases_ackout(void *foo); - static void maybe_return_agent_options(struct packet *packet, - struct option_state *options); -@@ -275,6 +275,8 @@ void dhcpdiscover (packet, ms_nulltp) - dhcp_failover_state_t *peer; - #endif - -+ TRACE(DHCPD_DISCOVER_START()); -+ - find_lease (&lease, packet, packet -> shared_network, - 0, &peer_has_leases, (struct lease *)0, MDL); - -@@ -399,6 +401,8 @@ void dhcpdiscover (packet, ms_nulltp) - out: - if (lease) - lease_dereference (&lease, MDL); -+ -+ TRACE(DHCPD_DISCOVER_DONE()); - } - - void dhcprequest (packet, ms_nulltp, ip_lease) -@@ -421,6 +425,8 @@ void dhcprequest (packet, ms_nulltp, ip_ - #endif - int have_requested_addr = 0; - -+ TRACE(DHCPD_REQUEST_START()); -+ - oc = lookup_option (&dhcp_universe, packet -> options, - DHO_DHCP_REQUESTED_ADDRESS); - memset (&data, 0, sizeof data); -@@ -700,6 +706,9 @@ void dhcprequest (packet, ms_nulltp, ip_ - log_info ("%s: unknown lease %s.", msgbuf, piaddr (cip)); - - out: -+ -+ TRACE(DHCPD_REQUEST_DONE()); -+ - if (subnet) - subnet_dereference (&subnet, MDL); - if (lease) -@@ -718,6 +727,7 @@ void dhcprelease (packet, ms_nulltp) - const char *s; - char msgbuf [1024], cstr[16]; /* XXX */ - -+ TRACE(DHCPD_RELEASE_START()); - - /* DHCPRELEASE must not specify address in requested-address - option, but old protocol specs weren't explicit about this, -@@ -842,6 +852,8 @@ void dhcprelease (packet, ms_nulltp) - #endif - if (lease) - lease_dereference (&lease, MDL); -+ -+ TRACE(DHCPD_RELEASE_DONE()); - } - - void dhcpdecline (packet, ms_nulltp) -@@ -859,6 +871,8 @@ void dhcpdecline (packet, ms_nulltp) - struct option_cache *oc; - struct data_string data; - -+ TRACE(DHCPD_DECLINE_START()); -+ - /* DHCPDECLINE must specify address. */ - if (!(oc = lookup_option (&dhcp_universe, packet -> options, - DHO_DHCP_REQUESTED_ADDRESS))) -@@ -970,6 +984,8 @@ void dhcpdecline (packet, ms_nulltp) - option_state_dereference (&options, MDL); - if (lease) - lease_dereference (&lease, MDL); -+ -+ TRACE(DHCPD_DECLINE_DONE()); - } - - void dhcpinform (packet, ms_nulltp) -@@ -993,6 +1009,8 @@ void dhcpinform (packet, ms_nulltp) - struct interface_info *interface; - int result; - -+ TRACE(DHCPD_INFORM_START()); -+ - /* The client should set ciaddr to its IP address, but apparently - it's common for clients not to do this, so we'll use their IP - source address if they didn't set ciaddr. */ -@@ -1350,6 +1368,8 @@ void dhcpinform (packet, ms_nulltp) - - if (subnet) - subnet_dereference (&subnet, MDL); -+ -+ TRACE(DHCPD_INFORM_DONE()); - } - - void nak_lease (packet, cip) -@@ -1366,6 +1386,8 @@ void nak_lease (packet, cip) - struct option_state *options = (struct option_state *)0; - struct option_cache *oc = (struct option_cache *)0; - -+ TRACE(DHCPD_NAK_LEASE_START()); -+ - option_state_allocate (&options, MDL); - memset (&outgoing, 0, sizeof outgoing); - memset (&raw, 0, sizeof raw); -@@ -1532,6 +1554,7 @@ void nak_lease (packet, cip) - packet->interface->name); - } - -+ TRACE(DHCPD_NAK_LEASE_DONE()); - } - - void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) -@@ -1573,6 +1596,8 @@ void ack_lease (packet, lease, offer, wh - if (lease -> state) - return; - -+ TRACE(DHCPD_ACK_LEASE_START()); -+ - /* Save original cltt for comparison later. */ - lease_cltt = lease->cltt; - -@@ -2936,6 +2961,8 @@ void ack_lease (packet, lease, offer, wh - #endif - dhcp_reply(lease); - } -+ -+ TRACE(DHCPD_ACK_LEASE_DONE()); - } - - /* -@@ -3088,6 +3115,8 @@ void dhcp_reply (lease) - if (!state) - log_fatal ("dhcp_reply was supplied lease with no state!"); - -+ TRACE(DHCPD_REPLY_START()); -+ - /* Compose a response for the client... */ - memset (&raw, 0, sizeof raw); - memset (&d1, 0, sizeof d1); -@@ -3309,6 +3338,8 @@ void dhcp_reply (lease) - - free_lease_state (state, MDL); - lease -> state = (struct lease_state *)0; -+ -+ TRACE(DHCPD_REPLY_DONE()); - } - - int find_lease (struct lease **lp, -@@ -3331,6 +3362,8 @@ int find_lease (struct lease **lp, - struct data_string client_identifier; - struct hardware h; - -+ TRACE(DHCPD_FIND_LEASE_START()); -+ - #if defined(FAILOVER_PROTOCOL) - /* Quick check to see if the peer has leases. */ - if (peer_has_leases) { -@@ -4058,6 +4091,9 @@ int find_lease (struct lease **lp, - #if defined (DEBUG_FIND_LEASE) - log_info ("Not returning a lease."); - #endif -+ -+ TRACE(DHCPD_FIND_LEASE_DONE()); -+ - return 0; - } - -diff -up dhcp-4.2.5b1/server/dhcpd.c.systemtap dhcp-4.2.5b1/server/dhcpd.c ---- dhcp-4.2.5b1/server/dhcpd.c.systemtap 2012-12-17 16:56:40.578881119 +0100 -+++ dhcp-4.2.5b1/server/dhcpd.c 2012-12-17 16:56:40.599880842 +0100 -@@ -58,6 +58,8 @@ static const char url [] = - # undef group - #endif /* PARANOIA */ - -+#include "trace.h" -+ - #ifndef UNIT_TEST - static void usage(void); - #endif -@@ -865,6 +867,7 @@ main(int argc, char **argv) { - omapi_set_int_value ((omapi_object_t *)dhcp_control_object, - (omapi_object_t *)0, "state", server_running); - -+ TRACE(DHCPD_MAIN()); - /* Receive packets and dispatch them... */ - dispatch (); - -diff -up dhcp-4.2.5b1/server/dhcpv6.c.systemtap dhcp-4.2.5b1/server/dhcpv6.c ---- dhcp-4.2.5b1/server/dhcpv6.c.systemtap 2012-12-17 16:56:40.571881210 +0100 -+++ dhcp-4.2.5b1/server/dhcpv6.c 2012-12-17 16:56:40.601880816 +0100 -@@ -15,6 +15,7 @@ - */ - - #include "dhcpd.h" -+#include "trace.h" - - #ifdef DHCPv6 - -@@ -4212,6 +4213,8 @@ static void - dhcpv6_solicit(struct data_string *reply_ret, struct packet *packet) { - struct data_string client_id; - -+ TRACE(DHCPD_6_SOLICIT_START()); -+ - /* - * Validate our input. - */ -@@ -4225,6 +4228,8 @@ dhcpv6_solicit(struct data_string *reply - * Clean up. - */ - data_string_forget(&client_id, MDL); -+ -+ TRACE(DHCPD_6_SOLICIT_DONE()); - } - - /* -@@ -4238,6 +4243,8 @@ dhcpv6_request(struct data_string *reply - struct data_string client_id; - struct data_string server_id; - -+ TRACE(DHCPD_6_REQUEST_START()); -+ - /* - * Validate our input. - */ -@@ -4255,6 +4262,8 @@ dhcpv6_request(struct data_string *reply - */ - data_string_forget(&client_id, MDL); - data_string_forget(&server_id, MDL); -+ -+ TRACE(DHCPD_6_REQUEST_DONE()); - } - - /* Find a DHCPv6 packet's shared network from hints in the packet. -@@ -4367,6 +4376,8 @@ dhcpv6_confirm(struct data_string *reply - struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data; - int reply_ofs = (int)(offsetof(struct dhcpv6_packet, options)); - -+ TRACE(DHCPD_6_CONFIRM_START()); -+ - /* - * Basic client message validation. - */ -@@ -4553,6 +4564,8 @@ exit: - option_state_dereference(&cli_enc_opt_state, MDL); - if (opt_state != NULL) - option_state_dereference(&opt_state, MDL); -+ -+ TRACE(DHCPD_6_CONFIRM_DONE()); - } - - /* -@@ -4567,6 +4580,8 @@ dhcpv6_renew(struct data_string *reply, - struct data_string client_id; - struct data_string server_id; - -+ TRACE(DHCPD_6_RENEW_START()); -+ - /* - * Validate the request. - */ -@@ -4584,6 +4599,8 @@ dhcpv6_renew(struct data_string *reply, - */ - data_string_forget(&server_id, MDL); - data_string_forget(&client_id, MDL); -+ -+ TRACE(DHCPD_6_RENEW_DONE()); - } - - /* -@@ -4597,6 +4614,8 @@ static void - dhcpv6_rebind(struct data_string *reply, struct packet *packet) { - struct data_string client_id; - -+ TRACE(DHCPD_6_REBIND_START()); -+ - if (!valid_client_msg(packet, &client_id)) { - return; - } -@@ -4604,6 +4623,8 @@ dhcpv6_rebind(struct data_string *reply, - lease_to_client(reply, packet, &client_id, NULL); - - data_string_forget(&client_id, MDL); -+ -+ TRACE(DHCPD_6_REBIND_DONE()); - } - - static void -@@ -5048,6 +5069,8 @@ dhcpv6_decline(struct data_string *reply - struct data_string client_id; - struct data_string server_id; - -+ TRACE(DHCPD_6_DECLINE_START()); -+ - /* - * Validate our input. - */ -@@ -5068,6 +5091,8 @@ dhcpv6_decline(struct data_string *reply - - data_string_forget(&server_id, MDL); - data_string_forget(&client_id, MDL); -+ -+ TRACE(DHCPD_6_DECLINE_DONE()); - } - - static void -@@ -5516,6 +5541,8 @@ dhcpv6_release(struct data_string *reply - struct data_string client_id; - struct data_string server_id; - -+ TRACE(DHCPD_6_RELEASE_START()); -+ - /* - * Validate our input. - */ -@@ -5537,6 +5564,8 @@ dhcpv6_release(struct data_string *reply - - data_string_forget(&server_id, MDL); - data_string_forget(&client_id, MDL); -+ -+ TRACE(DHCPD_6_RELEASE_DONE()); - } - - /* -@@ -5549,6 +5578,8 @@ dhcpv6_information_request(struct data_s - struct data_string client_id; - struct data_string server_id; - -+ TRACE(DHCPD_6_INFORMATION_REQUEST_START()); -+ - /* - * Validate our input. - */ -@@ -5580,6 +5611,8 @@ dhcpv6_information_request(struct data_s - data_string_forget(&client_id, MDL); - } - data_string_forget(&server_id, MDL); -+ -+ TRACE(DHCPD_6_INFORMATION_REQUEST_DONE()); - } - - /* -@@ -5608,6 +5641,8 @@ dhcpv6_relay_forw(struct data_string *re - struct dhcpv6_relay_packet *reply; - int reply_ofs; - -+ TRACE(DHCPD_6_RELAY_FORW_START()); -+ - /* - * Initialize variables for early exit. - */ -@@ -5867,6 +5902,8 @@ exit: - if (enc_packet != NULL) { - packet_dereference(&enc_packet, MDL); - } -+ -+ TRACE(DHCPD_6_RELAY_FORW_DONE()); - } - - static void -diff -up dhcp-4.2.5b1/server/failover.c.systemtap dhcp-4.2.5b1/server/failover.c ---- dhcp-4.2.5b1/server/failover.c.systemtap 2012-12-05 02:17:39.000000000 +0100 -+++ dhcp-4.2.5b1/server/failover.c 2012-12-17 16:56:40.603880790 +0100 -@@ -36,6 +36,8 @@ - #include "dhcpd.h" - #include - -+#include "trace.h" -+ - #if defined (FAILOVER_PROTOCOL) - dhcp_failover_state_t *failover_states; - static isc_result_t do_a_failover_option (omapi_object_t *, -@@ -1712,6 +1714,8 @@ isc_result_t dhcp_failover_set_state (dh - struct lease *l; - struct timeval tv; - -+ TRACE(DHCPD_FAILOVER_SET_STATE_START(state->me.state, new_state)); -+ - /* If we're in certain states where we're sending updates, and the peer - * state changes, we need to re-schedule any pending updates just to - * be on the safe side. This results in retransmission. -@@ -1939,6 +1943,8 @@ isc_result_t dhcp_failover_set_state (dh - break; - } - -+ TRACE(DHCPD_FAILOVER_SET_STATE_DONE()); -+ - return ISC_R_SUCCESS; - } - -@@ -2422,6 +2428,8 @@ dhcp_failover_pool_dobalance(dhcp_failov - if (state -> me.state != normal) - return 0; - -+ TRACE(DHCPD_FAILOVER_POOL_DOBALANCE_START()); -+ - state->last_balance = cur_time; - - for (s = shared_networks ; s ; s = s->next) { -@@ -2582,6 +2590,8 @@ dhcp_failover_pool_dobalance(dhcp_failov - if (leases_queued) - commit_leases(); - -+ TRACE(DHCPD_FAILOVER_POOL_DOBALANCE_DONE()); -+ - return leases_queued; - } - -diff -up dhcp-4.2.5b1/server/Makefile.am.systemtap dhcp-4.2.5b1/server/Makefile.am ---- dhcp-4.2.5b1/server/Makefile.am.systemtap 2012-12-17 16:56:40.563881316 +0100 -+++ dhcp-4.2.5b1/server/Makefile.am 2012-12-17 16:56:40.603880790 +0100 -@@ -10,7 +10,7 @@ dist_sysconf_DATA = dhcpd.conf.example - 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 ldap.c ldap_casa.c -+ dhcpv6.c mdb6.c ldap.c ldap_casa.c probes.d trace.h - - dhcpd_CFLAGS = $(LDAP_CFLAGS) - dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \ -@@ -19,3 +19,13 @@ dhcpd_LDADD = ../common/libdhcp.a ../oma - man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5 - EXTRA_DIST = $(man_MANS) - -+if ENABLE_SYSTEMTAP -+BUILT_SOURCES = probes.h -+probes.h: probes.d -+ $(DTRACE) -C -h -s $< -o $@ -+ -+probes.o: probes.d -+ $(DTRACE) -C -G -s $< -o $@ -+ -+dhcpd_LDADD += probes.o -+endif -diff -up dhcp-4.2.5b1/server/probes.d.systemtap dhcp-4.2.5b1/server/probes.d ---- dhcp-4.2.5b1/server/probes.d.systemtap 2012-12-17 16:56:40.603880790 +0100 -+++ dhcp-4.2.5b1/server/probes.d 2012-12-17 16:56:40.603880790 +0100 -@@ -0,0 +1,43 @@ -+provider dhcpd { -+ probe main(); -+ probe discover_start() -+ probe discover_done() -+ probe request_start() -+ probe request_done() -+ probe release_start() -+ probe release_done() -+ probe decline_start() -+ probe decline_done() -+ probe inform_start() -+ probe inform_done() -+ probe nak_lease_start() -+ probe nak_lease_done() -+ probe ack_lease_start() -+ probe ack_lease_done() -+ probe reply_start() -+ probe reply_done() -+ probe find_lease_start() -+ probe find_lease_done() -+ probe 6_solicit_start() -+ probe 6_solicit_done() -+ probe 6_request_start() -+ probe 6_request_done() -+ probe 6_confirm_start() -+ probe 6_confirm_done() -+ probe 6_renew_start() -+ probe 6_renew_done() -+ probe 6_rebind_start() -+ probe 6_rebind_done() -+ probe 6_decline_start() -+ probe 6_decline_done() -+ probe 6_release_start() -+ probe 6_release_done() -+ probe 6_information_request_start() -+ probe 6_information_request_done() -+ probe 6_relay_forw_start() -+ probe 6_relay_forw_done() -+ probe failover_pool_dobalance_start() -+ probe failover_pool_dobalance_done() -+ probe failover_set_state_start(int, int) /* state, new_state */ -+ probe failover_set_state_done() -+}; -diff -up dhcp-4.2.5b1/server/tests/Makefile.am.systemtap dhcp-4.2.5b1/server/tests/Makefile.am ---- dhcp-4.2.5b1/server/tests/Makefile.am.systemtap 2012-12-17 16:56:40.564881302 +0100 -+++ dhcp-4.2.5b1/server/tests/Makefile.am 2012-12-17 16:56:57.505650518 +0100 -@@ -20,6 +20,10 @@ DHCPSRC = ../dhcp.c ../bootp.c ../confpa - DHCPLIBS = $(top_builddir)/common/libdhcp.a $(top_builddir)/omapip/libomapi.la \ - $(top_builddir)/dhcpctl/libdhcpctl.la $(BIND9_LIBDIR) -ldns-export -lisc-export - -+if ENABLE_SYSTEMTAP -+DHCPLIBS += ../probes.o -+endif -+ - ATF_TESTS = - TESTS = - if HAVE_ATF -diff -up dhcp-4.2.5b1/server/trace.h.systemtap dhcp-4.2.5b1/server/trace.h ---- dhcp-4.2.5b1/server/trace.h.systemtap 2012-12-17 16:56:40.604880777 +0100 -+++ dhcp-4.2.5b1/server/trace.h 2012-12-17 16:56:40.604880777 +0100 -@@ -0,0 +1,11 @@ -+// trace.h -+ -+#include "config.h" -+#ifdef HAVE_SYSTEMTAP -+// include the generated probes header and put markers in code -+#include "probes.h" -+#define TRACE(probe) probe -+#else -+// Wrap the probe to allow it to be removed when no systemtap available -+#define TRACE(probe) -+#endif -diff -up dhcp-4.2.5b1/tapset/dhcpd.stp.systemtap dhcp-4.2.5b1/tapset/dhcpd.stp ---- dhcp-4.2.5b1/tapset/dhcpd.stp.systemtap 2012-12-17 16:56:40.604880777 +0100 -+++ dhcp-4.2.5b1/tapset/dhcpd.stp 2012-12-17 16:56:40.604880777 +0100 -@@ -0,0 +1,212 @@ -+/* dhcpd tapset -+ Copyright (C) 2011, Red Hat Inc. -+ */ -+ -+probe dhcpd_main = process("dhcpd").mark("main") -+{ -+ probestr = sprintf("%s(locals: %s)", $$name, $$locals); -+ -+} -+ -+probe dhcpd_discover_start = process("dhcpd").mark("discover_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_discover_done = process("dhcpd").mark("discover_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_request_start = process("dhcpd").mark("request_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_request_done = process("dhcpd").mark("request_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_release_start = process("dhcpd").mark("release_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_release_done = process("dhcpd").mark("release_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_decline_start = process("dhcpd").mark("decline_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_decline_done = process("dhcpd").mark("decline_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_inform_start = process("dhcpd").mark("inform_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_inform_done = process("dhcpd").mark("inform_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_nak_lease_start = process("dhcpd").mark("nak_lease_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_nak_lease_done = process("dhcpd").mark("nak_lease_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_ack_lease_start = process("dhcpd").mark("ack_lease_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_ack_lease_done = process("dhcpd").mark("ack_lease_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_reply_start = process("dhcpd").mark("reply_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_reply_done = process("dhcpd").mark("reply_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_find_lease_start = process("dhcpd").mark("find_lease_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_find_lease_done = process("dhcpd").mark("find_lease_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_solicit_start = process("dhcpd").mark("6_solicit_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_solicit_done = process("dhcpd").mark("6_solicit_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_request_start = process("dhcpd").mark("6_request_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_request_done = process("dhcpd").mark("6_request_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_confirm_start = process("dhcpd").mark("6_confirm_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_confirm_done = process("dhcpd").mark("6_confirm_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_renew_start = process("dhcpd").mark("6_renew_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_renew_done = process("dhcpd").mark("6_renew_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_rebind_start = process("dhcpd").mark("6_rebind_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_rebind_done = process("dhcpd").mark("6_rebind_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_decline_start = process("dhcpd").mark("6_decline_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_decline_done = process("dhcpd").mark("6_decline_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_release_start = process("dhcpd").mark("6_release_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_release_done = process("dhcpd").mark("6_release_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_information_request_start = process("dhcpd").mark("6_information_request_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_information_request_done = process("dhcpd").mark("6_information_request_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_relay_forw_start = process("dhcpd").mark("6_relay_forw_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_6_relay_forw_done = process("dhcpd").mark("6_relay_forw_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_failover_pool_dobalance_start = process("dhcpd").mark("failover_pool_dobalance_start") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+probe dhcpd_failover_pool_dobalance_done = process("dhcpd").mark("failover_pool_dobalance_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -+ -+ -+probe dhcpd_failover_set_state_start = process("dhcpd").mark("failover_set_state_start") -+{ -+ state = $arg1; -+ new_state = $arg2; -+ probestr = sprintf("%s(state=%d, new_state=%d)", $$name, state, new_state); -+} -+ -+probe dhcpd_failover_set_state_done = process("dhcpd").mark("failover_set_state_done") -+{ -+ probestr = sprintf("%s", $$name); -+} -diff -up dhcp-4.2.5b1/tapset/Makefile.am.systemtap dhcp-4.2.5b1/tapset/Makefile.am ---- dhcp-4.2.5b1/tapset/Makefile.am.systemtap 2012-12-17 16:56:40.604880777 +0100 -+++ dhcp-4.2.5b1/tapset/Makefile.am 2012-12-17 16:56:40.604880777 +0100 -@@ -0,0 +1,26 @@ -+# Makefile.am for dhcp/tapset -+# Jiri Popelka -+ -+.PHONY: clean-local install-data-hook uninstall-local -+ -+# -+EXTRA_DIST = dhcpd.stp -+TAPSET_FILES = $(EXTRA_DIST) -+TAPSET_INSTALL_DIR = $(DESTDIR)@ABS_TAPSET_DIR@ -+ -+if ENABLE_SYSTEMTAP -+all-local: $(TAPSET_FILES) -+ -+clean-local: -+ -+install-data-hook: -+ $(MKDIR_P) $(TAPSET_INSTALL_DIR) -+ $(INSTALL_DATA) $(TAPSET_FILES) $(TAPSET_INSTALL_DIR) -+ -+uninstall-local: -+ @list='$(TAPSET_FILES)'; for p in $$list; do \ -+ echo " rm -f '$(TAPSET_INSTALL_DIR)/$$p'"; \ -+ rm -f "$(TAPSET_INSTALL_DIR)/$$p"; \ -+ done -+endif -+ diff --git a/dhcp-4.2.5b1-atf-pkgconfig.patch b/dhcp-4.2.5b1-atf-pkgconfig.patch deleted file mode 100644 index 73f1f55..0000000 --- a/dhcp-4.2.5b1-atf-pkgconfig.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff -up dhcp-4.2.5b1/configure.ac.pkgconfig dhcp-4.2.5b1/configure.ac ---- dhcp-4.2.5b1/configure.ac.pkgconfig 2012-12-05 02:18:44.000000000 +0100 -+++ dhcp-4.2.5b1/configure.ac 2012-12-17 15:45:33.769128387 +0100 -@@ -194,6 +194,9 @@ if test "$atf_path" != "no" ; then - if test -f $atf_path/lib/pkgconfig/atf-c.pc ; then - atf_pcp=$atf_path/lib/pkgconfig - fi -+ if test -f $atf_path/lib64/pkgconfig/atf-c.pc ; then -+ atf_pcp=$atf_path/lib64/pkgconfig -+ fi - else - # Not specified, try some common paths - atf_dirs="/usr /usr/local /usr/pkg /opt /opt/local" -@@ -202,6 +205,9 @@ if test "$atf_path" != "no" ; then - if test -f $d/lib/pkgconfig/atf-c.pc ; then - atf_pcp=$d/lib/pkgconfig - fi -+ if test -f $d/lib64/pkgconfig/atf-c.pc ; then -+ atf_pcp=$d/lib64/pkgconfig -+ fi - done - fi - if test "$atf_pcp" = "" ; then diff --git a/dhcp-4.2.6-64_bit_lease_parse.patch b/dhcp-4.2.6-64_bit_lease_parse.patch new file mode 100644 index 0000000..9fc1468 --- /dev/null +++ b/dhcp-4.2.6-64_bit_lease_parse.patch @@ -0,0 +1,84 @@ +diff -up dhcp-4.2.6b1/common/parse.c.64-bit_lease_parse dhcp-4.2.6b1/common/parse.c +--- dhcp-4.2.6b1/common/parse.c.64-bit_lease_parse 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/common/parse.c 2014-01-23 14:35:38.887313769 +0100 +@@ -938,8 +938,8 @@ TIME + parse_date_core(cfile) + struct parse *cfile; + { +- int guess; +- int tzoff, year, mon, mday, hour, min, sec; ++ TIME guess; ++ long int tzoff, year, mon, mday, hour, min, sec; + const char *val; + enum dhcp_token token; + static int months[11] = { 31, 59, 90, 120, 151, 181, +@@ -965,7 +965,7 @@ parse_date_core(cfile) + } + + skip_token(&val, NULL, cfile); /* consume number */ +- guess = atoi(val); ++ guess = atol(val); + + return((TIME)guess); + } +@@ -993,7 +993,7 @@ parse_date_core(cfile) + somebody invents a time machine, I think we can safely disregard + it. This actually works around a stupid Y2K bug that was present + in a very early beta release of dhcpd. */ +- year = atoi(val); ++ year = atol(val); + if (year > 1900) + year -= 1900; + +@@ -1017,7 +1017,7 @@ parse_date_core(cfile) + return((TIME)0); + } + skip_token(&val, NULL, cfile); /* consume month */ +- mon = atoi(val) - 1; ++ mon = atol(val) - 1; + + /* Slash separating month from day... */ + token = peek_token(&val, NULL, cfile); +@@ -1039,7 +1039,7 @@ parse_date_core(cfile) + return((TIME)0); + } + skip_token(&val, NULL, cfile); /* consume day of month */ +- mday = atoi(val); ++ mday = atol(val); + + /* Hour... */ + token = peek_token(&val, NULL, cfile); +@@ -1050,7 +1050,7 @@ parse_date_core(cfile) + return((TIME)0); + } + skip_token(&val, NULL, cfile); /* consume hour */ +- hour = atoi(val); ++ hour = atol(val); + + /* Colon separating hour from minute... */ + token = peek_token(&val, NULL, cfile); +@@ -1072,7 +1072,7 @@ parse_date_core(cfile) + return((TIME)0); + } + skip_token(&val, NULL, cfile); /* consume minute */ +- min = atoi(val); ++ min = atol(val); + + /* Colon separating minute from second... */ + token = peek_token(&val, NULL, cfile); +@@ -1094,13 +1094,13 @@ parse_date_core(cfile) + return((TIME)0); + } + skip_token(&val, NULL, cfile); /* consume second */ +- sec = atoi(val); ++ sec = atol(val); + + tzoff = 0; + token = peek_token(&val, NULL, cfile); + if (token == NUMBER) { + skip_token(&val, NULL, cfile); /* consume tzoff */ +- tzoff = atoi(val); ++ tzoff = atol(val); + } else if (token != SEMI) { + skip_token(&val, NULL, cfile); + parse_warn(cfile, diff --git a/dhcp-4.2.6-CLOEXEC.patch b/dhcp-4.2.6-CLOEXEC.patch new file mode 100644 index 0000000..a90d686 --- /dev/null +++ b/dhcp-4.2.6-CLOEXEC.patch @@ -0,0 +1,342 @@ +diff -up dhcp-4.2.6b1/client/clparse.c.cloexec dhcp-4.2.6b1/client/clparse.c +--- dhcp-4.2.6b1/client/clparse.c.cloexec 2014-01-23 14:29:37.762381964 +0100 ++++ dhcp-4.2.6b1/client/clparse.c 2014-01-23 14:29:37.783381669 +0100 +@@ -253,7 +253,7 @@ int read_client_conf_file (const char *n + int token; + isc_result_t status; + +- if ((file = open (name, O_RDONLY)) < 0) ++ if ((file = open (name, O_RDONLY | O_CLOEXEC)) < 0) + return uerr2isc (errno); + + cfile = NULL; +@@ -290,7 +290,7 @@ void read_client_leases () + + /* Open the lease file. If we can't open it, just return - + 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 | O_CLOEXEC)) < 0) + return; + + cfile = NULL; +diff -up dhcp-4.2.6b1/client/dhclient.c.cloexec dhcp-4.2.6b1/client/dhclient.c +--- dhcp-4.2.6b1/client/dhclient.c.cloexec 2014-01-23 14:29:37.753382090 +0100 ++++ dhcp-4.2.6b1/client/dhclient.c 2014-01-23 14:30:26.663695670 +0100 +@@ -148,11 +148,11 @@ main(int argc, char **argv) { + /* Make sure that file descriptors 0 (stdin), 1, (stdout), and + 2 (stderr) are open. To do this, we assume that when we + open a file the lowest available file descriptor is used. */ +- fd = open("/dev/null", O_RDWR); ++ fd = open("/dev/null", O_RDWR | O_CLOEXEC); + if (fd == 0) +- fd = open("/dev/null", O_RDWR); ++ fd = open("/dev/null", O_RDWR | O_CLOEXEC); + if (fd == 1) +- fd = open("/dev/null", O_RDWR); ++ fd = open("/dev/null", O_RDWR | O_CLOEXEC); + if (fd == 2) + log_perror = 0; /* No sense logging to /dev/null. */ + else if (fd != -1) +@@ -505,7 +505,7 @@ main(int argc, char **argv) { + long temp; + int e; + +- if ((pidfd = fopen(path_dhclient_pid, "r")) != NULL) { ++ if ((pidfd = fopen(path_dhclient_pid, "re")) != NULL) { + e = fscanf(pidfd, "%ld\n", &temp); + oldpid = (pid_t)temp; + +@@ -555,7 +555,7 @@ main(int argc, char **argv) { + strncpy(new_path_dhclient_pid, path_dhclient_pid, pfx); + sprintf(new_path_dhclient_pid + pfx, "-%s.pid", ip->name); + +- if ((pidfd = fopen(new_path_dhclient_pid, "r")) != NULL) { ++ if ((pidfd = fopen(new_path_dhclient_pid, "re")) != NULL) { + e = fscanf(pidfd, "%ld\n", &temp); + oldpid = (pid_t)temp; + +@@ -580,7 +580,7 @@ main(int argc, char **argv) { + int dhc_running = 0; + char procfn[256] = ""; + +- if ((pidfp = fopen(path_dhclient_pid, "r")) != NULL) { ++ if ((pidfp = fopen(path_dhclient_pid, "re")) != NULL) { + if ((fscanf(pidfp, "%ld", &temp)==1) && ((dhcpid=(pid_t)temp) > 0)) { + snprintf(procfn,256,"/proc/%u",dhcpid); + dhc_running = (access(procfn, F_OK) == 0); +@@ -3024,7 +3024,7 @@ void rewrite_client_leases () + + if (leaseFile != NULL) + fclose (leaseFile); +- 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; +@@ -3145,7 +3145,7 @@ write_duid(struct data_string *duid) + return DHCP_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; +@@ -3325,7 +3325,7 @@ int write_client_lease (client, lease, r + return 1; + + 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 0; +@@ -3836,9 +3836,9 @@ void go_daemon () + (void) close(2); + + /* Reopen them on /dev/null. */ +- (void) open("/dev/null", O_RDWR); +- (void) open("/dev/null", O_RDWR); +- (void) open("/dev/null", O_RDWR); ++ (void) open("/dev/null", O_RDWR | O_CLOEXEC); ++ (void) open("/dev/null", O_RDWR | O_CLOEXEC); ++ (void) open("/dev/null", O_RDWR | O_CLOEXEC); + + write_client_pid_file (); + +@@ -3855,14 +3855,14 @@ void write_client_pid_file () + return; + } + +- pfdesc = open (path_dhclient_pid, O_CREAT | O_TRUNC | O_WRONLY, 0644); ++ pfdesc = open (path_dhclient_pid, O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, 0644); + + if (pfdesc < 0) { + log_error ("Can't create %s: %m", path_dhclient_pid); + return; + } + +- pf = fdopen (pfdesc, "w"); ++ pf = fdopen (pfdesc, "we"); + if (!pf) { + close(pfdesc); + log_error ("Can't fdopen %s: %m", path_dhclient_pid); +diff -up dhcp-4.2.6b1/common/bpf.c.cloexec dhcp-4.2.6b1/common/bpf.c +--- dhcp-4.2.6b1/common/bpf.c.cloexec 2014-01-23 14:29:37.766381908 +0100 ++++ dhcp-4.2.6b1/common/bpf.c 2014-01-23 14:29:37.789381585 +0100 +@@ -94,7 +94,7 @@ int if_register_bpf (info) + for (b = 0; 1; b++) { + /* %Audit% 31 bytes max. %2004.06.17,Safe% */ + sprintf(filename, BPF_FORMAT, b); +- sock = open (filename, O_RDWR, 0); ++ sock = open (filename, O_RDWR | O_CLOEXEC, 0); + if (sock < 0) { + if (errno == EBUSY) { + continue; +diff -up dhcp-4.2.6b1/common/dlpi.c.cloexec dhcp-4.2.6b1/common/dlpi.c +--- dhcp-4.2.6b1/common/dlpi.c.cloexec 2014-01-23 14:29:37.766381908 +0100 ++++ dhcp-4.2.6b1/common/dlpi.c 2014-01-23 14:29:37.789381585 +0100 +@@ -804,7 +804,7 @@ dlpiopen(const char *ifname) { + } + *dp = '\0'; + +- return open (devname, O_RDWR, 0); ++ return open (devname, O_RDWR | O_CLOEXEC, 0); + } + + /* +diff -up dhcp-4.2.6b1/common/nit.c.cloexec dhcp-4.2.6b1/common/nit.c +--- dhcp-4.2.6b1/common/nit.c.cloexec 2014-01-23 14:29:37.767381894 +0100 ++++ dhcp-4.2.6b1/common/nit.c 2014-01-23 14:29:37.790381571 +0100 +@@ -81,7 +81,7 @@ int if_register_nit (info) + struct strioctl sio; + + /* Open a NIT device */ +- sock = open ("/dev/nit", O_RDWR); ++ sock = open ("/dev/nit", O_RDWR | O_CLOEXEC); + if (sock < 0) + log_fatal ("Can't open NIT device for %s: %m", info -> name); + +diff -up dhcp-4.2.6b1/common/resolv.c.cloexec dhcp-4.2.6b1/common/resolv.c +--- dhcp-4.2.6b1/common/resolv.c.cloexec 2014-01-16 03:51:26.000000000 +0100 ++++ dhcp-4.2.6b1/common/resolv.c 2014-01-23 14:29:37.790381571 +0100 +@@ -50,7 +50,7 @@ void read_resolv_conf (parse_time) + 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 | O_CLOEXEC)) < 0) { + log_error ("Can't open %s: %m", path_resolv_conf); + return; + } +diff -up dhcp-4.2.6b1/common/upf.c.cloexec dhcp-4.2.6b1/common/upf.c +--- dhcp-4.2.6b1/common/upf.c.cloexec 2014-01-23 14:29:37.768381880 +0100 ++++ dhcp-4.2.6b1/common/upf.c 2014-01-23 14:29:37.790381571 +0100 +@@ -77,7 +77,7 @@ int if_register_upf (info) + /* %Audit% Cannot exceed 36 bytes. %2004.06.17,Safe% */ + sprintf(filename, "/dev/pf/pfilt%d", b); + +- sock = open (filename, O_RDWR, 0); ++ sock = open (filename, O_RDWR | O_CLOEXEC, 0); + if (sock < 0) { + if (errno == EBUSY) { + continue; +diff -up dhcp-4.2.6b1/omapip/trace.c.cloexec dhcp-4.2.6b1/omapip/trace.c +--- dhcp-4.2.6b1/omapip/trace.c.cloexec 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/omapip/trace.c 2014-01-23 14:29:37.791381557 +0100 +@@ -142,10 +142,10 @@ isc_result_t trace_begin (const char *fi + return DHCP_R_INVALIDARG; + } + +- traceoutfile = open (filename, O_CREAT | O_WRONLY | O_EXCL, 0600); ++ traceoutfile = open (filename, O_CREAT | O_WRONLY | O_EXCL | O_CLOEXEC, 0600); + if (traceoutfile < 0 && errno == EEXIST) { + log_error ("WARNING: Overwriting trace file \"%s\"", filename); +- traceoutfile = open (filename, O_WRONLY | O_EXCL | O_TRUNC, ++ traceoutfile = open (filename, O_WRONLY | O_EXCL | O_TRUNC | O_CLOEXEC, + 0600); + } + +@@ -433,7 +433,7 @@ void trace_file_replay (const char *file + isc_result_t result; + int len; + +- traceinfile = fopen (filename, "r"); ++ traceinfile = fopen (filename, "re"); + if (!traceinfile) { + log_error("Can't open tracefile %s: %m", filename); + return; +diff -up dhcp-4.2.6b1/relay/dhcrelay.c.cloexec dhcp-4.2.6b1/relay/dhcrelay.c +--- dhcp-4.2.6b1/relay/dhcrelay.c.cloexec 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/relay/dhcrelay.c 2014-01-23 14:29:37.791381557 +0100 +@@ -184,11 +184,11 @@ main(int argc, char **argv) { + /* Make sure that file descriptors 0(stdin), 1,(stdout), and + 2(stderr) are open. To do this, we assume that when we + open a file the lowest available file descriptor is used. */ +- fd = open("/dev/null", O_RDWR); ++ fd = open("/dev/null", O_RDWR | O_CLOEXEC); + if (fd == 0) +- fd = open("/dev/null", O_RDWR); ++ fd = open("/dev/null", O_RDWR | O_CLOEXEC); + if (fd == 1) +- fd = open("/dev/null", O_RDWR); ++ fd = open("/dev/null", O_RDWR | O_CLOEXEC); + if (fd == 2) + log_perror = 0; /* No sense logging to /dev/null. */ + else if (fd != -1) +@@ -545,13 +545,13 @@ main(int argc, char **argv) { + + if (no_pid_file == ISC_FALSE) { + pfdesc = open(path_dhcrelay_pid, +- O_CREAT | O_TRUNC | O_WRONLY, 0644); ++ O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, 0644); + + if (pfdesc < 0) { + log_error("Can't create %s: %m", + path_dhcrelay_pid); + } else { +- pf = fdopen(pfdesc, "w"); ++ pf = fdopen(pfdesc, "we"); + if (!pf) + log_error("Can't fdopen %s: %m", + path_dhcrelay_pid); +diff -up dhcp-4.2.6b1/server/confpars.c.cloexec dhcp-4.2.6b1/server/confpars.c +--- dhcp-4.2.6b1/server/confpars.c.cloexec 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/server/confpars.c 2014-01-23 14:29:37.793381529 +0100 +@@ -116,7 +116,7 @@ isc_result_t read_conf_file (const char + } + #endif + +- if ((file = open (filename, O_RDONLY)) < 0) { ++ if ((file = open (filename, O_RDONLY | O_CLOEXEC)) < 0) { + if (leasep) { + log_error ("Can't open lease database %s: %m --", + path_dhcpd_db); +diff -up dhcp-4.2.6b1/server/db.c.cloexec dhcp-4.2.6b1/server/db.c +--- dhcp-4.2.6b1/server/db.c.cloexec 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/server/db.c 2014-01-23 14:29:37.793381529 +0100 +@@ -1055,7 +1055,7 @@ void db_startup (testp) + } + #endif + if (!testp) { +- db_file = fopen (path_dhcpd_db, "a"); ++ db_file = fopen (path_dhcpd_db, "ae"); + if (!db_file) + log_fatal ("Can't open %s for append.", path_dhcpd_db); + expire_all_pools (); +@@ -1103,12 +1103,12 @@ int new_lease_file () + path_dhcpd_db, (int)t) >= sizeof newfname) + log_fatal("new_lease_file: lease file path too long"); + +- db_fd = open (newfname, O_WRONLY | O_TRUNC | O_CREAT, 0664); ++ db_fd = open (newfname, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, 0664); + if (db_fd < 0) { + log_error ("Can't create new lease file: %m"); + return 0; + } +- if ((new_db_file = fdopen(db_fd, "w")) == NULL) { ++ if ((new_db_file = fdopen(db_fd, "we")) == NULL) { + log_error("Can't fdopen new lease file: %m"); + close(db_fd); + goto fdfail; +diff -up dhcp-4.2.6b1/server/dhcpd.c.cloexec dhcp-4.2.6b1/server/dhcpd.c +--- dhcp-4.2.6b1/server/dhcpd.c.cloexec 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/server/dhcpd.c 2014-01-23 14:31:14.770020531 +0100 +@@ -272,11 +272,11 @@ main(int argc, char **argv) { + /* Make sure that file descriptors 0 (stdin), 1, (stdout), and + 2 (stderr) are open. To do this, we assume that when we + open a file the lowest available file descriptor is used. */ +- fd = open("/dev/null", O_RDWR); ++ fd = open("/dev/null", O_RDWR | O_CLOEXEC); + if (fd == 0) +- fd = open("/dev/null", O_RDWR); ++ fd = open("/dev/null", O_RDWR | O_CLOEXEC); + if (fd == 1) +- fd = open("/dev/null", O_RDWR); ++ fd = open("/dev/null", O_RDWR | O_CLOEXEC); + if (fd == 2) + log_perror = 0; /* No sense logging to /dev/null. */ + else if (fd != -1) +@@ -795,7 +795,7 @@ main(int argc, char **argv) { + */ + if (no_pid_file == ISC_FALSE) { + /*Read previous pid file. */ +- if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) { ++ if ((i = open (path_dhcpd_pid, O_RDONLY | O_CLOEXEC)) >= 0) { + status = read(i, pbuf, (sizeof pbuf) - 1); + close (i); + if (status > 0) { +@@ -814,7 +814,7 @@ main(int argc, char **argv) { + } + + /* Write new pid file. */ +- i = open(path_dhcpd_pid, O_WRONLY|O_CREAT|O_TRUNC, 0644); ++ i = open(path_dhcpd_pid, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0644); + if (i >= 0) { + sprintf(pbuf, "%d\n", (int) getpid()); + IGNORE_RET (write(i, pbuf, strlen(pbuf))); +@@ -842,9 +842,9 @@ main(int argc, char **argv) { + (void) close(2); + + /* Reopen them on /dev/null. */ +- (void) open("/dev/null", O_RDWR); +- (void) open("/dev/null", O_RDWR); +- (void) open("/dev/null", O_RDWR); ++ (void) open("/dev/null", O_RDWR | O_CLOEXEC); ++ (void) open("/dev/null", O_RDWR | O_CLOEXEC); ++ (void) open("/dev/null", O_RDWR | O_CLOEXEC); + log_perror = 0; /* No sense logging to /dev/null. */ + + IGNORE_RET (chdir("/")); +diff -up dhcp-4.2.6b1/server/ldap.c.cloexec dhcp-4.2.6b1/server/ldap.c +--- dhcp-4.2.6b1/server/ldap.c.cloexec 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/server/ldap.c 2014-01-23 14:29:37.795381501 +0100 +@@ -685,7 +685,7 @@ ldap_start (void) + + if (ldap_debug_file != NULL && ldap_debug_fd == -1) + { +- if ((ldap_debug_fd = open (ldap_debug_file, O_CREAT | O_TRUNC | O_WRONLY, ++ if ((ldap_debug_fd = open (ldap_debug_file, O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, + S_IRUSR | S_IWUSR)) < 0) + log_error ("Error opening debug LDAP log file %s: %s", ldap_debug_file, + strerror (errno)); diff --git a/dhcp-4.2.6-capability.patch b/dhcp-4.2.6-capability.patch new file mode 100644 index 0000000..290dddc --- /dev/null +++ b/dhcp-4.2.6-capability.patch @@ -0,0 +1,250 @@ +diff -up dhcp-4.2.6b1/client/dhclient.8.capability dhcp-4.2.6b1/client/dhclient.8 +--- dhcp-4.2.6b1/client/dhclient.8.capability 2014-01-23 14:37:45.340539027 +0100 ++++ dhcp-4.2.6b1/client/dhclient.8 2014-01-23 14:37:45.402538157 +0100 +@@ -118,6 +118,9 @@ dhclient - Dynamic Host Configuration Pr + .B -w + ] + [ ++.B -nc ++] ++[ + .B -B + ] + [ +@@ -294,6 +297,32 @@ has been added or removed, so that the c + address on that interface. + + .TP ++.BI \-nc ++Do not drop capabilities. ++ ++Normally, if ++.B dhclient ++was compiled with libcap-ng support, ++.B dhclient ++drops most capabilities immediately upon startup. While more secure, ++this greatly restricts the additional actions that hooks in ++.B dhclient-script (8) ++can take. (For example, any daemons that ++.B dhclient-script (8) ++starts or restarts will inherit the restricted capabilities as well, ++which may interfere with their correct operation.) Thus, the ++.BI \-nc ++option can be used to prevent ++.B dhclient ++from dropping capabilities. ++ ++The ++.BI \-nc ++option is ignored if ++.B dhclient ++was not compiled with libcap-ng support. ++ ++.TP + .BI \-B + Set the BOOTP broadcast flag in request packets so servers will always + broadcast replies. +diff -up dhcp-4.2.6b1/client/dhclient.c.capability dhcp-4.2.6b1/client/dhclient.c +--- dhcp-4.2.6b1/client/dhclient.c.capability 2014-01-23 14:37:45.384538409 +0100 ++++ dhcp-4.2.6b1/client/dhclient.c 2014-01-23 14:37:45.403538143 +0100 +@@ -39,6 +39,10 @@ + #include + #include + ++#ifdef HAVE_LIBCAP_NG ++#include ++#endif ++ + /* + * Defined in stdio.h when _GNU_SOURCE is set, but we don't want to define + * that when building ISC code. +@@ -141,6 +145,9 @@ main(int argc, char **argv) { + int timeout_arg = 0; + char *arg_conf = NULL; + int arg_conf_len = 0; ++#ifdef HAVE_LIBCAP_NG ++ int keep_capabilities = 0; ++#endif + + /* Initialize client globals. */ + memset(&default_duid, 0, sizeof(default_duid)); +@@ -410,6 +417,10 @@ main(int argc, char **argv) { + } + + dhclient_request_options = argv[i]; ++ } else if (!strcmp(argv[i], "-nc")) { ++#ifdef HAVE_LIBCAP_NG ++ keep_capabilities = 1; ++#endif + } else if (argv[i][0] == '-') { + usage(); + } else if (interfaces_requested < 0) { +@@ -458,6 +469,19 @@ main(int argc, char **argv) { + path_dhclient_script = s; + } + ++#ifdef HAVE_LIBCAP_NG ++ /* Drop capabilities */ ++ if (!keep_capabilities) { ++ capng_clear(CAPNG_SELECT_CAPS); ++ capng_update(CAPNG_ADD, CAPNG_EFFECTIVE|CAPNG_PERMITTED, ++ CAP_DAC_OVERRIDE); // Drop this someday ++ capng_updatev(CAPNG_ADD, CAPNG_EFFECTIVE|CAPNG_PERMITTED, ++ CAP_NET_ADMIN, CAP_NET_RAW, ++ CAP_NET_BIND_SERVICE, CAP_SYS_ADMIN, -1); ++ capng_apply(CAPNG_SELECT_CAPS); ++ } ++#endif ++ + /* Set up the initial dhcp option universe. */ + initialize_common_option_spaces(); + +diff -up dhcp-4.2.6b1/client/dhclient-script.8.capability dhcp-4.2.6b1/client/dhclient-script.8 +--- dhcp-4.2.6b1/client/dhclient-script.8.capability 2014-01-23 14:37:45.374538550 +0100 ++++ dhcp-4.2.6b1/client/dhclient-script.8 2014-01-23 14:37:45.403538143 +0100 +@@ -246,6 +246,16 @@ repeatedly initialized to the values pro + the other. Assuming the information provided by both servers is + valid, this shouldn't cause any real problems, but it could be + confusing. ++.PP ++Normally, if dhclient was compiled with libcap-ng support, ++dhclient drops most capabilities immediately upon startup. ++While more secure, this greatly restricts the additional actions that ++hooks in dhclient-script can take. For example, any daemons that ++dhclient-script starts or restarts will inherit the restricted ++capabilities as well, which may interfere with their correct operation. ++Thus, the ++.BI \-nc ++option can be used to prevent dhclient from dropping capabilities. + .SH SEE ALSO + dhclient(8), dhcpd(8), dhcrelay(8), dhclient.conf(5) and + dhclient.leases(5). +diff -up dhcp-4.2.6b1/client/Makefile.am.capability dhcp-4.2.6b1/client/Makefile.am +--- dhcp-4.2.6b1/client/Makefile.am.capability 2014-01-23 14:37:45.324539252 +0100 ++++ dhcp-4.2.6b1/client/Makefile.am 2014-01-23 14:37:45.404538129 +0100 +@@ -5,7 +5,7 @@ dhclient_SOURCES = clparse.c dhclient.c + scripts/netbsd scripts/nextstep scripts/openbsd \ + scripts/solaris scripts/openwrt + dhclient_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ +- $(BIND9_LIBDIR) -ldns-export -lisc-export ++ $(BIND9_LIBDIR) -ldns-export -lisc-export $(CAPNG_LDADD) + man_MANS = dhclient.8 dhclient-script.8 dhclient.conf.5 dhclient.leases.5 + EXTRA_DIST = $(man_MANS) + +diff -up dhcp-4.2.6b1/configure.ac.capability dhcp-4.2.6b1/configure.ac +--- dhcp-4.2.6b1/configure.ac.capability 2014-01-23 14:37:45.332539139 +0100 ++++ dhcp-4.2.6b1/configure.ac 2014-01-23 14:37:45.404538129 +0100 +@@ -524,6 +524,41 @@ AC_TRY_COMPILE([],[void foo() __attribut + # Look for optional headers. + AC_CHECK_HEADERS(sys/socket.h net/if_dl.h net/if6.h regex.h) + ++# look for capabilities library ++AC_ARG_WITH(libcap-ng, ++ [ --with-libcap-ng=[auto/yes/no] Add Libcap-ng support [default=auto]],, ++ with_libcap_ng=auto) ++ ++# Check for Libcap-ng API ++# ++# libcap-ng detection ++if test x$with_libcap_ng = xno ; then ++ have_libcap_ng=no; ++else ++ # Start by checking for header file ++ AC_CHECK_HEADER(cap-ng.h, capng_headers=yes, capng_headers=no) ++ ++ # See if we have libcap-ng library ++ AC_CHECK_LIB(cap-ng, capng_clear, ++ CAPNG_LDADD=-lcap-ng,) ++ ++ # Check results are usable ++ if test x$with_libcap_ng = xyes -a x$CAPNG_LDADD = x ; then ++ AC_MSG_ERROR(libcap-ng support was requested and the library was not found) ++ fi ++ if test x$CAPNG_LDADD != x -a $capng_headers = no ; then ++ AC_MSG_ERROR(libcap-ng libraries found but headers are missing) ++ fi ++fi ++AC_SUBST(CAPNG_LDADD) ++AC_MSG_CHECKING(whether to use libcap-ng) ++if test x$CAPNG_LDADD != x ; then ++ AC_DEFINE(HAVE_LIBCAP_NG,1,[libcap-ng support]) ++ AC_MSG_RESULT(yes) ++else ++ AC_MSG_RESULT(no) ++fi ++ + # Solaris needs some libraries for functions + AC_SEARCH_LIBS(socket, [socket]) + AC_SEARCH_LIBS(inet_ntoa, [nsl]) +diff -up dhcp-4.2.6b1/relay/dhcrelay.c.capability dhcp-4.2.6b1/relay/dhcrelay.c +--- dhcp-4.2.6b1/relay/dhcrelay.c.capability 2014-01-23 14:37:45.386538381 +0100 ++++ dhcp-4.2.6b1/relay/dhcrelay.c 2014-01-23 14:39:12.035320984 +0100 +@@ -37,6 +37,11 @@ + #include + #include + ++#ifdef HAVE_LIBCAP_NG ++# include ++ int keep_capabilities = 0; ++#endif ++ + TIME default_lease_time = 43200; /* 12 hours... */ + TIME max_lease_time = 86400; /* 24 hours... */ + struct tree_cache *global_options[256]; +@@ -363,6 +368,10 @@ main(int argc, char **argv) { + sl->next = upstreams; + upstreams = sl; + #endif ++ } else if (!strcmp(argv[i], "-nc")) { ++#ifdef HAVE_LIBCAP_NG ++ keep_capabilities = 1; ++#endif + } else if (!strcmp(argv[i], "-pf")) { + if (++i == argc) + usage(); +@@ -433,6 +442,17 @@ main(int argc, char **argv) { + #endif + } + ++#ifdef HAVE_LIBCAP_NG ++ /* Drop capabilities */ ++ if (!keep_capabilities) { ++ capng_clear(CAPNG_SELECT_BOTH); ++ capng_updatev(CAPNG_ADD, CAPNG_EFFECTIVE|CAPNG_PERMITTED, ++ CAP_NET_RAW, CAP_NET_BIND_SERVICE, -1); ++ capng_apply(CAPNG_SELECT_BOTH); ++ log_info ("Dropped all unnecessary capabilities."); ++ } ++#endif ++ + if (!quiet) { + log_info("%s %s", message, PACKAGE_VERSION); + log_info(copyright); +@@ -582,6 +602,15 @@ main(int argc, char **argv) { + signal(SIGINT, dhcp_signal_handler); /* control-c */ + signal(SIGTERM, dhcp_signal_handler); /* kill */ + ++#ifdef HAVE_LIBCAP_NG ++ /* Drop all capabilities */ ++ if (!keep_capabilities) { ++ capng_clear(CAPNG_SELECT_BOTH); ++ capng_apply(CAPNG_SELECT_BOTH); ++ log_info ("Dropped all capabilities."); ++ } ++#endif ++ + /* Start dispatching packets and timeouts... */ + dispatch(); + +diff -up dhcp-4.2.6b1/relay/Makefile.am.capability dhcp-4.2.6b1/relay/Makefile.am +--- dhcp-4.2.6b1/relay/Makefile.am.capability 2014-01-23 14:37:45.326539223 +0100 ++++ dhcp-4.2.6b1/relay/Makefile.am 2014-01-23 14:37:45.405538115 +0100 +@@ -3,7 +3,7 @@ AM_CPPFLAGS = -DLOCALSTATEDIR='"@localst + sbin_PROGRAMS = dhcrelay + dhcrelay_SOURCES = dhcrelay.c + dhcrelay_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ +- $(BIND9_LIBDIR) -ldns-export -lisc-export ++ $(BIND9_LIBDIR) -ldns-export -lisc-export $(CAPNG_LDADD) + man_MANS = dhcrelay.8 + EXTRA_DIST = $(man_MANS) + diff --git a/dhcp-4.2.6-errwarn-message.patch b/dhcp-4.2.6-errwarn-message.patch new file mode 100644 index 0000000..a125428 --- /dev/null +++ b/dhcp-4.2.6-errwarn-message.patch @@ -0,0 +1,30 @@ +diff -up dhcp-4.2.6b1/omapip/errwarn.c.errwarn dhcp-4.2.6b1/omapip/errwarn.c +--- dhcp-4.2.6b1/omapip/errwarn.c.errwarn 2014-01-23 14:13:31.440914788 +0100 ++++ dhcp-4.2.6b1/omapip/errwarn.c 2014-01-23 14:15:42.134089836 +0100 +@@ -76,20 +76,13 @@ void log_fatal (const char * fmt, ... ) + + #if !defined (NOMINUM) + log_error ("%s", ""); +- log_error ("If you did not get this software from ftp.isc.org, please"); +- log_error ("get the latest from ftp.isc.org and install that before"); +- log_error ("requesting help."); ++ log_error ("This version of ISC DHCP is based on the release available"); ++ log_error ("on ftp.isc.org. Features have been added and other changes"); ++ log_error ("have been made to the base software release in order to make"); ++ log_error ("it work better with this distribution."); + log_error ("%s", ""); +- log_error ("If you did get this software from ftp.isc.org and have not"); +- log_error ("yet read the README, please read it before requesting help."); +- log_error ("If you intend to request help from the dhcp-bugs at isc.org"); +- log_error ("mailing list, please read the section on the REDDME about"); +- log_error ("submitting bug reports and requests for help."); +- log_error ("%s", ""); +- log_error ("Please do not under any circumstances send requests for"); +- log_error ("help directly to the authors of this software - please"); +- log_error ("send them to the appropriate mailing list as described in"); +- log_error ("the README file."); ++ log_error ("Please report for this software via the Red Hat Bugzilla site:"); ++ log_error (" http://bugzilla.redhat.com"); + log_error ("%s", ""); + log_error ("exiting."); + #endif diff --git a/dhcp-4.2.6-lpf-ib.patch b/dhcp-4.2.6-lpf-ib.patch new file mode 100644 index 0000000..c586706 --- /dev/null +++ b/dhcp-4.2.6-lpf-ib.patch @@ -0,0 +1,592 @@ +diff -up dhcp-4.2.6b1/client/dhclient.c.lpf-ib dhcp-4.2.6b1/client/dhclient.c +--- dhcp-4.2.6b1/client/dhclient.c.lpf-ib 2014-01-23 14:49:08.088935777 +0100 ++++ dhcp-4.2.6b1/client/dhclient.c 2014-01-23 14:49:08.095935679 +0100 +@@ -113,6 +113,8 @@ static int check_domain_name_list(const + static int check_option_values(struct universe *universe, unsigned int opt, + const char *ptr, size_t len); + ++static void setup_ib_interface(struct interface_info *ip); ++ + int + main(int argc, char **argv) { + int fd; +@@ -916,6 +918,14 @@ main(int argc, char **argv) { + } + srandom(seed + cur_time + (unsigned)getpid()); + ++ /* Setup specific Infiniband options */ ++ for (ip = interfaces; ip; ip = ip->next) { ++ if (ip->client && ++ (ip->hw_address.hbuf[0] == HTYPE_INFINIBAND)) { ++ setup_ib_interface(ip); ++ } ++ } ++ + /* Start a configuration state machine for each interface. */ + #ifdef DHCPv6 + if (local_family == AF_INET6) { +@@ -1195,6 +1205,29 @@ int find_subnet (struct subnet **sp, + return 0; + } + ++static void setup_ib_interface(struct interface_info *ip) ++{ ++ struct group *g; ++ ++ /* Set the broadcast flag */ ++ ip->client->config->bootp_broadcast_always = 1; ++ ++ /* ++ * Find out if a dhcp-client-identifier option was specified either ++ * in the config file or on the command line ++ */ ++ for (g = ip->client->config->on_transmission; g != NULL; g = g->next) { ++ if ((g->statements != NULL) && ++ (strcmp(g->statements->data.option->option->name, ++ "dhcp-client-identifier") == 0)) { ++ return; ++ } ++ } ++ ++ /* No client ID specified */ ++ log_fatal("dhcp-client-identifier must be specified for InfiniBand"); ++} ++ + /* Individual States: + * + * Each routine is called from the dhclient_state_machine() in one of +diff -up dhcp-4.2.6b1/common/bpf.c.lpf-ib dhcp-4.2.6b1/common/bpf.c +--- dhcp-4.2.6b1/common/bpf.c.lpf-ib 2014-01-23 14:49:08.077935932 +0100 ++++ dhcp-4.2.6b1/common/bpf.c 2014-01-23 14:49:08.095935679 +0100 +@@ -198,11 +198,44 @@ struct bpf_insn dhcp_bpf_filter [] = { + BPF_STMT(BPF_RET+BPF_K, 0), + }; + ++/* Packet filter program for DHCP over Infiniband. ++ * ++ * XXX ++ * Changes to the filter program may require changes to the constant offsets ++ * used in lpf_gen_filter_setup to patch the port in the BPF program! ++ * XXX ++ */ ++struct bpf_insn dhcp_ib_bpf_filter [] = { ++ /* Packet filter for Infiniband */ ++ /* Make sure it's a UDP packet... */ ++ BPF_STMT(BPF_LD + BPF_B + BPF_ABS, 9), ++ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, IPPROTO_UDP, 0, 6), ++ ++ /* Make sure this isn't a fragment... */ ++ BPF_STMT(BPF_LD + BPF_H + BPF_ABS, 6), ++ BPF_JUMP(BPF_JMP + BPF_JSET + BPF_K, 0x1fff, 4, 0), ++ ++ /* Get the IP header length... */ ++ BPF_STMT(BPF_LDX + BPF_B + BPF_MSH, 0), ++ ++ /* Make sure it's to the right port... */ ++ BPF_STMT(BPF_LD + BPF_H + BPF_IND, 2), ++ BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, 67, 0, 1), ++ ++ /* If we passed all the tests, ask for the whole packet. */ ++ BPF_STMT(BPF_RET + BPF_K, (u_int)-1), ++ ++ /* Otherwise, drop it. */ ++ BPF_STMT(BPF_RET + BPF_K, 0), ++}; ++ + #if defined (DEC_FDDI) + struct bpf_insn *bpf_fddi_filter; + #endif + + int dhcp_bpf_filter_len = sizeof dhcp_bpf_filter / sizeof (struct bpf_insn); ++int dhcp_ib_bpf_filter_len = sizeof dhcp_ib_bpf_filter / sizeof (struct bpf_insn); ++ + #if defined (HAVE_TR_SUPPORT) + struct bpf_insn dhcp_bpf_tr_filter [] = { + /* accept all token ring packets due to variable length header */ +diff -up dhcp-4.2.6b1/common/lpf.c.lpf-ib dhcp-4.2.6b1/common/lpf.c +--- dhcp-4.2.6b1/common/lpf.c.lpf-ib 2014-01-23 14:49:08.077935932 +0100 ++++ dhcp-4.2.6b1/common/lpf.c 2014-01-23 14:49:08.096935665 +0100 +@@ -43,6 +43,7 @@ + #include "includes/netinet/udp.h" + #include "includes/netinet/if_ether.h" + #include ++#include + + #ifndef PACKET_AUXDATA + #define PACKET_AUXDATA 8 +@@ -60,6 +61,15 @@ struct tpacket_auxdata + /* Reinitializes the specified interface after an address change. This + is not required for packet-filter APIs. */ + ++/* Default broadcast address for IPoIB */ ++static unsigned char default_ib_bcast_addr[20] = { ++ 0x00, 0xff, 0xff, 0xff, ++ 0xff, 0x12, 0x40, 0x1b, ++ 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, ++ 0xff, 0xff, 0xff, 0xff ++}; ++ + #ifdef USE_LPF_SEND + void if_reinitialize_send (info) + struct interface_info *info; +@@ -87,10 +97,21 @@ int if_register_lpf (info) + struct sockaddr common; + } sa; + struct ifreq ifr; ++ int type; ++ int protocol; + + /* Make an LPF socket. */ +- if ((sock = socket(PF_PACKET, SOCK_RAW, +- htons((short)ETH_P_ALL))) < 0) { ++ get_hw_addr(info); ++ ++ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) { ++ type = SOCK_DGRAM; ++ protocol = ETHERTYPE_IP; ++ } else { ++ type = SOCK_RAW; ++ protocol = ETH_P_ALL; ++ } ++ ++ if ((sock = socket(PF_PACKET, type, htons((short)protocol))) < 0) { + if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || + errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || + errno == EAFNOSUPPORT || errno == EINVAL) { +@@ -113,6 +134,7 @@ int if_register_lpf (info) + /* Bind to the interface name */ + memset (&sa, 0, sizeof sa); + sa.ll.sll_family = AF_PACKET; ++ sa.ll.sll_protocol = htons(protocol); + sa.ll.sll_ifindex = ifr.ifr_ifindex; + if (bind (sock, &sa.common, sizeof sa)) { + if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || +@@ -128,8 +150,6 @@ int if_register_lpf (info) + log_fatal ("Bind socket to interface: %m"); + } + +- get_hw_addr(info->name, &info->hw_address); +- + return sock; + } + #endif /* USE_LPF_SEND || USE_LPF_RECEIVE */ +@@ -184,6 +204,8 @@ void if_deregister_send (info) + in bpf includes... */ + extern struct sock_filter dhcp_bpf_filter []; + extern int dhcp_bpf_filter_len; ++extern struct sock_filter dhcp_ib_bpf_filter []; ++extern int dhcp_ib_bpf_filter_len; + + #if defined (HAVE_TR_SUPPORT) + extern struct sock_filter dhcp_bpf_tr_filter []; +@@ -201,11 +223,13 @@ void if_register_receive (info) + /* Open a LPF device and hang it on this interface... */ + info -> rfdesc = if_register_lpf (info); + +- val = 1; +- if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, &val, +- sizeof val) < 0) { +- if (errno != ENOPROTOOPT) +- log_fatal ("Failed to set auxiliary packet data: %m"); ++ if (info->hw_address.hbuf[0] != HTYPE_INFINIBAND) { ++ val = 1; ++ if (setsockopt (info -> rfdesc, SOL_PACKET, PACKET_AUXDATA, ++ &val, sizeof val) < 0) { ++ if (errno != ENOPROTOOPT) ++ log_fatal ("Failed to set auxiliary packet data: %m"); ++ } + } + + #if defined (HAVE_TR_SUPPORT) +@@ -251,15 +275,28 @@ static void lpf_gen_filter_setup (info) + + memset(&p, 0, sizeof(p)); + +- /* Set up the bpf filter program structure. This is defined in +- bpf.c */ +- p.len = dhcp_bpf_filter_len; +- p.filter = dhcp_bpf_filter; +- +- /* Patch the server port into the LPF program... +- XXX changes to filter program may require changes +- to the insn number(s) used below! XXX */ +- dhcp_bpf_filter [8].k = ntohs ((short)local_port); ++ if (info->hw_address.hbuf[0] == HTYPE_INFINIBAND) { ++ /* Set up the bpf filter program structure. */ ++ p.len = dhcp_ib_bpf_filter_len; ++ p.filter = dhcp_ib_bpf_filter; ++ ++ /* Patch the server port into the LPF program... ++ XXX ++ changes to filter program may require changes ++ to the insn number(s) used below! ++ XXX */ ++ dhcp_ib_bpf_filter[6].k = ntohs ((short)local_port); ++ } else { ++ /* Set up the bpf filter program structure. ++ This is defined in bpf.c */ ++ p.len = dhcp_bpf_filter_len; ++ p.filter = dhcp_bpf_filter; ++ ++ /* Patch the server port into the LPF program... ++ XXX changes to filter program may require changes ++ to the insn number(s) used below! XXX */ ++ dhcp_bpf_filter [8].k = ntohs ((short)local_port); ++ } + + if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, &p, + sizeof p) < 0) { +@@ -316,6 +353,54 @@ static void lpf_tr_filter_setup (info) + #endif /* USE_LPF_RECEIVE */ + + #ifdef USE_LPF_SEND ++ssize_t send_packet_ib(interface, packet, raw, len, from, to, hto) ++ struct interface_info *interface; ++ struct packet *packet; ++ struct dhcp_packet *raw; ++ size_t len; ++ struct in_addr from; ++ struct sockaddr_in *to; ++ struct hardware *hto; ++{ ++ unsigned ibufp = 0; ++ double ih [1536 / sizeof (double)]; ++ unsigned char *buf = (unsigned char *)ih; ++ ssize_t result; ++ ++ union sockunion { ++ struct sockaddr sa; ++ struct sockaddr_ll sll; ++ struct sockaddr_storage ss; ++ } su; ++ ++ assemble_udp_ip_header (interface, buf, &ibufp, from.s_addr, ++ to->sin_addr.s_addr, to->sin_port, ++ (unsigned char *)raw, len); ++ memcpy (buf + ibufp, raw, len); ++ ++ memset(&su, 0, sizeof(su)); ++ su.sll.sll_family = AF_PACKET; ++ su.sll.sll_protocol = htons(ETHERTYPE_IP); ++ ++ if (!(su.sll.sll_ifindex = if_nametoindex(interface->name))) { ++ errno = ENOENT; ++ log_error ("send_packet_ib: %m - failed to get if index"); ++ return -1; ++ } ++ ++ su.sll.sll_hatype = htons(HTYPE_INFINIBAND); ++ su.sll.sll_halen = sizeof(interface->bcast_addr); ++ memcpy(&su.sll.sll_addr, interface->bcast_addr, 20); ++ ++ result = sendto(interface->wfdesc, buf, ibufp + len, 0, ++ &su.sa, sizeof(su)); ++ ++ if (result < 0) ++ log_error ("send_packet_ib: %m"); ++ ++ return result; ++} ++ + ssize_t send_packet (interface, packet, raw, len, from, to, hto) + struct interface_info *interface; + struct packet *packet; +@@ -336,6 +421,11 @@ ssize_t send_packet (interface, packet, + return send_fallback (interface, packet, raw, + len, from, to, hto); + ++ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) { ++ return send_packet_ib(interface, packet, raw, len, from, ++ to, hto); ++ } ++ + if (hto == NULL && interface->anycast_mac_addr.hlen) + hto = &interface->anycast_mac_addr; + +@@ -357,6 +447,42 @@ ssize_t send_packet (interface, packet, + #endif /* USE_LPF_SEND */ + + #ifdef USE_LPF_RECEIVE ++ssize_t receive_packet_ib (interface, buf, len, from, hfrom) ++ struct interface_info *interface; ++ unsigned char *buf; ++ size_t len; ++ struct sockaddr_in *from; ++ struct hardware *hfrom; ++{ ++ int length = 0; ++ int offset = 0; ++ unsigned char ibuf [1536]; ++ unsigned bufix = 0; ++ unsigned paylen; ++ ++ length = read(interface->rfdesc, ibuf, sizeof(ibuf)); ++ ++ if (length <= 0) ++ return length; ++ ++ offset = decode_udp_ip_header(interface, ibuf, bufix, from, ++ (unsigned)length, &paylen, 0); ++ ++ if (offset < 0) ++ return 0; ++ ++ bufix += offset; ++ length -= offset; ++ ++ if (length < paylen) ++ log_fatal("Internal inconsistency at %s:%d.", MDL); ++ ++ /* Copy out the data in the packet... */ ++ memcpy(buf, &ibuf[bufix], paylen); ++ ++ return (ssize_t)paylen; ++} ++ + ssize_t receive_packet (interface, buf, len, from, hfrom) + struct interface_info *interface; + unsigned char *buf; +@@ -383,6 +509,10 @@ ssize_t receive_packet (interface, buf, + }; + struct cmsghdr *cmsg; + ++ if (interface->hw_address.hbuf[0] == HTYPE_INFINIBAND) { ++ return receive_packet_ib(interface, buf, len, from, hfrom); ++ } ++ + length = recvmsg (interface -> rfdesc, &msg, 0); + if (length <= 0) + return length; +@@ -462,11 +592,33 @@ void maybe_setup_fallback () + } + } + +-void +-get_hw_addr(const char *name, struct hardware *hw) { ++struct sockaddr_ll * ++get_ll (struct ifaddrs *ifaddrs, struct ifaddrs **ifa, char *name) ++{ ++ for (*ifa = ifaddrs; *ifa != NULL; *ifa = (*ifa)->ifa_next) { ++ if ((*ifa)->ifa_addr == NULL) ++ continue; ++ ++ if ((*ifa)->ifa_addr->sa_family != AF_PACKET) ++ continue; ++ ++ if ((*ifa)->ifa_flags & IFF_LOOPBACK) ++ continue; ++ ++ if (strcmp((*ifa)->ifa_name, name) == 0) ++ return (struct sockaddr_ll *)(void *)(*ifa)->ifa_addr; ++ } ++ *ifa = NULL; ++ return NULL; ++} ++ ++struct sockaddr_ll * ++ioctl_get_ll(char *name) ++{ + int sock; + struct ifreq tmp; +- struct sockaddr *sa; ++ struct sockaddr *sa = NULL; ++ struct sockaddr_ll *sll = NULL; + + if (strlen(name) >= sizeof(tmp.ifr_name)) { + log_fatal("Device name too long: \"%s\"", name); +@@ -480,16 +632,62 @@ get_hw_addr(const char *name, struct har + memset(&tmp, 0, sizeof(tmp)); + strcpy(tmp.ifr_name, name); + if (ioctl(sock, SIOCGIFHWADDR, &tmp) < 0) { +- log_fatal("Error getting hardware address for \"%s\": %m", ++ log_fatal("Error getting hardware address for \"%s\": %m", + name); + } ++ close(sock); + + sa = &tmp.ifr_hwaddr; +- switch (sa->sa_family) { ++ // needs to be freed outside this function ++ sll = dmalloc (sizeof (struct sockaddr_ll), MDL); ++ if (!sll) ++ log_fatal("Unable to allocate memory for link layer address"); ++ memcpy(&sll->sll_hatype, &sa->sa_family, sizeof (sll->sll_hatype)); ++ memcpy(sll->sll_addr, sa->sa_data, sizeof (sll->sll_addr)); ++ switch (sll->sll_hatype) { ++ case ARPHRD_INFINIBAND: ++ /* ioctl limits hardware addresses to 8 bytes */ ++ sll->sll_halen = 8; ++ break; ++ default: ++ break; ++ } ++ return sll; ++} ++ ++void ++get_hw_addr(struct interface_info *info) ++{ ++ struct hardware *hw = &info->hw_address; ++ char *name = info->name; ++ struct ifaddrs *ifaddrs = NULL; ++ struct ifaddrs *ifa = NULL; ++ struct sockaddr_ll *sll = NULL; ++ int sll_allocated = 0; ++ char *dup = NULL; ++ char *colon = NULL; ++ ++ if (getifaddrs(&ifaddrs) == -1) ++ log_fatal("Failed to get interfaces"); ++ ++ if ((sll = get_ll(ifaddrs, &ifa, name)) == NULL) { ++ /* ++ * We were unable to get link-layer address for name. ++ * Fall back to ioctl(SIOCGIFHWADDR). ++ */ ++ sll = ioctl_get_ll(name); ++ if (sll != NULL) ++ sll_allocated = 1; ++ else ++ // shouldn't happen ++ log_fatal("Unexpected internal error"); ++ } ++ ++ switch (sll->sll_hatype) { + case ARPHRD_ETHER: + hw->hlen = 7; + hw->hbuf[0] = HTYPE_ETHER; +- memcpy(&hw->hbuf[1], sa->sa_data, 6); ++ memcpy(&hw->hbuf[1], sll->sll_addr, 6); + break; + case ARPHRD_IEEE802: + #ifdef ARPHRD_IEEE802_TR +@@ -497,18 +695,48 @@ get_hw_addr(const char *name, struct har + #endif /* ARPHRD_IEEE802_TR */ + hw->hlen = 7; + hw->hbuf[0] = HTYPE_IEEE802; +- memcpy(&hw->hbuf[1], sa->sa_data, 6); ++ memcpy(&hw->hbuf[1], sll->sll_addr, 6); + break; + case ARPHRD_FDDI: + hw->hlen = 7; + hw->hbuf[0] = HTYPE_FDDI; +- memcpy(&hw->hbuf[1], sa->sa_data, 6); ++ memcpy(&hw->hbuf[1], sll->sll_addr, 6); ++ break; ++ case ARPHRD_INFINIBAND: ++ dup = strdup(name); ++ /* Aliased infiniband interface is special case where ++ * neither get_ll() nor ioctl_get_ll() get's correct hw ++ * address, so we have to truncate the :0 and run ++ * get_ll() again for the rest. ++ */ ++ if ((colon = strchr(dup, ':')) != NULL) { ++ *colon = '\0'; ++ if ((sll = get_ll(ifaddrs, &ifa, dup)) == NULL) ++ log_fatal("Error getting hardware address for \"%s\": %m", name); ++ } ++ free (dup); ++ /* For Infiniband, save the broadcast address and store ++ * the port GUID into the hardware address. ++ */ ++ if (ifa && (ifa->ifa_flags & IFF_BROADCAST)) { ++ struct sockaddr_ll *bll; ++ ++ bll = (struct sockaddr_ll *)ifa->ifa_broadaddr; ++ memcpy(&info->bcast_addr, bll->sll_addr, 20); ++ } else { ++ memcpy(&info->bcast_addr, default_ib_bcast_addr, ++ 20); ++ } ++ ++ hw->hlen = 1; ++ hw->hbuf[0] = HTYPE_INFINIBAND; ++ memcpy(&hw->hbuf[1], &sll->sll_addr[sll->sll_halen - 8], 8); + break; + #if defined(ARPHRD_PPP) + case ARPHRD_PPP: + if (local_family != AF_INET6) +- log_fatal("Unsupported device type %d for \"%s\"", +- sa->sa_family, name); ++ log_fatal("local_family != AF_INET6 for \"%s\"", ++ name); + hw->hlen = 0; + hw->hbuf[0] = HTYPE_RESERVED; + /* 0xdeadbeef should never occur on the wire, +@@ -521,10 +749,13 @@ get_hw_addr(const char *name, struct har + break; + #endif + default: +- log_fatal("Unsupported device type %ld for \"%s\"", +- (long int)sa->sa_family, name); ++ freeifaddrs(ifaddrs); ++ log_fatal("Unsupported device type %hu for \"%s\"", ++ sll->sll_hatype, name); + } + +- close(sock); ++ if (sll_allocated) ++ dfree(sll, MDL); ++ freeifaddrs(ifaddrs); + } + #endif +diff -up dhcp-4.2.6b1/common/socket.c.lpf-ib dhcp-4.2.6b1/common/socket.c +--- dhcp-4.2.6b1/common/socket.c.lpf-ib 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/common/socket.c 2014-01-23 14:49:36.377537914 +0100 +@@ -328,7 +328,7 @@ void if_register_send (info) + info->wfdesc = if_register_socket(info, AF_INET, 0, NULL); + /* If this is a normal IPv4 address, get the hardware address. */ + if (strcmp(info->name, "fallback") != 0) +- get_hw_addr(info->name, &info->hw_address); ++ get_hw_addr(info); + #if defined (USE_SOCKET_FALLBACK) + /* Fallback only registers for send, but may need to receive as + well. */ +@@ -391,7 +391,7 @@ void if_register_receive (info) + #endif /* IP_PKTINFO... */ + /* If this is a normal IPv4 address, get the hardware address. */ + if (strcmp(info->name, "fallback") != 0) +- get_hw_addr(info->name, &info->hw_address); ++ get_hw_addr(info); + + if (!quiet_interface_discovery) + log_info ("Listening on Socket/%s%s%s", +@@ -505,7 +505,7 @@ if_register6(struct interface_info *info + if (req_multi) + if_register_multicast(info); + +- get_hw_addr(info->name, &info->hw_address); ++ get_hw_addr(info); + + if (!quiet_interface_discovery) { + if (info->shared_network != NULL) { +@@ -561,7 +561,7 @@ if_register_linklocal6(struct interface_ + info->rfdesc = sock; + info->wfdesc = sock; + +- get_hw_addr(info->name, &info->hw_address); ++ get_hw_addr(info); + + if (!quiet_interface_discovery) { + if (info->shared_network != NULL) { +diff -up dhcp-4.2.6b1/includes/dhcpd.h.lpf-ib dhcp-4.2.6b1/includes/dhcpd.h +--- dhcp-4.2.6b1/includes/dhcpd.h.lpf-ib 2014-01-23 14:49:08.089935763 +0100 ++++ dhcp-4.2.6b1/includes/dhcpd.h 2014-01-23 14:49:08.097935651 +0100 +@@ -1249,6 +1249,7 @@ struct interface_info { + struct shared_network *shared_network; + /* Networks connected to this interface. */ + struct hardware hw_address; /* Its physical address. */ ++ u_int8_t bcast_addr[20]; /* Infiniband broadcast address */ + struct in_addr *addresses; /* Addresses associated with this + * interface. + */ +@@ -2378,7 +2379,7 @@ void print_dns_status (int, struct dhcp_ + #endif + const char *print_time(TIME); + +-void get_hw_addr(const char *name, struct hardware *hw); ++void get_hw_addr(struct interface_info *info); + + /* socket.c */ + #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \ diff --git a/dhcp-4.2.6-release-by-ifup.patch b/dhcp-4.2.6-release-by-ifup.patch new file mode 100644 index 0000000..5529ef4 --- /dev/null +++ b/dhcp-4.2.6-release-by-ifup.patch @@ -0,0 +1,85 @@ +diff -up dhcp-4.2.6b1/client/dhclient.c.ifup dhcp-4.2.6b1/client/dhclient.c +--- dhcp-4.2.6b1/client/dhclient.c.ifup 2014-01-23 14:28:46.067107465 +0100 ++++ dhcp-4.2.6b1/client/dhclient.c 2014-01-23 14:29:04.558847949 +0100 +@@ -522,9 +522,81 @@ main(int argc, char **argv) { + } + } + fclose(pidfd); ++ } else { ++ /* handle release for interfaces requested with Red Hat ++ * /sbin/ifup - pidfile will be /var/run/dhclient-$interface.pid ++ */ ++ ++ if ((path_dhclient_pid == NULL) || (*path_dhclient_pid == '\0')) ++ path_dhclient_pid = "/var/run/dhclient.pid"; ++ ++ char *new_path_dhclient_pid; ++ struct interface_info *ip; ++ int pdp_len = strlen(path_dhclient_pid), pfx, dpfx; ++ ++ /* find append point: beginning of any trailing '.pid' ++ * or '-$IF.pid' */ ++ for (pfx=pdp_len; (pfx >= 0) && (path_dhclient_pid[pfx] != '.') && (path_dhclient_pid[pfx] != '/'); pfx--); ++ if (pfx == -1) ++ pfx = pdp_len; ++ ++ if (path_dhclient_pid[pfx] == '/') ++ pfx += 1; ++ ++ for (dpfx=pfx; (dpfx >= 0) && (path_dhclient_pid[dpfx] != '-') && (path_dhclient_pid[dpfx] != '/'); dpfx--); ++ if ((dpfx > -1) && (path_dhclient_pid[dpfx] != '/')) ++ pfx = dpfx; ++ ++ for (ip = interfaces; ip; ip = ip->next) { ++ if (interfaces_requested && (ip->flags & (INTERFACE_REQUESTED))) { ++ int n_len = strlen(ip->name); ++ ++ new_path_dhclient_pid = (char*) malloc(pfx + n_len + 6); ++ strncpy(new_path_dhclient_pid, path_dhclient_pid, pfx); ++ sprintf(new_path_dhclient_pid + pfx, "-%s.pid", ip->name); ++ ++ if ((pidfd = fopen(new_path_dhclient_pid, "r")) != NULL) { ++ e = fscanf(pidfd, "%ld\n", &temp); ++ oldpid = (pid_t)temp; ++ ++ if (e != 0 && e != EOF) { ++ if (oldpid) { ++ if (kill(oldpid, SIGTERM) == 0) ++ unlink(path_dhclient_pid); ++ } ++ } ++ ++ fclose(pidfd); ++ } ++ ++ free(new_path_dhclient_pid); ++ } ++ } ++ } ++ } else { ++ FILE *pidfp = NULL; ++ long temp = 0; ++ pid_t dhcpid = 0; ++ int dhc_running = 0; ++ char procfn[256] = ""; ++ ++ if ((pidfp = fopen(path_dhclient_pid, "r")) != NULL) { ++ if ((fscanf(pidfp, "%ld", &temp)==1) && ((dhcpid=(pid_t)temp) > 0)) { ++ snprintf(procfn,256,"/proc/%u",dhcpid); ++ dhc_running = (access(procfn, F_OK) == 0); ++ } ++ ++ fclose(pidfp); ++ } ++ ++ if (dhc_running) { ++ log_fatal("dhclient(%u) is already running - exiting. ", dhcpid); ++ return(1); + } + } + ++ write_client_pid_file(); ++ + if (!quiet) { + log_info("%s %s", message, PACKAGE_VERSION); + log_info(copyright); diff --git a/dhcp-4.2.6-remove-bind.patch b/dhcp-4.2.6-remove-bind.patch new file mode 100644 index 0000000..96bb270 --- /dev/null +++ b/dhcp-4.2.6-remove-bind.patch @@ -0,0 +1,165 @@ +diff -up dhcp-4.2.6b1/client/Makefile.am.remove-bind dhcp-4.2.6b1/client/Makefile.am +--- dhcp-4.2.6b1/client/Makefile.am.remove-bind 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/client/Makefile.am 2014-01-23 13:58:48.125259702 +0100 +@@ -5,7 +5,7 @@ dhclient_SOURCES = clparse.c dhclient.c + scripts/netbsd scripts/nextstep scripts/openbsd \ + scripts/solaris scripts/openwrt + dhclient_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ +- ../bind/lib/libdns.a ../bind/lib/libisc.a ++ $(BIND9_LIBDIR) -ldns-export -lisc-export + man_MANS = dhclient.8 dhclient-script.8 dhclient.conf.5 dhclient.leases.5 + EXTRA_DIST = $(man_MANS) + +diff -up dhcp-4.2.6b1/common/tests/Makefile.am.remove-bind dhcp-4.2.6b1/common/tests/Makefile.am +--- dhcp-4.2.6b1/common/tests/Makefile.am.remove-bind 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/common/tests/Makefile.am 2014-01-23 13:58:48.125259702 +0100 +@@ -13,8 +13,8 @@ ATF_TESTS += alloc_unittest + alloc_unittest_SOURCES = test_alloc.c $(top_srcdir)/tests/t_api_dhcp.c + alloc_unittest_LDADD = $(ATF_LDFLAGS) + alloc_unittest_LDADD += ../libdhcp.a \ +- ../../omapip/libomapi.a ../../bind/lib/libdns.a \ +- ../../bind/lib/libisc.a ++ ../../omapip/libomapi.a \ ++ $(BIND9_LIBDIR) -ldns-export -lisc-export + + check: $(ATF_TESTS) + atf-run | atf-report +diff -up dhcp-4.2.6b1/configure.ac.remove-bind dhcp-4.2.6b1/configure.ac +--- dhcp-4.2.6b1/configure.ac.remove-bind 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/configure.ac 2014-01-23 14:10:57.020069338 +0100 +@@ -589,20 +589,37 @@ AC_CHECK_MEMBER(struct msghdr.msg_contro + libbind= + AC_ARG_WITH(libbind, + AC_HELP_STRING([--with-libbind=PATH], +- [bind includes and libraries are in PATH +- (default is ./bind)]), ++ [bind includes are in PATH ++ (default is ./bind/includes)]), + use_libbind="$withval", use_libbind="no") + case "$use_libbind" in ++yes|no) ++ libbind="\${top_srcdir}/bind/include" ++ ;; ++*) ++ libbind="$use_libbind" ++ ;; ++esac ++ ++BIND9_LIBDIR='-L$(top_builddir)/bind/lib' ++AC_ARG_WITH(libbind-libs, ++ AC_HELP_STRING([--with-libbind-libs=PATH], ++ [bind9 export libraries are in PATH]), ++ [libbind_libs="$withval"], [libbind_libs='no']) ++case "$libbind_libs" in + yes) +- libbind="\${top_srcdir}/bind" ++ AC_MSG_ERROR([Specify path to bind9 libraries]) + ;; + no) +- libbind="\${top_srcdir}/bind" ++ BUNDLED_BIND=yes + ;; + *) +- libbind="$use_libbind" ++ BIND9_LIBDIR="-L$libbind_libs" ++ BUNDLED_BIND=no + ;; + esac ++AM_CONDITIONAL([BUNDLED_BIND], [test "$BUNDLED_BIND" = yes]) ++AC_SUBST([BIND9_LIBDIR]) + + # OpenLDAP support. + AC_ARG_WITH(ldap, +@@ -639,7 +656,8 @@ fi + CFLAGS="$CFLAGS $STD_CWARNINGS" + + # Try to add the bind include directory +-CFLAGS="$CFLAGS -I$libbind/include" ++CFLAGS="$CFLAGS -I$libbind" ++ + + case "$host" in + *-darwin*) +diff -up dhcp-4.2.6b1/dhcpctl/Makefile.am.remove-bind dhcp-4.2.6b1/dhcpctl/Makefile.am +--- dhcp-4.2.6b1/dhcpctl/Makefile.am.remove-bind 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/dhcpctl/Makefile.am 2014-01-23 13:58:48.126259688 +0100 +@@ -6,10 +6,10 @@ EXTRA_DIST = $(man_MANS) + + omshell_SOURCES = omshell.c + omshell_LDADD = libdhcpctl.a ../common/libdhcp.a ../omapip/libomapi.a \ +- ../bind/lib/libdns.a ../bind/lib/libisc.a ++ $(BIND9_LIBDIR) -ldns-export -lisc-export + + libdhcpctl_a_SOURCES = dhcpctl.c callback.c remote.c + + cltest_SOURCES = cltest.c + cltest_LDADD = libdhcpctl.a ../common/libdhcp.a ../omapip/libomapi.a \ +- ../bind/lib/libdns.a ../bind/lib/libisc.a +\ No newline at end of file ++ $(BIND9_LIBDIR) -ldns-export -lisc-export +diff -up dhcp-4.2.6b1/Makefile.am.remove-bind dhcp-4.2.6b1/Makefile.am +--- dhcp-4.2.6b1/Makefile.am.remove-bind 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/Makefile.am 2014-01-23 13:58:48.126259688 +0100 +@@ -24,7 +24,13 @@ EXTRA_DIST = RELNOTES LICENSE \ + bind/Makefile bind/bind.tar.gz bind/version.tmp \ + common/tests/Atffile server/tests/Atffile + +-SUBDIRS = bind includes tests common dst omapip client dhcpctl relay server ++if BUNDLED_BIND ++SUBDIRS = bind ++else ++SUBDIRS = ++endif ++ ++SUBDIRS += includes tests common dst omapip client dhcpctl relay server + + nobase_include_HEADERS = dhcpctl/dhcpctl.h + +diff -up dhcp-4.2.6b1/omapip/Makefile.am.remove-bind dhcp-4.2.6b1/omapip/Makefile.am +--- dhcp-4.2.6b1/omapip/Makefile.am.remove-bind 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/omapip/Makefile.am 2014-01-23 13:58:48.126259688 +0100 +@@ -10,5 +10,5 @@ man_MANS = omapi.3 + EXTRA_DIST = $(man_MANS) + + svtest_SOURCES = test.c +-svtest_LDADD = libomapi.a ../bind/lib/libdns.a ../bind/lib/libisc.a ++svtest_LDADD = libomapi.a $(BIND9_LIBDIR) -ldns-export -lisc-export + +diff -up dhcp-4.2.6b1/relay/Makefile.am.remove-bind dhcp-4.2.6b1/relay/Makefile.am +--- dhcp-4.2.6b1/relay/Makefile.am.remove-bind 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/relay/Makefile.am 2014-01-23 13:58:48.127259674 +0100 +@@ -3,7 +3,7 @@ AM_CPPFLAGS = -DLOCALSTATEDIR='"@localst + sbin_PROGRAMS = dhcrelay + dhcrelay_SOURCES = dhcrelay.c + dhcrelay_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ +- ../bind/lib/libdns.a ../bind/lib/libisc.a ++ $(BIND9_LIBDIR) -ldns-export -lisc-export + man_MANS = dhcrelay.8 + EXTRA_DIST = $(man_MANS) + +diff -up dhcp-4.2.6b1/server/Makefile.am.remove-bind dhcp-4.2.6b1/server/Makefile.am +--- dhcp-4.2.6b1/server/Makefile.am.remove-bind 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/server/Makefile.am 2014-01-23 13:58:48.127259674 +0100 +@@ -14,8 +14,7 @@ dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c c + + dhcpd_CFLAGS = $(LDAP_CFLAGS) + dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ +- ../dhcpctl/libdhcpctl.a ../bind/lib/libdns.a \ +- ../bind/lib/libisc.a ++ ../dhcpctl/libdhcpctl.a $(BIND9_LIBDIR) -ldns-export -lisc-export + + man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5 + EXTRA_DIST = $(man_MANS) +diff -up dhcp-4.2.6b1/server/tests/Makefile.am.remove-bind dhcp-4.2.6b1/server/tests/Makefile.am +--- dhcp-4.2.6b1/server/tests/Makefile.am.remove-bind 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/server/tests/Makefile.am 2014-01-23 13:58:48.127259674 +0100 +@@ -18,8 +18,7 @@ DHCPSRC = ../dhcp.c ../bootp.c ../confpa + ../ldap.c ../ldap_casa.c ../dhcpd.c + + DHCPLIBS = $(top_builddir)/common/libdhcp.a $(top_builddir)/omapip/libomapi.a \ +- $(top_builddir)/dhcpctl/libdhcpctl.a $(top_builddir)/bind/lib/libdns.a \ +- $(top_builddir)/bind/lib/libisc.a ++ $(top_builddir)/dhcpctl/libdhcpctl.a $(BIND9_LIBDIR) -ldns-export -lisc-export + + ATF_TESTS = + TESTS = diff --git a/dhcp-4.2.6-systemtap.patch b/dhcp-4.2.6-systemtap.patch new file mode 100644 index 0000000..1fd4752 --- /dev/null +++ b/dhcp-4.2.6-systemtap.patch @@ -0,0 +1,823 @@ +diff -up dhcp-4.2.6b1/configure.ac.systemtap dhcp-4.2.6b1/configure.ac +--- dhcp-4.2.6b1/configure.ac.systemtap 2014-01-23 14:45:04.801357825 +0100 ++++ dhcp-4.2.6b1/configure.ac 2014-01-23 14:45:04.844357220 +0100 +@@ -560,6 +560,35 @@ else + AC_MSG_RESULT(no) + fi + ++AC_MSG_CHECKING([whether to include systemtap tracing support]) ++AC_ARG_ENABLE([systemtap], ++ [AS_HELP_STRING([--enable-systemtap], ++ [Enable inclusion of systemtap trace support])], ++ [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP='no']) ++AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test x$ENABLE_SYSTEMTAP = xyes]) ++AC_MSG_RESULT(${ENABLE_SYSTEMTAP}) ++ ++if test "x${ENABLE_SYSTEMTAP}" = xyes; then ++ # Additional configuration for --enable-systemtap is HERE ++ AC_CHECK_PROGS(DTRACE, dtrace) ++ if test -z "$DTRACE"; then ++ AC_MSG_ERROR([dtrace not found]) ++ fi ++ AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='yes'], ++ [SDT_H_FOUND='no'; ++ AC_MSG_ERROR([systemtap support needs sys/sdt.h header])]) ++ AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if using SystemTap probes.]) ++ AC_ARG_WITH([tapset-install-dir], ++ [AS_HELP_STRING([--with-tapset-install-dir], ++ [The absolute path where the tapset dir will be installed])], ++ [if test "x${withval}" = x; then ++ ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset" ++ else ++ ABS_TAPSET_DIR="${withval}" ++ fi], [ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset"]) ++ AC_SUBST(ABS_TAPSET_DIR) ++fi ++ + # Solaris needs some libraries for functions + AC_SEARCH_LIBS(socket, [socket]) + AC_SEARCH_LIBS(inet_ntoa, [nsl]) +@@ -715,6 +744,7 @@ AC_OUTPUT([ + tests/Makefile + server/tests/Makefile + doc/devel/doxyfile ++ tapset/Makefile + ]) + + sh util/bindvar.sh +diff -up dhcp-4.2.6b1/Makefile.am.systemtap dhcp-4.2.6b1/Makefile.am +--- dhcp-4.2.6b1/Makefile.am.systemtap 2014-01-23 14:45:04.678359555 +0100 ++++ dhcp-4.2.6b1/Makefile.am 2014-01-23 14:45:04.844357220 +0100 +@@ -32,5 +32,8 @@ endif + + SUBDIRS += includes tests common omapip client dhcpctl relay server + ++SUBDIRS += tapset ++#DIST_SUBDIRS = $(SUBDIRS) ++ + nobase_include_HEADERS = dhcpctl/dhcpctl.h + +diff -up dhcp-4.2.6b1/server/dhcp.c.systemtap dhcp-4.2.6b1/server/dhcp.c +--- dhcp-4.2.6b1/server/dhcp.c.systemtap 2014-01-23 14:45:04.708359133 +0100 ++++ dhcp-4.2.6b1/server/dhcp.c 2014-01-23 14:45:04.846357192 +0100 +@@ -36,7 +36,7 @@ + #include + #include + #include +- ++#include "trace.h" + static void commit_leases_ackout(void *foo); + static void maybe_return_agent_options(struct packet *packet, + struct option_state *options); +@@ -275,6 +275,8 @@ void dhcpdiscover (packet, ms_nulltp) + dhcp_failover_state_t *peer; + #endif + ++ TRACE(DHCPD_DISCOVER_START()); ++ + find_lease (&lease, packet, packet -> shared_network, + 0, &peer_has_leases, (struct lease *)0, MDL); + +@@ -399,6 +401,8 @@ void dhcpdiscover (packet, ms_nulltp) + out: + if (lease) + lease_dereference (&lease, MDL); ++ ++ TRACE(DHCPD_DISCOVER_DONE()); + } + + void dhcprequest (packet, ms_nulltp, ip_lease) +@@ -421,6 +425,8 @@ void dhcprequest (packet, ms_nulltp, ip_ + #endif + int have_requested_addr = 0; + ++ TRACE(DHCPD_REQUEST_START()); ++ + oc = lookup_option (&dhcp_universe, packet -> options, + DHO_DHCP_REQUESTED_ADDRESS); + memset (&data, 0, sizeof data); +@@ -700,6 +706,9 @@ void dhcprequest (packet, ms_nulltp, ip_ + log_info ("%s: unknown lease %s.", msgbuf, piaddr (cip)); + + out: ++ ++ TRACE(DHCPD_REQUEST_DONE()); ++ + if (subnet) + subnet_dereference (&subnet, MDL); + if (lease) +@@ -718,6 +727,7 @@ void dhcprelease (packet, ms_nulltp) + const char *s; + char msgbuf [1024], cstr[16]; /* XXX */ + ++ TRACE(DHCPD_RELEASE_START()); + + /* DHCPRELEASE must not specify address in requested-address + option, but old protocol specs weren't explicit about this, +@@ -842,6 +852,8 @@ void dhcprelease (packet, ms_nulltp) + #endif + if (lease) + lease_dereference (&lease, MDL); ++ ++ TRACE(DHCPD_RELEASE_DONE()); + } + + void dhcpdecline (packet, ms_nulltp) +@@ -859,6 +871,8 @@ void dhcpdecline (packet, ms_nulltp) + struct option_cache *oc; + struct data_string data; + ++ TRACE(DHCPD_DECLINE_START()); ++ + /* DHCPDECLINE must specify address. */ + if (!(oc = lookup_option (&dhcp_universe, packet -> options, + DHO_DHCP_REQUESTED_ADDRESS))) +@@ -970,6 +984,8 @@ void dhcpdecline (packet, ms_nulltp) + option_state_dereference (&options, MDL); + if (lease) + lease_dereference (&lease, MDL); ++ ++ TRACE(DHCPD_DECLINE_DONE()); + } + + void dhcpinform (packet, ms_nulltp) +@@ -993,6 +1009,8 @@ void dhcpinform (packet, ms_nulltp) + struct interface_info *interface; + int result; + ++ TRACE(DHCPD_INFORM_START()); ++ + /* The client should set ciaddr to its IP address, but apparently + it's common for clients not to do this, so we'll use their IP + source address if they didn't set ciaddr. */ +@@ -1350,6 +1368,8 @@ void dhcpinform (packet, ms_nulltp) + + if (subnet) + subnet_dereference (&subnet, MDL); ++ ++ TRACE(DHCPD_INFORM_DONE()); + } + + void nak_lease (packet, cip) +@@ -1366,6 +1386,8 @@ void nak_lease (packet, cip) + struct option_state *options = (struct option_state *)0; + struct option_cache *oc = (struct option_cache *)0; + ++ TRACE(DHCPD_NAK_LEASE_START()); ++ + option_state_allocate (&options, MDL); + memset (&outgoing, 0, sizeof outgoing); + memset (&raw, 0, sizeof raw); +@@ -1532,6 +1554,7 @@ void nak_lease (packet, cip) + packet->interface->name); + } + ++ TRACE(DHCPD_NAK_LEASE_DONE()); + } + + void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) +@@ -1570,6 +1593,8 @@ void ack_lease (packet, lease, offer, wh + if (lease -> state) + return; + ++ TRACE(DHCPD_ACK_LEASE_START()); ++ + /* Save original cltt for comparison later. */ + lease_cltt = lease->cltt; + +@@ -2933,6 +2958,8 @@ void ack_lease (packet, lease, offer, wh + #endif + dhcp_reply(lease); + } ++ ++ TRACE(DHCPD_ACK_LEASE_DONE()); + } + + /* +@@ -3085,6 +3112,8 @@ void dhcp_reply (lease) + if (!state) + log_fatal ("dhcp_reply was supplied lease with no state!"); + ++ TRACE(DHCPD_REPLY_START()); ++ + /* Compose a response for the client... */ + memset (&raw, 0, sizeof raw); + memset (&d1, 0, sizeof d1); +@@ -3306,6 +3335,8 @@ void dhcp_reply (lease) + + free_lease_state (state, MDL); + lease -> state = (struct lease_state *)0; ++ ++ TRACE(DHCPD_REPLY_DONE()); + } + + int find_lease (struct lease **lp, +@@ -3328,6 +3359,8 @@ int find_lease (struct lease **lp, + struct data_string client_identifier; + struct hardware h; + ++ TRACE(DHCPD_FIND_LEASE_START()); ++ + #if defined(FAILOVER_PROTOCOL) + /* Quick check to see if the peer has leases. */ + if (peer_has_leases) { +@@ -4055,6 +4088,9 @@ int find_lease (struct lease **lp, + #if defined (DEBUG_FIND_LEASE) + log_info ("Not returning a lease."); + #endif ++ ++ TRACE(DHCPD_FIND_LEASE_DONE()); ++ + return 0; + } + +diff -up dhcp-4.2.6b1/server/dhcpd.c.systemtap dhcp-4.2.6b1/server/dhcpd.c +--- dhcp-4.2.6b1/server/dhcpd.c.systemtap 2014-01-23 14:45:04.820357557 +0100 ++++ dhcp-4.2.6b1/server/dhcpd.c 2014-01-23 14:45:49.348731180 +0100 +@@ -58,6 +58,8 @@ static const char url [] = + # undef group + #endif /* PARANOIA */ + ++#include "trace.h" ++ + #ifndef UNIT_TEST + static void usage(void); + #endif +@@ -869,6 +871,8 @@ main(int argc, char **argv) { + signal(SIGINT, dhcp_signal_handler); /* control-c */ + signal(SIGTERM, dhcp_signal_handler); /* kill */ + ++ TRACE(DHCPD_MAIN()); ++ + /* + * Receive packets and dispatch them... + * dispatch() will never return. +diff -up dhcp-4.2.6b1/server/dhcpv6.c.systemtap dhcp-4.2.6b1/server/dhcpv6.c +--- dhcp-4.2.6b1/server/dhcpv6.c.systemtap 2014-01-23 14:45:04.812357670 +0100 ++++ dhcp-4.2.6b1/server/dhcpv6.c 2014-01-23 14:45:04.850357135 +0100 +@@ -15,6 +15,7 @@ + */ + + #include "dhcpd.h" ++#include "trace.h" + + #ifdef DHCPv6 + +@@ -4351,6 +4352,8 @@ static void + dhcpv6_solicit(struct data_string *reply_ret, struct packet *packet) { + struct data_string client_id; + ++ TRACE(DHCPD_6_SOLICIT_START()); ++ + /* + * Validate our input. + */ +@@ -4364,6 +4367,8 @@ dhcpv6_solicit(struct data_string *reply + * Clean up. + */ + data_string_forget(&client_id, MDL); ++ ++ TRACE(DHCPD_6_SOLICIT_DONE()); + } + + /* +@@ -4377,6 +4382,8 @@ dhcpv6_request(struct data_string *reply + struct data_string client_id; + struct data_string server_id; + ++ TRACE(DHCPD_6_REQUEST_START()); ++ + /* + * Validate our input. + */ +@@ -4394,6 +4401,8 @@ dhcpv6_request(struct data_string *reply + */ + data_string_forget(&client_id, MDL); + data_string_forget(&server_id, MDL); ++ ++ TRACE(DHCPD_6_REQUEST_DONE()); + } + + /* Find a DHCPv6 packet's shared network from hints in the packet. +@@ -4506,6 +4515,8 @@ dhcpv6_confirm(struct data_string *reply + struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data; + int reply_ofs = (int)(offsetof(struct dhcpv6_packet, options)); + ++ TRACE(DHCPD_6_CONFIRM_START()); ++ + /* + * Basic client message validation. + */ +@@ -4692,6 +4703,8 @@ exit: + option_state_dereference(&cli_enc_opt_state, MDL); + if (opt_state != NULL) + option_state_dereference(&opt_state, MDL); ++ ++ TRACE(DHCPD_6_CONFIRM_DONE()); + } + + /* +@@ -4706,6 +4719,8 @@ dhcpv6_renew(struct data_string *reply, + struct data_string client_id; + struct data_string server_id; + ++ TRACE(DHCPD_6_RENEW_START()); ++ + /* + * Validate the request. + */ +@@ -4723,6 +4738,8 @@ dhcpv6_renew(struct data_string *reply, + */ + data_string_forget(&server_id, MDL); + data_string_forget(&client_id, MDL); ++ ++ TRACE(DHCPD_6_RENEW_DONE()); + } + + /* +@@ -4736,6 +4753,8 @@ static void + dhcpv6_rebind(struct data_string *reply, struct packet *packet) { + struct data_string client_id; + ++ TRACE(DHCPD_6_REBIND_START()); ++ + if (!valid_client_msg(packet, &client_id)) { + return; + } +@@ -4743,6 +4762,8 @@ dhcpv6_rebind(struct data_string *reply, + lease_to_client(reply, packet, &client_id, NULL); + + data_string_forget(&client_id, MDL); ++ ++ TRACE(DHCPD_6_REBIND_DONE()); + } + + static void +@@ -5187,6 +5208,8 @@ dhcpv6_decline(struct data_string *reply + struct data_string client_id; + struct data_string server_id; + ++ TRACE(DHCPD_6_DECLINE_START()); ++ + /* + * Validate our input. + */ +@@ -5207,6 +5230,8 @@ dhcpv6_decline(struct data_string *reply + + data_string_forget(&server_id, MDL); + data_string_forget(&client_id, MDL); ++ ++ TRACE(DHCPD_6_DECLINE_DONE()); + } + + static void +@@ -5655,6 +5680,8 @@ dhcpv6_release(struct data_string *reply + struct data_string client_id; + struct data_string server_id; + ++ TRACE(DHCPD_6_RELEASE_START()); ++ + /* + * Validate our input. + */ +@@ -5676,6 +5703,8 @@ dhcpv6_release(struct data_string *reply + + data_string_forget(&server_id, MDL); + data_string_forget(&client_id, MDL); ++ ++ TRACE(DHCPD_6_RELEASE_DONE()); + } + + /* +@@ -5688,6 +5717,8 @@ dhcpv6_information_request(struct data_s + struct data_string client_id; + struct data_string server_id; + ++ TRACE(DHCPD_6_INFORMATION_REQUEST_START()); ++ + /* + * Validate our input. + */ +@@ -5719,6 +5750,8 @@ dhcpv6_information_request(struct data_s + data_string_forget(&client_id, MDL); + } + data_string_forget(&server_id, MDL); ++ ++ TRACE(DHCPD_6_INFORMATION_REQUEST_DONE()); + } + + /* +@@ -5747,6 +5780,8 @@ dhcpv6_relay_forw(struct data_string *re + struct dhcpv6_relay_packet *reply; + int reply_ofs; + ++ TRACE(DHCPD_6_RELAY_FORW_START()); ++ + /* + * Initialize variables for early exit. + */ +@@ -6006,6 +6041,8 @@ exit: + if (enc_packet != NULL) { + packet_dereference(&enc_packet, MDL); + } ++ ++ TRACE(DHCPD_6_RELAY_FORW_DONE()); + } + + static void +diff -up dhcp-4.2.6b1/server/failover.c.systemtap dhcp-4.2.6b1/server/failover.c +--- dhcp-4.2.6b1/server/failover.c.systemtap 2014-01-21 20:29:10.000000000 +0100 ++++ dhcp-4.2.6b1/server/failover.c 2014-01-23 14:45:04.852357107 +0100 +@@ -36,6 +36,8 @@ + #include "dhcpd.h" + #include + ++#include "trace.h" ++ + #if defined (FAILOVER_PROTOCOL) + dhcp_failover_state_t *failover_states; + static isc_result_t do_a_failover_option (omapi_object_t *, +@@ -1710,6 +1712,8 @@ isc_result_t dhcp_failover_set_state (dh + struct lease *l; + struct timeval tv; + ++ TRACE(DHCPD_FAILOVER_SET_STATE_START(state->me.state, new_state)); ++ + /* If we're in certain states where we're sending updates, and the peer + * state changes, we need to re-schedule any pending updates just to + * be on the safe side. This results in retransmission. +@@ -1937,6 +1941,8 @@ isc_result_t dhcp_failover_set_state (dh + break; + } + ++ TRACE(DHCPD_FAILOVER_SET_STATE_DONE()); ++ + return ISC_R_SUCCESS; + } + +@@ -2420,6 +2426,8 @@ dhcp_failover_pool_dobalance(dhcp_failov + if (state -> me.state != normal) + return 0; + ++ TRACE(DHCPD_FAILOVER_POOL_DOBALANCE_START()); ++ + state->last_balance = cur_time; + + for (s = shared_networks ; s ; s = s->next) { +@@ -2580,6 +2588,8 @@ dhcp_failover_pool_dobalance(dhcp_failov + if (leases_queued) + commit_leases(); + ++ TRACE(DHCPD_FAILOVER_POOL_DOBALANCE_DONE()); ++ + return leases_queued; + } + +diff -up dhcp-4.2.6b1/server/Makefile.am.systemtap dhcp-4.2.6b1/server/Makefile.am +--- dhcp-4.2.6b1/server/Makefile.am.systemtap 2014-01-23 14:45:04.802357811 +0100 ++++ dhcp-4.2.6b1/server/Makefile.am 2014-01-23 14:45:04.852357107 +0100 +@@ -10,7 +10,7 @@ dist_sysconf_DATA = dhcpd.conf.example + 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 ldap.c ldap_casa.c ++ dhcpv6.c mdb6.c ldap.c ldap_casa.c probes.d trace.h + + dhcpd_CFLAGS = $(LDAP_CFLAGS) + dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.la \ +@@ -19,3 +19,13 @@ dhcpd_LDADD = ../common/libdhcp.a ../oma + man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5 + EXTRA_DIST = $(man_MANS) + ++if ENABLE_SYSTEMTAP ++BUILT_SOURCES = probes.h ++probes.h: probes.d ++ $(DTRACE) -C -h -s $< -o $@ ++ ++probes.o: probes.d ++ $(DTRACE) -C -G -s $< -o $@ ++ ++dhcpd_LDADD += probes.o ++endif +diff -up dhcp-4.2.6b1/server/probes.d.systemtap dhcp-4.2.6b1/server/probes.d +--- dhcp-4.2.6b1/server/probes.d.systemtap 2014-01-23 14:45:04.852357107 +0100 ++++ dhcp-4.2.6b1/server/probes.d 2014-01-23 14:45:04.852357107 +0100 +@@ -0,0 +1,43 @@ ++provider dhcpd { ++ probe main(); ++ probe discover_start() ++ probe discover_done() ++ probe request_start() ++ probe request_done() ++ probe release_start() ++ probe release_done() ++ probe decline_start() ++ probe decline_done() ++ probe inform_start() ++ probe inform_done() ++ probe nak_lease_start() ++ probe nak_lease_done() ++ probe ack_lease_start() ++ probe ack_lease_done() ++ probe reply_start() ++ probe reply_done() ++ probe find_lease_start() ++ probe find_lease_done() ++ probe 6_solicit_start() ++ probe 6_solicit_done() ++ probe 6_request_start() ++ probe 6_request_done() ++ probe 6_confirm_start() ++ probe 6_confirm_done() ++ probe 6_renew_start() ++ probe 6_renew_done() ++ probe 6_rebind_start() ++ probe 6_rebind_done() ++ probe 6_decline_start() ++ probe 6_decline_done() ++ probe 6_release_start() ++ probe 6_release_done() ++ probe 6_information_request_start() ++ probe 6_information_request_done() ++ probe 6_relay_forw_start() ++ probe 6_relay_forw_done() ++ probe failover_pool_dobalance_start() ++ probe failover_pool_dobalance_done() ++ probe failover_set_state_start(int, int) /* state, new_state */ ++ probe failover_set_state_done() ++}; +diff -up dhcp-4.2.6b1/server/tests/Makefile.am.systemtap dhcp-4.2.6b1/server/tests/Makefile.am +--- dhcp-4.2.6b1/server/tests/Makefile.am.systemtap 2014-01-23 14:45:04.803357797 +0100 ++++ dhcp-4.2.6b1/server/tests/Makefile.am 2014-01-23 14:45:04.852357107 +0100 +@@ -20,6 +20,10 @@ DHCPSRC = ../dhcp.c ../bootp.c ../confpa + DHCPLIBS = $(top_builddir)/common/libdhcp.a $(top_builddir)/omapip/libomapi.la \ + $(top_builddir)/dhcpctl/libdhcpctl.la $(BIND9_LIBDIR) -ldns-export -lisc-export + ++if ENABLE_SYSTEMTAP ++DHCPLIBS += ../probes.o ++endif ++ + ATF_TESTS = + TESTS = + if HAVE_ATF +diff -up dhcp-4.2.6b1/server/trace.h.systemtap dhcp-4.2.6b1/server/trace.h +--- dhcp-4.2.6b1/server/trace.h.systemtap 2014-01-23 14:45:04.853357093 +0100 ++++ dhcp-4.2.6b1/server/trace.h 2014-01-23 14:45:04.853357093 +0100 +@@ -0,0 +1,11 @@ ++// trace.h ++ ++#include "config.h" ++#ifdef HAVE_SYSTEMTAP ++// include the generated probes header and put markers in code ++#include "probes.h" ++#define TRACE(probe) probe ++#else ++// Wrap the probe to allow it to be removed when no systemtap available ++#define TRACE(probe) ++#endif +diff -up dhcp-4.2.6b1/tapset/dhcpd.stp.systemtap dhcp-4.2.6b1/tapset/dhcpd.stp +--- dhcp-4.2.6b1/tapset/dhcpd.stp.systemtap 2014-01-23 14:45:04.853357093 +0100 ++++ dhcp-4.2.6b1/tapset/dhcpd.stp 2014-01-23 14:45:04.853357093 +0100 +@@ -0,0 +1,212 @@ ++/* dhcpd tapset ++ Copyright (C) 2011, Red Hat Inc. ++ */ ++ ++probe dhcpd_main = process("dhcpd").mark("main") ++{ ++ probestr = sprintf("%s(locals: %s)", $$name, $$locals); ++ ++} ++ ++probe dhcpd_discover_start = process("dhcpd").mark("discover_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_discover_done = process("dhcpd").mark("discover_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_request_start = process("dhcpd").mark("request_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_request_done = process("dhcpd").mark("request_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_release_start = process("dhcpd").mark("release_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_release_done = process("dhcpd").mark("release_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_decline_start = process("dhcpd").mark("decline_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_decline_done = process("dhcpd").mark("decline_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_inform_start = process("dhcpd").mark("inform_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_inform_done = process("dhcpd").mark("inform_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_nak_lease_start = process("dhcpd").mark("nak_lease_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_nak_lease_done = process("dhcpd").mark("nak_lease_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_ack_lease_start = process("dhcpd").mark("ack_lease_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_ack_lease_done = process("dhcpd").mark("ack_lease_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_reply_start = process("dhcpd").mark("reply_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_reply_done = process("dhcpd").mark("reply_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_find_lease_start = process("dhcpd").mark("find_lease_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_find_lease_done = process("dhcpd").mark("find_lease_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_solicit_start = process("dhcpd").mark("6_solicit_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_solicit_done = process("dhcpd").mark("6_solicit_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_request_start = process("dhcpd").mark("6_request_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_request_done = process("dhcpd").mark("6_request_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_confirm_start = process("dhcpd").mark("6_confirm_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_confirm_done = process("dhcpd").mark("6_confirm_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_renew_start = process("dhcpd").mark("6_renew_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_renew_done = process("dhcpd").mark("6_renew_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_rebind_start = process("dhcpd").mark("6_rebind_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_rebind_done = process("dhcpd").mark("6_rebind_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_decline_start = process("dhcpd").mark("6_decline_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_decline_done = process("dhcpd").mark("6_decline_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_release_start = process("dhcpd").mark("6_release_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_release_done = process("dhcpd").mark("6_release_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_information_request_start = process("dhcpd").mark("6_information_request_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_information_request_done = process("dhcpd").mark("6_information_request_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_relay_forw_start = process("dhcpd").mark("6_relay_forw_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_6_relay_forw_done = process("dhcpd").mark("6_relay_forw_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_failover_pool_dobalance_start = process("dhcpd").mark("failover_pool_dobalance_start") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++probe dhcpd_failover_pool_dobalance_done = process("dhcpd").mark("failover_pool_dobalance_done") ++{ ++ probestr = sprintf("%s", $$name); ++} ++ ++ ++probe dhcpd_failover_set_state_start = process("dhcpd").mark("failover_set_state_start") ++{ ++ state = $arg1; ++ new_state = $arg2; ++ probestr = sprintf("%s(state=%d, new_state=%d)", $$name, state, new_state); ++} ++ ++probe dhcpd_failover_set_state_done = process("dhcpd").mark("failover_set_state_done") ++{ ++ probestr = sprintf("%s", $$name); ++} +diff -up dhcp-4.2.6b1/tapset/Makefile.am.systemtap dhcp-4.2.6b1/tapset/Makefile.am +--- dhcp-4.2.6b1/tapset/Makefile.am.systemtap 2014-01-23 14:45:04.853357093 +0100 ++++ dhcp-4.2.6b1/tapset/Makefile.am 2014-01-23 14:45:04.853357093 +0100 +@@ -0,0 +1,26 @@ ++# Makefile.am for dhcp/tapset ++# Jiri Popelka ++ ++.PHONY: clean-local install-data-hook uninstall-local ++ ++# ++EXTRA_DIST = dhcpd.stp ++TAPSET_FILES = $(EXTRA_DIST) ++TAPSET_INSTALL_DIR = $(DESTDIR)@ABS_TAPSET_DIR@ ++ ++if ENABLE_SYSTEMTAP ++all-local: $(TAPSET_FILES) ++ ++clean-local: ++ ++install-data-hook: ++ $(MKDIR_P) $(TAPSET_INSTALL_DIR) ++ $(INSTALL_DATA) $(TAPSET_FILES) $(TAPSET_INSTALL_DIR) ++ ++uninstall-local: ++ @list='$(TAPSET_FILES)'; for p in $$list; do \ ++ echo " rm -f '$(TAPSET_INSTALL_DIR)/$$p'"; \ ++ rm -f "$(TAPSET_INSTALL_DIR)/$$p"; \ ++ done ++endif ++ diff --git a/dhcp-dhclient6-bind.patch b/dhcp-dhclient6-bind.patch deleted file mode 100644 index 9451928..0000000 --- a/dhcp-dhclient6-bind.patch +++ /dev/null @@ -1,329 +0,0 @@ -From 198a1fcc9f6f8c39ddf8c6e962b7e4925d43072c Mon Sep 17 00:00:00 2001 -From: Jiri Popelka -Date: Thu, 24 Oct 2013 10:03:52 +0200 -Subject: [PATCH] Fix the socket handling for DHCPv6 clients to allow multiple - instances - -of a client on a single machine to work properly. Previously only -one client would receive the packets. Thanks to Jiri Popelka at Red -Hat for the bug report and a potential patch. -[ISC-Bugs #34784] ---- - common/discover.c | 19 ++++----- - common/socket.c | 116 ++++++++++++++++++++++++++++++++++++++++++++---------- - includes/dhcpd.h | 6 +-- - 3 files changed, 107 insertions(+), 34 deletions(-) - -diff --git a/common/discover.c b/common/discover.c -index a305d92..4027d1a 100644 ---- a/common/discover.c -+++ b/common/discover.c -@@ -57,10 +57,6 @@ struct in_addr limited_broadcast; - int local_family = AF_INET; - struct in_addr local_address; - --#ifdef DHCPv6 --struct in6_addr local_address6; --#endif /* DHCPv6 */ -- - void (*bootp_packet_handler) (struct interface_info *, - struct dhcp_packet *, unsigned, - unsigned int, -@@ -877,7 +873,7 @@ discover_interfaces(int state) { - (state == DISCOVER_RELAY)) { - if_register6(tmp, 1); - } else { -- if_register6(tmp, 0); -+ if_register_linklocal6(tmp); - } - #endif /* DHCPv6 */ - } -@@ -933,13 +929,14 @@ discover_interfaces(int state) { - tmp -> name, isc_result_totext (status)); - - #if defined(DHCPv6) -- /* Only register the first interface for V6, since they all -- * use the same socket. XXX: This has some messy side -- * effects if we start dynamically adding and removing -- * interfaces, but we're well beyond that point in terms of -- * mess. -+ /* Only register the first interface for V6, since -+ * servers and relays all use the same socket. -+ * XXX: This has some messy side effects if we start -+ * dynamically adding and removing interfaces, but -+ * we're well beyond that point in terms of mess. - */ -- if (local_family == AF_INET6) -+ if (((state == DISCOVER_SERVER) || (state == DISCOVER_RELAY)) && -+ (local_family == AF_INET6)) - break; - #endif - } /* for (tmp = interfaces; ... */ -diff --git a/common/socket.c b/common/socket.c -index 8fead01..f0c2c94 100644 ---- a/common/socket.c -+++ b/common/socket.c -@@ -67,6 +67,7 @@ - * XXX: this is gross. we need to go back and overhaul the API for socket - * handling. - */ -+static int no_global_v6_socket = 0; - static unsigned int global_v6_socket_references = 0; - static int global_v6_socket = -1; - -@@ -127,7 +128,7 @@ void if_reinitialize_receive (info) - /* Generic interface registration routine... */ - int - if_register_socket(struct interface_info *info, int family, -- int *do_multicast) -+ int *do_multicast, struct in6_addr *linklocal6) - { - struct sockaddr_storage name; - int name_len; -@@ -161,10 +162,12 @@ if_register_socket(struct interface_info *info, int family, - addr6 = (struct sockaddr_in6 *)&name; - addr6->sin6_family = AF_INET6; - addr6->sin6_port = local_port; -- /* XXX: What will happen to multicasts if this is nonzero? */ -- memcpy(&addr6->sin6_addr, -- &local_address6, -- sizeof(addr6->sin6_addr)); -+ if (linklocal6) { -+ memcpy(&addr6->sin6_addr, -+ linklocal6, -+ sizeof(addr6->sin6_addr)); -+ addr6->sin6_scope_id = if_nametoindex(info->name); -+ } - #ifdef HAVE_SA_LEN - addr6->sin6_len = sizeof(*addr6); - #endif -@@ -221,9 +224,9 @@ if_register_socket(struct interface_info *info, int family, - * daemons can bind to their own sockets and get data for their - * respective interfaces. This does not (and should not) affect - * DHCPv4 sockets; we can't yet support BSD sockets well, much -- * less multiple sockets. -+ * less multiple sockets. Make sense only with multicast. - */ -- if (local_family == AF_INET6) { -+ if (local_family == AF_INET6 && *do_multicast) { - flag = 1; - if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, - (char *)&flag, sizeof(flag)) < 0) { -@@ -322,7 +325,7 @@ void if_register_send (info) - struct interface_info *info; - { - #ifndef USE_SOCKET_RECEIVE -- info->wfdesc = if_register_socket(info, AF_INET, 0); -+ info->wfdesc = if_register_socket(info, AF_INET, 0, NULL); - /* If this is a normal IPv4 address, get the hardware address. */ - if (strcmp(info->name, "fallback") != 0) - get_hw_addr(info); -@@ -368,7 +371,7 @@ void if_register_receive (info) - - #if defined(IP_PKTINFO) && defined(IP_RECVPKTINFO) && defined(USE_V4_PKTINFO) - if (global_v4_socket_references == 0) { -- global_v4_socket = if_register_socket(info, AF_INET, 0); -+ global_v4_socket = if_register_socket(info, AF_INET, 0, NULL); - if (global_v4_socket < 0) { - /* - * if_register_socket() fatally logs if it fails to -@@ -384,7 +387,7 @@ void if_register_receive (info) - #else - /* If we're using the socket API for sending and receiving, - we don't need to register this interface twice. */ -- info->rfdesc = if_register_socket(info, AF_INET, 0); -+ info->rfdesc = if_register_socket(info, AF_INET, 0, NULL); - #endif /* IP_PKTINFO... */ - /* If this is a normal IPv4 address, get the hardware address. */ - if (strcmp(info->name, "fallback") != 0) -@@ -477,9 +480,13 @@ if_register6(struct interface_info *info, int do_multicast) { - /* Bounce do_multicast to a stack variable because we may change it. */ - int req_multi = do_multicast; - -+ if (no_global_v6_socket) { -+ log_fatal("Impossible condition at %s:%d", MDL); -+ } -+ - if (global_v6_socket_references == 0) { - global_v6_socket = if_register_socket(info, AF_INET6, -- &req_multi); -+ &req_multi, NULL); - if (global_v6_socket < 0) { - /* - * if_register_socket() fatally logs if it fails to -@@ -515,12 +522,73 @@ if_register6(struct interface_info *info, int do_multicast) { - } - } - -+/* -+ * Register an IPv6 socket bound to the link-local address of -+ * the argument interface (used by clients on a multiple interface box, -+ * vs. a server or a relay using the global IPv6 socket and running -+ * *only* in a single instance). -+ */ -+void -+if_register_linklocal6(struct interface_info *info) { -+ int sock; -+ int count; -+ struct in6_addr *addr6 = NULL; -+ int req_multi = 0; -+ -+ if (global_v6_socket >= 0) { -+ log_fatal("Impossible condition at %s:%d", MDL); -+ } -+ -+ no_global_v6_socket = 1; -+ -+ /* get the (?) link-local address */ -+ for (count = 0; count < info->v6address_count; count++) { -+ addr6 = &info->v6addresses[count]; -+ if (IN6_IS_ADDR_LINKLOCAL(addr6)) -+ break; -+ } -+ -+ if (!addr6) { -+ log_fatal("no link-local IPv6 address for %s", info->name); -+ } -+ -+ sock = if_register_socket(info, AF_INET6, &req_multi, addr6); -+ -+ if (sock < 0) { -+ log_fatal("if_register_socket for %s fails", info->name); -+ } -+ -+ info->rfdesc = sock; -+ info->wfdesc = sock; -+ -+ get_hw_addr(info); -+ -+ if (!quiet_interface_discovery) { -+ if (info->shared_network != NULL) { -+ log_info("Listening on Socket/%d/%s/%s", -+ global_v6_socket, info->name, -+ info->shared_network->name); -+ log_info("Sending on Socket/%d/%s/%s", -+ global_v6_socket, info->name, -+ info->shared_network->name); -+ } else { -+ log_info("Listening on Socket/%s", info->name); -+ log_info("Sending on Socket/%s", info->name); -+ } -+ } -+} -+ - void - if_deregister6(struct interface_info *info) { -- /* Dereference the global v6 socket. */ -- if ((info->rfdesc == global_v6_socket) && -- (info->wfdesc == global_v6_socket) && -- (global_v6_socket_references > 0)) { -+ /* client case */ -+ if (no_global_v6_socket) { -+ close(info->rfdesc); -+ info->rfdesc = -1; -+ info->wfdesc = -1; -+ } else if ((info->rfdesc == global_v6_socket) && -+ (info->wfdesc == global_v6_socket) && -+ (global_v6_socket_references > 0)) { -+ /* Dereference the global v6 socket. */ - global_v6_socket_references--; - info->rfdesc = -1; - info->wfdesc = -1; -@@ -540,7 +608,8 @@ if_deregister6(struct interface_info *info) { - } - } - -- if (global_v6_socket_references == 0) { -+ if (!no_global_v6_socket && -+ (global_v6_socket_references == 0)) { - close(global_v6_socket); - global_v6_socket = -1; - -@@ -692,9 +761,11 @@ ssize_t send_packet6(struct interface_info *interface, - struct sockaddr_in6 *to) { - struct msghdr m; - struct iovec v; -+ struct sockaddr_in6 dst; - int result; - struct in6_pktinfo *pktinfo; - struct cmsghdr *cmsg; -+ unsigned int ifindex; - - /* - * If necessary allocate space for the control message header. -@@ -717,9 +788,14 @@ ssize_t send_packet6(struct interface_info *interface, - - /* - * Set the target address we're sending to. -+ * Enforce the scope ID for bogus BSDs. - */ -- m.msg_name = to; -- m.msg_namelen = sizeof(*to); -+ memcpy(&dst, to, sizeof(dst)); -+ m.msg_name = &dst; -+ m.msg_namelen = sizeof(dst); -+ ifindex = if_nametoindex(interface->name); -+ if (no_global_v6_socket) -+ dst.sin6_scope_id = ifindex; - - /* - * Set the data buffer we're sending. (Using this wacky -@@ -747,7 +823,7 @@ ssize_t send_packet6(struct interface_info *interface, - cmsg->cmsg_len = CMSG_LEN(sizeof(*pktinfo)); - pktinfo = (struct in6_pktinfo *)CMSG_DATA(cmsg); - memset(pktinfo, 0, sizeof(*pktinfo)); -- pktinfo->ipi6_ifindex = if_nametoindex(interface->name); -+ pktinfo->ipi6_ifindex = ifindex; - m.msg_controllen = cmsg->cmsg_len; - - result = sendmsg(interface->wfdesc, &m, 0); -@@ -1046,7 +1122,7 @@ void maybe_setup_fallback () - isc_result_t status; - struct interface_info *fbi = (struct interface_info *)0; - if (setup_fallback (&fbi, MDL)) { -- fbi -> wfdesc = if_register_socket (fbi, AF_INET, 0); -+ fbi -> wfdesc = if_register_socket (fbi, AF_INET, 0, NULL); - fbi -> rfdesc = fbi -> wfdesc; - log_info ("Sending on Socket/%s%s%s", - fbi -> name, -diff --git a/includes/dhcpd.h b/includes/dhcpd.h -index b2fbc8b..56d4eab 100644 ---- a/includes/dhcpd.h -+++ b/includes/dhcpd.h -@@ -2378,7 +2378,7 @@ void get_hw_addr(struct interface_info *info); - /* socket.c */ - #if defined (USE_SOCKET_SEND) || defined (USE_SOCKET_RECEIVE) \ - || defined (USE_SOCKET_FALLBACK) --int if_register_socket(struct interface_info *, int, int *); -+int if_register_socket(struct interface_info *, int, int *, struct in6_addr *); - #endif - - #if defined (USE_SOCKET_FALLBACK) && !defined (USE_SOCKET_SEND) -@@ -2389,7 +2389,7 @@ ssize_t send_fallback (struct interface_info *, - struct in_addr, - struct sockaddr_in *, struct hardware *); - ssize_t send_fallback6(struct interface_info *, struct packet *, -- struct dhcp_packet *, size_t, struct in6_addr, -+ struct dhcp_packet *, size_t, struct in6_addr *, - struct sockaddr_in6 *, struct hardware *); - #endif - -@@ -2425,6 +2425,7 @@ void maybe_setup_fallback (void); - #endif - - void if_register6(struct interface_info *info, int do_multicast); -+void if_register_linklocal6(struct interface_info *info); - ssize_t receive_packet6(struct interface_info *interface, - unsigned char *buf, size_t len, - struct sockaddr_in6 *from, struct in6_addr *to_addr, -@@ -2570,7 +2571,6 @@ void interface_trace_setup (void); - extern struct in_addr limited_broadcast; - extern int local_family; - extern struct in_addr local_address; --extern struct in6_addr local_address6; - - extern u_int16_t local_port; - extern u_int16_t remote_port; --- -1.8.3.1 - diff --git a/dhcp.spec b/dhcp.spec index 1f41b8c..707a9df 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -9,23 +9,22 @@ #%%global patchver P2 -#%%global prever rc1 +%global prever b1 #%%global VERSION %{version}-%{patchver} -#%%global VERSION %{version}%{prever} -%global VERSION %{version} +#%%global VERSION %{version} +%global VERSION %{version}%{prever} Summary: Dynamic host configuration protocol software Name: dhcp -Version: 4.2.5 -Release: 30%{?dist} +Version: 4.2.6 +Release: 0.1.%{prever}%{?dist} # NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to # 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. # So we are stuck with it. Epoch: 12 License: ISC -Group: System Environment/Daemons URL: http://isc.org/products/DHCP/ Source0: ftp://ftp.isc.org/isc/dhcp/%{VERSION}/dhcp-%{VERSION}.tar.gz Source1: dhclient-script @@ -38,50 +37,48 @@ Source7: dhcpd6.service Source8: dhcrelay.service -Patch0: dhcp-4.2.0-errwarn-message.patch +Patch0: dhcp-4.2.6-errwarn-message.patch Patch1: dhcp-4.2.4-dhclient-options.patch -Patch2: dhcp-4.2.0-release-by-ifup.patch +Patch2: dhcp-4.2.6-release-by-ifup.patch Patch3: dhcp-4.2.0-dhclient-decline-backoff.patch Patch4: dhcp-4.2.4-unicast-bootp.patch Patch7: dhcp-4.2.0-default-requested-options.patch Patch8: dhcp-4.2.2-xen-checksum.patch Patch10: dhcp-4.2.5-manpages.patch Patch11: dhcp-4.2.4-paths.patch -Patch12: dhcp-4.2.2-CLOEXEC.patch +Patch12: dhcp-4.2.6-CLOEXEC.patch Patch14: dhcp-4.2.0-garbage-chars.patch Patch17: dhcp-4.2.0-add_timeout_when_NULL.patch -Patch18: dhcp-4.2.4-64_bit_lease_parse.patch -Patch19: dhcp-4.2.2-capability.patch +Patch18: dhcp-4.2.6-64_bit_lease_parse.patch +Patch19: dhcp-4.2.6-capability.patch Patch20: dhcp-4.2.0-logpid.patch Patch21: dhcp-4.2.4-UseMulticast.patch Patch22: dhcp-4.2.5-sendDecline.patch Patch23: dhcp-4.2.1-retransmission.patch Patch25: dhcp-4.2.5-rfc3442-classless-static-routes.patch Patch27: dhcp-4.2.0-honor-expired.patch -Patch28: dhcp-4.2.5-remove-bind.patch +Patch28: dhcp-4.2.6-remove-bind.patch Patch29: dhcp-4.2.4-P1-remove-dst.patch Patch30: dhcp-4.2.5-sharedlib.patch Patch31: dhcp-4.2.5-PPP.patch Patch32: dhcp-4.2.5-paranoia.patch -Patch33: dhcp-4.2.5-lpf-ib.patch +Patch33: dhcp-4.2.6-lpf-ib.patch Patch34: dhcp-4.2.4-improved-xid.patch Patch35: dhcp-4.2.2-gpxe-cid.patch -Patch36: dhcp-4.2.5-systemtap.patch +Patch36: dhcp-4.2.6-systemtap.patch Patch37: dhcp-4.2.3-dhclient-decline-onetry.patch Patch38: dhcp-4.2.3-P2-log_perror.patch Patch39: dhcp-4.2.4-getifaddrs.patch Patch40: dhcp-4.2.5-omapi-leak.patch Patch41: dhcp-4.2.5-rfc5970-dhcpv6-options-for-network-boot.patch Patch42: dhcp-4.2.4-failOverPeer.patch -Patch43: dhcp-4.2.5b1-atf-pkgconfig.patch Patch44: dhcp-4.2.4-P1-interval.patch Patch45: dhcp-4.2.4-P2-conflex-do-forward-updates.patch Patch46: dhcp-4.2.4-P2-dupl-key.patch Patch47: dhcp-4.2.5-range6.patch Patch48: dhcp-4.2.5-next-server.patch -Patch49: dhcp-dhclient6-bind.patch -Patch50: dhcp-no-subnet-error2info.patch -Patch51: dhcp-ffff-checksum.patch +Patch49: dhcp-no-subnet-error2info.patch +Patch50: dhcp-ffff-checksum.patch BuildRequires: autoconf BuildRequires: automake @@ -127,7 +124,6 @@ the ISC DHCP service and relay agent. %package -n dhclient Summary: Provides the ISC DHCP client daemon and dhclient-script -Group: System Environment/Base # dhclient-script requires: Requires: coreutils grep hostname initscripts iproute iputils sed Requires: %{name}-common = %{epoch}:%{version}-%{release} @@ -146,7 +142,6 @@ provides the ISC DHCP client daemon. %package common Summary: Common files used by ISC dhcp client and server -Group: System Environment/Base Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release} %description common @@ -160,7 +155,6 @@ This package provides common files used by dhcp and dhclient package. %package libs Summary: Shared libraries used by ISC dhcp client and server -Group: System Environment/Base %description libs This package contains shared libraries used by ISC dhcp client and server @@ -168,7 +162,6 @@ This package contains shared libraries used by ISC dhcp client and server %package devel Summary: Development headers and libraries for interfacing to the DHCP server -Group: Development/Libraries Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release} %description devel @@ -322,10 +315,6 @@ rm -rf includes/isc-dhcp # (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #30402]) %patch42 -p1 -b .failOverPeer -# To be able to build with '--with-atf'. -# (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #32206]) -%patch43 -p1 -b .pkgconfig - # isc_time_nowplusinterval() is not safe with 64-bit time_t (#662254, #789601) # (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #28038]) %patch44 -p1 -b .interval @@ -346,16 +335,12 @@ rm -rf includes/isc-dhcp # (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #33098]) %patch48 -p1 -b .next-server -# dhclient -6: bind socket to interface (#1001742) -# (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #34784]) -%patch49 -p1 -b .dhclient6-bind - # 'No subnet declaration for ' should be info, not error. -%patch50 -p1 -b .error2info +%patch49 -p1 -b .error2info # dhcpd rejects the udp packet with checksum=0xffff (#1015997) # (Submitted to dhcp-bugs@isc.org - [ISC-Bugs #25587]) -%patch51 -p1 -b .ffff +%patch50 -p1 -b .ffff # Update paths in all man pages for page in client/dhclient.conf.5 client/dhclient.leases.5 \ @@ -641,6 +626,9 @@ done %changelog +* Thu Jan 23 2014 Jiri Popelka - 12:4.2.6-0.1.b1 +- 4.2.6b1 + * Tue Jan 21 2014 Jiri Popelka - 12:4.2.5-30 - dhclient-script: don't ping router (#1055181) diff --git a/sources b/sources index e7cd8d9..a3744dd 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -6489e919ac093d17249270ee9be1020e dhcp-4.2.5.tar.gz +ae8727a6d5bc6a133b3d39513979cba8 dhcp-4.2.6b1.tar.gz