From d059c507b74343a36637dcc9eb95a20ec148c8a51b9b525170e8e15db43ecf63 Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Mon, 10 Feb 2014 18:14:12 +0000 Subject: [PATCH] - Initially switched to use systemd service files under systemd and enabled Restart=on-abort (fate#315133). - Update to ISC dhcp-4.2.6 release. See RELNOTES file for the complete list of changes -- digest of fixes not in dhcp-4.2.5: - Tidy up receive packet processing. Thanks to Brad Plank of GTA for reporting the issue and suggesting a possible patch. [ISC-Bugs #34447] - 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] - Added support for gentle shutdown after signal is received. [ISC-Bugs #32692] [ISC-Bugs 34945] - Enhance the DHCPv6 server logging to include the addresses that are assigned to the clients. This can be enabled by defining LOG_V6_ADDRESSES in site.h. [ISC-Bugs #26377] - Fix an operation in the DDNS code to be a bitwise instead of logical or. [ISC-Bugs #35138] - Merged patches for dhcp-4.2.6 version to apply without fuzzy, prepended patch number prefixes to match spec file patch nr, added patch markup tags / bug numbers to the spec file. - Applied contrib-lease-path pach to contrib.tar.gz [- contrib-lease-path.diff] - Changed to require automake and use its config.sub and guess files instead of maintaining a patch. [- config-guess-sub-update.patch] - Enabled to log DHCPv6 addresses assigned by server to clients [+ 0016-server-log-DHCPv6-addresses-assigned-to-clients.patch] - Cleaned up documentation, rpmlint adjustments. OBS-URL: https://build.opensuse.org/package/show/network:dhcp/dhcp?expand=0&rev=121 --- ...iff => 0001-dhcp-4.1.1-default-paths.patch | 18 +- ...oia.diff => 0002-dhcp-4.1.1-paranoia.patch | 24 +- ...diff => 0003-dhcp-4.2.2-man-includes.patch | 19 +- ...file.diff => 0004-dhcp-4.1.1-tmpfile.patch | 16 +- ...005-dhcp-4.1.1-dhclient-exec-filedes.patch | 16 +- ...hcp-4.2.5-dhclient-send-hostname-rml.patch | 18 +- 0007-dhcp-4.2.6-ldap-mt01.patch | 2235 ++++++++++++++ 0008-dhcp-4.1.1-P1-lpf-bind-msg-fix.patch | 25 + ...diff => 0009-dhcp-4.2.6-xen-checksum.patch | 69 +- ...10-dhcp-4.2.2-dhclient-option-checks.patch | 25 +- ...iff => 0011-dhcp-4.2.6-close-on-exec.patch | 114 +- 0012-dhcp-4.2.2-quiet-dhclient.patch | 26 + 0013-dhcp-4.2.3-P1-dhclient-log-pid.patch | 25 + ...interface-discovery-using-getifaddrs.patch | 22 +- ...re-SIGPIPE-to-not-die-in-socket-code.patch | 26 +- ...DHCPv6-addresses-assigned-to-clients.patch | 23 + config-guess-sub-update.patch | 2584 ----------------- contrib-lease-path.diff | 22 - contrib.tar.gz | 4 +- dhcp-4.1.1-P1-lpf-bind-msg-fix.diff | 11 - dhcp-4.2.2-quiet-dhclient.bnc711420.diff | 17 - dhcp-4.2.3-P1-dhclient-log-pid.diff | 29 - dhcp-4.2.5-P1.tar.gz | 3 - dhcp-4.2.5-P1.tar.gz.asc | 11 - dhcp-4.2.5-ldap-mt01.patch.bz2 | 3 - dhcp-4.2.6.tar.gz | 3 + dhcp-4.2.6.tar.gz.asc | 11 + dhcp.LIESMICH | 106 - dhcp.README | 70 +- dhcp.README.upgrade | 36 - dhcp.changes | 34 + dhcp.spec | 256 +- dhcpd.script | 475 +++ dhcpd.service | 15 + dhcpd6.service | 15 + dhcrelay.script | 249 ++ dhcrelay.service | 15 + dhcrelay6.service | 15 + if-up.d.dhcpd-restart-hook | 3 +- rc.dhcpd | 434 +-- rc.dhcpd6 | 435 +-- rc.dhcrelay | 200 +- rc.dhcrelay6 | 208 +- sysconfig.dhcpd | 22 - 44 files changed, 3627 insertions(+), 4360 deletions(-) rename dhcp-4.1.1-default-paths.diff => 0001-dhcp-4.1.1-default-paths.patch (65%) rename dhcp-4.1.1-paranoia.diff => 0002-dhcp-4.1.1-paranoia.patch (73%) rename dhcp-4.2.2-man-includes.diff => 0003-dhcp-4.2.2-man-includes.patch (58%) rename dhcp-4.1.1-tmpfile.diff => 0004-dhcp-4.1.1-tmpfile.patch (74%) rename dhcp-4.1.1-dhclient-exec-filedes.diff => 0005-dhcp-4.1.1-dhclient-exec-filedes.patch (53%) rename dhcp-4.2.5-dhclient-send-hostname-rml.patch => 0006-dhcp-4.2.5-dhclient-send-hostname-rml.patch (88%) create mode 100644 0007-dhcp-4.2.6-ldap-mt01.patch create mode 100644 0008-dhcp-4.1.1-P1-lpf-bind-msg-fix.patch rename dhcp-4.2.2-xen-checksum.diff => 0009-dhcp-4.2.6-xen-checksum.patch (80%) rename dhcp-4.2.4-dhclient-option-checks.bnc675052.diff => 0010-dhcp-4.2.2-dhclient-option-checks.patch (60%) rename dhcp-4.2.2-close-on-exec.diff => 0011-dhcp-4.2.6-close-on-exec.patch (78%) create mode 100644 0012-dhcp-4.2.2-quiet-dhclient.patch create mode 100644 0013-dhcp-4.2.3-P1-dhclient-log-pid.patch rename dhcp-4.2.4-interface-discovery-using-getifaddrs.patch => 0014-Fixed-linux-interface-discovery-using-getifaddrs.patch (83%) rename dhcp-4.2.4-P2-do-not-die-on-sigpipe.patch => 0015-Ignore-SIGPIPE-to-not-die-in-socket-code.patch (74%) create mode 100644 0016-server-log-DHCPv6-addresses-assigned-to-clients.patch delete mode 100644 config-guess-sub-update.patch delete mode 100644 contrib-lease-path.diff delete mode 100644 dhcp-4.1.1-P1-lpf-bind-msg-fix.diff delete mode 100644 dhcp-4.2.2-quiet-dhclient.bnc711420.diff delete mode 100644 dhcp-4.2.3-P1-dhclient-log-pid.diff delete mode 100644 dhcp-4.2.5-P1.tar.gz delete mode 100644 dhcp-4.2.5-P1.tar.gz.asc delete mode 100644 dhcp-4.2.5-ldap-mt01.patch.bz2 create mode 100644 dhcp-4.2.6.tar.gz create mode 100644 dhcp-4.2.6.tar.gz.asc delete mode 100644 dhcp.LIESMICH delete mode 100644 dhcp.README.upgrade create mode 100644 dhcpd.script create mode 100644 dhcpd.service create mode 100644 dhcpd6.service create mode 100644 dhcrelay.script create mode 100644 dhcrelay.service create mode 100644 dhcrelay6.service diff --git a/dhcp-4.1.1-default-paths.diff b/0001-dhcp-4.1.1-default-paths.patch similarity index 65% rename from dhcp-4.1.1-default-paths.diff rename to 0001-dhcp-4.1.1-default-paths.patch index 16247ea..0a57dd6 100644 --- a/dhcp-4.1.1-default-paths.diff +++ b/0001-dhcp-4.1.1-default-paths.patch @@ -1,8 +1,17 @@ +From b6ba495cc0b6f578a5cc444af39cab424f63d996 Mon Sep 17 00:00:00 2001 +From: Marius Tomaschewski +Date: Thu, 18 Aug 2011 09:50:30 +0200 +Subject: [PATCH] dhcp-4.1.1-default-paths + +--- + includes/dhcpd.h | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + diff --git a/includes/dhcpd.h b/includes/dhcpd.h -index 90f8a73..6fa5b9e 100644 +index b0f73fb..5830bdb 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h -@@ -1285,11 +1285,11 @@ typedef unsigned char option_mask [16]; +@@ -1420,11 +1420,11 @@ typedef unsigned char option_mask [16]; #endif /* DEBUG */ #ifndef _PATH_DHCPD_DB @@ -16,7 +25,7 @@ index 90f8a73..6fa5b9e 100644 #endif #ifndef _PATH_DHCPD_PID -@@ -1319,11 +1319,11 @@ typedef unsigned char option_mask [16]; +@@ -1454,11 +1454,11 @@ typedef unsigned char option_mask [16]; #endif #ifndef _PATH_DHCLIENT_DB @@ -30,3 +39,6 @@ index 90f8a73..6fa5b9e 100644 #endif #ifndef _PATH_RESOLV_CONF +-- +1.8.4 + diff --git a/dhcp-4.1.1-paranoia.diff b/0002-dhcp-4.1.1-paranoia.patch similarity index 73% rename from dhcp-4.1.1-paranoia.diff rename to 0002-dhcp-4.1.1-paranoia.patch index ff00292..da6e426 100644 --- a/dhcp-4.1.1-paranoia.diff +++ b/0002-dhcp-4.1.1-paranoia.patch @@ -1,8 +1,17 @@ +From 1561b8cb9bacabc5e6064b84ba7a187bfb97d0ad Mon Sep 17 00:00:00 2001 +From: Marius Tomaschewski +Date: Thu, 18 Aug 2011 09:53:00 +0200 +Subject: [PATCH] dhcp-4.1.1-paranoia + +--- + server/dhcpd.c | 24 ++++++++++++++++++++---- + 1 file changed, 20 insertions(+), 4 deletions(-) + diff --git a/server/dhcpd.c b/server/dhcpd.c -index f0cacb6..6e30d33 100644 +index 7dc7dd2..b4c1bef 100644 --- a/server/dhcpd.c +++ b/server/dhcpd.c -@@ -210,7 +210,11 @@ static void omapi_listener_start (void *foo) +@@ -207,7 +207,11 @@ static void omapi_listener_start (void *foo) #if defined (PARANOIA) /* to be used in one of two possible scenarios */ static void setup_chroot (char *chroot_dir) { @@ -15,7 +24,7 @@ index f0cacb6..6e30d33 100644 log_fatal ("you must be root to use chroot"); if (chroot(chroot_dir)) { -@@ -402,7 +406,7 @@ main(int argc, char **argv) { +@@ -413,7 +417,7 @@ main(int argc, char **argv) { log_fatal ("Insufficient memory to %s %s: %s", "record interface", argv [i], isc_result_totext (result)); @@ -24,7 +33,7 @@ index f0cacb6..6e30d33 100644 if (interfaces) { interface_reference (&tmp -> next, interfaces, MDL); -@@ -487,7 +491,15 @@ main(int argc, char **argv) { +@@ -499,7 +503,15 @@ main(int argc, char **argv) { if (set_user) { struct passwd *tmp_pwd; @@ -41,7 +50,7 @@ index f0cacb6..6e30d33 100644 log_fatal ("you must be root to set user"); if (!(tmp_pwd = getpwnam(set_user))) -@@ -505,7 +517,10 @@ main(int argc, char **argv) { +@@ -517,7 +529,10 @@ main(int argc, char **argv) { #define group real_group struct group *tmp_grp; @@ -53,7 +62,7 @@ index f0cacb6..6e30d33 100644 log_fatal ("you must be root to set group"); if (!(tmp_grp = getgrnam(set_group))) -@@ -751,6 +766,7 @@ main(int argc, char **argv) { +@@ -771,6 +786,7 @@ main(int argc, char **argv) { /* change uid to the specified one */ if (set_gid) { @@ -61,3 +70,6 @@ index f0cacb6..6e30d33 100644 if (setgroups (0, (void *)0)) log_fatal ("setgroups: %m"); if (setgid (set_gid)) +-- +1.8.4 + diff --git a/dhcp-4.2.2-man-includes.diff b/0003-dhcp-4.2.2-man-includes.patch similarity index 58% rename from dhcp-4.2.2-man-includes.diff rename to 0003-dhcp-4.2.2-man-includes.patch index 519ce60..d313625 100644 --- a/dhcp-4.2.2-man-includes.diff +++ b/0003-dhcp-4.2.2-man-includes.patch @@ -1,8 +1,18 @@ +From 3c393c65c158048f55017e48aedcc304c9ebd075 Mon Sep 17 00:00:00 2001 +From: Marius Tomaschewski +Date: Thu, 18 Aug 2011 10:01:04 +0200 +Subject: [PATCH] dhcp-4.2.2-man-includes + +--- + dhcpctl/dhcpctl.3 | 4 ++-- + omapip/omapi.3 | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + diff --git a/dhcpctl/dhcpctl.3 b/dhcpctl/dhcpctl.3 -index 9aa1851..7497612 100644 +index ae42a71..d699f4a 100644 --- a/dhcpctl/dhcpctl.3 +++ b/dhcpctl/dhcpctl.3 -@@ -430,8 +430,8 @@ that most error checking has been ommitted for brevity. +@@ -430,8 +430,8 @@ that most error checking has been omitted for brevity. #include #include @@ -14,7 +24,7 @@ index 9aa1851..7497612 100644 int main (int argc, char **argv) { dhcpctl_data_string ipaddrstring = NULL; diff --git a/omapip/omapi.3 b/omapip/omapi.3 -index 4868d7c..23389b0 100644 +index 8fa8105..a616fd3 100644 --- a/omapip/omapi.3 +++ b/omapip/omapi.3 @@ -88,7 +88,7 @@ the lease ends. @@ -26,3 +36,6 @@ index 4868d7c..23389b0 100644 #include int main (int argc, char **argv) { +-- +1.8.4 + diff --git a/dhcp-4.1.1-tmpfile.diff b/0004-dhcp-4.1.1-tmpfile.patch similarity index 74% rename from dhcp-4.1.1-tmpfile.diff rename to 0004-dhcp-4.1.1-tmpfile.patch index 219ded1..8c88cc3 100644 --- a/dhcp-4.1.1-tmpfile.diff +++ b/0004-dhcp-4.1.1-tmpfile.patch @@ -1,8 +1,17 @@ +From 1638d046d2a914164e19c6244df5b4deadaf6938 Mon Sep 17 00:00:00 2001 +From: Marius Tomaschewski +Date: Thu, 18 Aug 2011 10:06:01 +0200 +Subject: [PATCH] dhcp-4.1.1-tmpfile + +--- + server/db.c | 17 ++++++----------- + 1 file changed, 6 insertions(+), 11 deletions(-) + diff --git a/server/db.c b/server/db.c -index a4e1558..1d5f5b0 100644 +index 82f3841..c2630ea 100644 --- a/server/db.c +++ b/server/db.c -@@ -1059,21 +1059,16 @@ int new_lease_file () +@@ -1088,21 +1088,16 @@ int new_lease_file () db_validity = lease_file_is_corrupt; @@ -30,3 +39,6 @@ index a4e1558..1d5f5b0 100644 if ((new_db_file = fdopen(db_fd, "w")) == NULL) { log_error("Can't fdopen new lease file: %m"); close(db_fd); +-- +1.8.4 + diff --git a/dhcp-4.1.1-dhclient-exec-filedes.diff b/0005-dhcp-4.1.1-dhclient-exec-filedes.patch similarity index 53% rename from dhcp-4.1.1-dhclient-exec-filedes.diff rename to 0005-dhcp-4.1.1-dhclient-exec-filedes.patch index ef6fe7c..5ff8511 100644 --- a/dhcp-4.1.1-dhclient-exec-filedes.diff +++ b/0005-dhcp-4.1.1-dhclient-exec-filedes.patch @@ -1,8 +1,17 @@ +From 92a611b4b05ef420e81c2c78f8c1eb3b38c31627 Mon Sep 17 00:00:00 2001 +From: Marius Tomaschewski +Date: Thu, 18 Aug 2011 10:28:04 +0200 +Subject: [PATCH] dhcp-4.1.1-dhclient-exec-filedes + +--- + client/dhclient.c | 6 ++++++ + 1 file changed, 6 insertions(+) + diff --git a/client/dhclient.c b/client/dhclient.c -index 69dcc91..15c31a5 100644 +index 52121be..203d3d1 100644 --- a/client/dhclient.c +++ b/client/dhclient.c -@@ -3173,6 +3173,12 @@ int script_go (client) +@@ -3369,6 +3369,12 @@ int script_go (client) */ if (leaseFile != NULL) fclose(leaseFile); @@ -15,3 +24,6 @@ index 69dcc91..15c31a5 100644 execve (scriptName, argv, envp); log_error ("execve (%s, ...): %m", scriptName); exit (0); +-- +1.8.4 + diff --git a/dhcp-4.2.5-dhclient-send-hostname-rml.patch b/0006-dhcp-4.2.5-dhclient-send-hostname-rml.patch similarity index 88% rename from dhcp-4.2.5-dhclient-send-hostname-rml.patch rename to 0006-dhcp-4.2.5-dhclient-send-hostname-rml.patch index 3878423..cbedee1 100644 --- a/dhcp-4.2.5-dhclient-send-hostname-rml.patch +++ b/0006-dhcp-4.2.5-dhclient-send-hostname-rml.patch @@ -1,15 +1,15 @@ -From ebc6e17683e4a4d7f2316c1ea46d680955df7d26 Mon Sep 17 00:00:00 2001 +From 94cff63e89710f5e67944d57d76edaec968fe139 Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Thu, 18 Aug 2011 10:49:07 +0200 Subject: [PATCH] dhcp-4.2.5-dhclient-send-hostname-rml --- - client/dhclient.8 | 8 ++++++++ - client/dhclient.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- - 2 Dateien geändert, 56 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-) + client/dhclient.8 | 8 ++++++++ + client/dhclient.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- + 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/client/dhclient.8 b/client/dhclient.8 -index 3539591..4a7647a 100644 +index 0aa1119..bc34c6a 100644 --- a/client/dhclient.8 +++ b/client/dhclient.8 @@ -60,6 +60,10 @@ dhclient - Dynamic Host Configuration Protocol Client @@ -35,7 +35,7 @@ index 3539591..4a7647a 100644 .\" mockup relay Set the giaddr field of all packets to the \fIrelay\fR IP address diff --git a/client/dhclient.c b/client/dhclient.c -index 0c1ed24..de93499 100644 +index 203d3d1..b7a14fe 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -119,6 +119,7 @@ main(int argc, char **argv) { @@ -69,7 +69,7 @@ index 0c1ed24..de93499 100644 } else if (!strcmp(argv[i], "-nw")) { nowait = 1; } else if (!strcmp(argv[i], "-n")) { -@@ -484,6 +501,35 @@ main(int argc, char **argv) { +@@ -491,6 +508,35 @@ main(int argc, char **argv) { /* Parse the dhclient.conf file. */ read_client_conf(); @@ -105,7 +105,7 @@ index 0c1ed24..de93499 100644 /* Parse the lease database. */ read_client_leases(); -@@ -708,9 +754,9 @@ static void usage() +@@ -719,9 +765,9 @@ static void usage() log_fatal("Usage: dhclient " #ifdef DHCPv6 @@ -118,5 +118,5 @@ index 0c1ed24..de93499 100644 " [-s server-addr] [-cf config-file] " "[-lf lease-file]\n" -- -1.7.10.4 +1.8.4 diff --git a/0007-dhcp-4.2.6-ldap-mt01.patch b/0007-dhcp-4.2.6-ldap-mt01.patch new file mode 100644 index 0000000..9b35589 --- /dev/null +++ b/0007-dhcp-4.2.6-ldap-mt01.patch @@ -0,0 +1,2235 @@ +From b61fe9752fa8fe76a9c9dd04c9808e510a8dc3fe Mon Sep 17 00:00:00 2001 +From: Marius Tomaschewski +Date: Mon, 10 Feb 2014 13:59:27 +0100 +Subject: [PATCH] dhcp-4.2.6-ldap-mt01 + +A squashed commit of the following changes: + +commit f3961ac1dea087b365ae7d5b3085a4d5cfb918ac +Author: Marius Tomaschewski +Date: Mon Dec 10 09:56:00 2012 +0100 + + Fixed memory leaks in ldap read config error handling + + Fixed to free ldap results before bailing out when the + dhcpServer object or it's dhcpService references can't + be parsed / resolved. + +commit f0ab39c5a6fcca07d305f45536050ba5af91c599 +Author: Marius Tomaschewski +Date: Fri Nov 30 13:00:32 2012 +0100 + + Fixed subclass class-name and data quoting/escaping + +commit 94869d5c2087d44057954425a588712da2c012cf +Author: Marius Tomaschewski +Date: Thu Nov 29 19:02:25 2012 +0100 + + Resize ldap buffer to not truncate bigger objects + + Fixed parse buffer handling code to not avoid truncation + of config > ~8k from bigger ldap objects. Fixed to free + the ldap config buffer passed to the config parser and + append new config, while the parser is in saved state. + +commit 65bced9870ff1a63599321c021519ce6649af57c +Author: Marius Tomaschewski +Date: Thu Nov 15 14:42:21 2012 +0100 + + dhcp-ldap: reset bufix in ldap_read_function + + Fixed ldap_read_function to reset bufix variable to 0 and + to set buflen to the complete length (do not discard last + character, usually \n). + This caused a parsing error at further run of the function, + e.g. while processing the second dhcpService container that + the dhcpServer object may refer to. + +commit 9b306cdbce9666f1a87a8da9526b5b3cd45da334 +Author: Marius Tomaschewski +Date: Thu Nov 15 12:07:42 2012 +0100 + + dhcp-ldap: memleak fix in subnet range processing + +commit ac85a9311e5f466cae4de4f1c717421b14b8b679 +Author: Marius Tomaschewski +Date: Tue Jun 12 09:44:16 2012 +0200 + + Removed SV_LDAP constant redefinition + +commit c4423481cc65360d1d892fd08eebbdd3887af793 +Author: Marius Tomaschewski +Date: Tue Jan 31 17:38:25 2012 +0100 + + Fixed to escape values used in ldap filters + + Use ldap_bv2escaped_filter_value to escape all values used in + constructed ldap filters, e.g. "o=*Test" in DN (bnc#721829). + +commit d6cdf45ef8b80fc245bd0b8e5aa2962680619a91 +Author: Marius Tomaschewski +Date: Wed Apr 27 16:37:00 2011 +0200 + + ldap connect retry loop while initial startup + + Implemented optional ldap connect retry loop during the initial startup + of the dhcp server for cases where the ldap server is not yet started. + Set the ldap-init-retry option in dhcpd.conf to retry to connect + times with one second between each try (bnc#627617). + (cherry picked from commit c09a950a0f706f86a07dd575752d44d1691eb400) + +commit cc266c5e2c54da8f38d00af99ce37ac7f3701931 +Author: Marius Tomaschewski +Date: Fri Nov 26 15:16:55 2010 +0100 + + Do not link dhclient against libldap + +commit fd61b1d7b14d714ba9066f9331d02cf13b87431e +Author: Marius Tomaschewski +Date: Fri Nov 26 09:32:00 2010 +0100 + + Added --with-ldapcasa configure switch and checks + +commit 551e8f9ffc28ac1671205b33dc5c22caf377e5c5 +Author: Marius Tomaschewski +Date: Thu Oct 1 15:29:16 2009 +0200 + + Added configure check for inet_pton and inet_ntop. + +commit 46f3cc4b58872a15d519f657eb95cd5a0e3f1e00 +Author: Marius Tomaschewski +Date: Fri Nov 26 09:16:52 2010 +0100 + + Changed inclusion order in ldap_casa.c + + Include dhcpd.h first, so config.h is included first and pktinfo + type is known (_GNU_SOURCE required for socket extensions). + +commit d02fdfbc9c43b124323098d322eb157895c98350 +Author: Marius Tomaschewski +Date: Fri Nov 26 08:43:19 2010 +0100 + + Moved includes from ldap_casa.h to ldap_casa.c + +commit 2bf6db555f3accb81b42847181bd3e16ac7b627b +Author: Marius Tomaschewski +Date: Thu Nov 25 09:11:28 2010 +0100 + + Added missed includes/ldap_casa.h file + +commit 856003a7eef4bade55bdadeadeb822a4059da5fe +Author: Marius Tomaschewski +Date: Thu Oct 28 17:17:18 2010 +0200 + + Allow all local addresses for dhcpd failover + + Fixed to allow all local addresses for dhcpd failover peering by name + or address and show the name of affected failover peering in log/error + messages (bnc#597825). + +commit 915ce91842a2316e0b382e8b3771f6bcce9b5b7c +Author: Marius Tomaschewski +Date: Fri Nov 26 13:07:33 2010 +0100 + + Disabled ldap support for DHCPv6 (not implemented yet). + +commit bc287137134aa5b759aa501ebb3c37021b29d55d +Author: Marius Tomaschewski +Date: Tue Sep 29 09:25:09 2009 +0200 + + Free ldap url in ldap rebind function + + Fixes an ldap url memory leak in the dhcp ldap rebind function. + +commit 25f051c769ed435020215fb99d1ea54ba7b2786d +Author: Marius Tomaschewski +Date: Tue Sep 29 09:23:37 2009 +0200 + + Disable external dhcpZoneDN and dhcpFailOverPeerDN + + Applied S Kalyanasundaram's patch disabling incorrect parsing + of external dhcpZoneDN and dhcpFailOverPeerDN references. + +commit c34f12ab1b06f0fcd12c30601e4e83d38ff17e69 +Author: Marius Tomaschewski +Date: Thu Oct 28 16:43:21 2010 +0200 + + Meaningful error message on missed dhcpServiceDN + + Fix to provide more meaningful error message in case of missed + dhcpServiceDN attribute in a dhcpServer object (bnc#392354). + +commit 14e0ba1c80eced74ef84b72e7b840d95f53e2022 +Author: Marius Tomaschewski +Date: Mon Sep 28 23:04:08 2009 +0200 + + Support for dhcpFailOverPeer objects + + Ported support for dhcpFailOverPeer objects (failover peering + definition) by S Kalyanasundaram and Marius Tomaschewski + (fate#303198). + +commit 071b5b5fbbd0064c4c396064cd4460baf77af83e +Author: Marius Tomaschewski +Date: Thu Oct 28 15:56:11 2010 +0200 + + Case insensitive hardware address search + + Added dhcp-server compatibility workaround to search for lower- and + upper-case MAC addresses in the dhcpHWAddress LDAP attribute, for + the case, the ldap server is still using an old schema with case + sensitive match definition (bnc#343069). + +commit 683798b58a15456c0bb03b691d9db4ac706b3519 +Author: Marius Tomaschewski +Date: Mon Sep 28 23:02:31 2009 +0200 + + Missed host brace opening + + Generate proper "host ... {" block begin brace even if no harware + address is specified for the host (bnc#265337). + +commit f65005a662a47cd8126776023633f9b1c0906107 +Author: Marius Tomaschewski +Date: Mon Sep 28 23:01:21 2009 +0200 + + Fix to support dhcpServerDN reference + + Fixes to support new dhcpServerDN reference in dhcpService object + search filter (bnc#258493). + +commit e702ee4a39d401d277bb56e3162c8be6be3ad80a +Author: Marius Tomaschewski +Date: Thu Oct 28 15:45:15 2010 +0200 + + Fix for object-order related parse errors + + Fixed object order related parse errors, that occured in case a dhcp-ldap + object referencing a dhcp-tsigkey, class or failoverpeer object, was parsed + before the declaration of the referenced objects, because of the "random" + object order in ldap results (bnc#250153). + +commit 815559287fec09ae1edd49caad8e110f5ab2bbff +Author: Marius Tomaschewski +Date: Wed Nov 24 16:41:37 2010 +0100 + + Typos in access of the tempbv value in ldap debug log + + Fixed typos in access of the tempbv value in ldap debug log + messages guarded by DEBUG_LDAP. + +commit c5c400475a6d1317cc075cbfc10c420e6231f07e +Author: Marius Tomaschewski +Date: Wed Nov 24 16:23:23 2010 +0100 + + Use LDAP_CFLAGS for common/libdhcp to avoid a SEGV + + Use LDAP_CFLAGS for common/libdhcp.a compilation to avoid a segfault + when dhcp server ldap code is enabled. The parse struct allocated by + new_parse, does not contain/allocate any read_function pointer, when + LDAP_CONFIGURATION is not defined. +--- + common/Makefile.am | 1 + + common/conflex.c | 18 +- + configure.ac | 18 + + contrib/ldap/README.ldap | 6 + + includes/dhcpd.h | 24 +- + includes/ldap_casa.h | 101 ++++ + server/Makefile.am | 2 +- + server/ldap.c | 1143 +++++++++++++++++++++++++++++++++++++--------- + server/ldap_casa.c | 4 +- + server/stables.c | 1 + + 10 files changed, 1078 insertions(+), 240 deletions(-) + create mode 100644 includes/ldap_casa.h + +diff --git a/common/Makefile.am b/common/Makefile.am +index eddef05..631025c 100644 +--- a/common/Makefile.am ++++ b/common/Makefile.am +@@ -7,6 +7,7 @@ libdhcp_a_SOURCES = alloc.c bpf.c comapi.c conflex.c ctrace.c discover.c \ + icmp.c inet.c lpf.c memory.c nit.c ns_name.c options.c \ + packet.c parse.c print.c raw.c resolv.c socket.c \ + tables.c tr.c tree.c upf.c ++libdhcp_a_CFLAGS = $(LDAP_CFLAGS) + man_MANS = dhcp-eval.5 dhcp-options.5 + EXTRA_DIST = $(man_MANS) + +diff --git a/common/conflex.c b/common/conflex.c +index c39e91d..8badcf9 100644 +--- a/common/conflex.c ++++ b/common/conflex.c +@@ -147,13 +147,19 @@ save_parse_state(struct parse *cfile) { + /* + * Return the parser to the previous saved state. + * +- * You must call save_parse_state() before calling +- * restore_parse_state(), but you can call restore_parse_state() any +- * number of times after that. ++ * You must call save_parse_state() every time before calling ++ * restore_parse_state(). ++ * ++ * Note: When the read function callback is in use in ldap mode, ++ * a call to get_char() may reallocate the buffer and will append ++ * config data to the buffer until a state restore. ++ * Do not restore to the (freed) pointer and size, but use new one. + */ + isc_result_t + restore_parse_state(struct parse *cfile) { + struct parse *saved_state; ++ char *inbuf = cfile->inbuf; ++ size_t size = cfile->bufsiz; + + if (cfile->saved_state == NULL) { + return DHCP_R_NOTYET; +@@ -161,7 +167,11 @@ restore_parse_state(struct parse *cfile) { + + saved_state = cfile->saved_state; + memcpy(cfile, saved_state, sizeof(*cfile)); +- cfile->saved_state = saved_state; ++ dfree(cfile->saved_state, MDL); ++ cfile->saved_state = NULL; ++ ++ cfile->inbuf = inbuf; ++ cfile->bufsiz = size; + return ISC_R_SUCCESS; + } + +diff --git a/configure.ac b/configure.ac +index c810de8..e8d8fd1 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -618,20 +618,38 @@ AC_ARG_WITH(ldapcrypto, + [ldapcrypto=$withval], + [ldapcrypto=no]) + ++# LDAP CASA auth support. ++AC_ARG_WITH(ldapcasa, ++ AC_HELP_STRING([--with-ldapcasa], ++ [enable LDAP CASA auth support in dhcpd (default is no)]), ++ [ldapcasa=$withval], ++ [ldapcasa=no]) ++ + # OpenLDAP support is disabled by default, if enabled then SSL support is an + # extra optional that is also disabled by default. Enabling LDAP SSL support + # implies enabling LDAP support. + if test x$ldap = xyes || test x$ldapcrypto = xyes ; then ++ saved_LIBS="$LIBS" ++ LIBS="" + AC_SEARCH_LIBS(ldap_initialize, [ldap], , + AC_MSG_FAILURE([*** Cannot find ldap_initialize with -lldap - do you need to install an OpenLDAP2 Devel package?])) + AC_SEARCH_LIBS(ber_pvt_opt_on, [lber], , + AC_MSG_FAILURE([*** Cannot find ber_pvt_opt_on with -llber - do you need to install an OpenLDAP2 Devel package?])) ++ AC_SUBST(LDAP_LIBS, ["$LIBS"]) ++ LIBS="$saved_LIBS" ++ ++ AC_CHECK_FUNCS([inet_pton inet_ntop]) + + if test x$ldapcrypto = xyes ; then + AC_SUBST(LDAP_CFLAGS, ["-DLDAP_CONFIGURATION -DLDAP_USE_SSL"]) + else + AC_SUBST(LDAP_CFLAGS, ["-DLDAP_CONFIGURATION"]) + fi ++ if test x$ldapcasa = xyes ; then ++ AC_CHECK_HEADERS([micasa_mgmd.h],[ ++ LDAP_CFLAGS="$LDAP_CFLAGS -DLDAP_CASA_AUTH" ++ ], AC_MSG_FAILURE([*** Cannot find micasa_mgmd.h for ldap casa auth support])) ++ fi + fi + + # Append selected warning levels to CFLAGS before substitution (but after +diff --git a/contrib/ldap/README.ldap b/contrib/ldap/README.ldap +index c413790..63b839c 100644 +--- a/contrib/ldap/README.ldap ++++ b/contrib/ldap/README.ldap +@@ -83,6 +83,12 @@ options: + ldap-tls-reqcert, ldap-tls-ca-file, ldap-tls-ca-dir, ldap-tls-cert + ldap-tls-key, ldap-tls-crlcheck, ldap-tls-ciphers, ldap-tls-randfile + ++The ldap-init-retry enables an optional ldap connect retry loop with ++the specified number of retries with a one second sleep between each try ++during the initial startup of the dhcp server. ++It allows to catch the condition, that the (remote) ldap server is not yet ++started at the start time of the dhcp server. ++ + All of these parameters should be self explanatory except for the ldap-method. + You can set this to static or dynamic. If you set it to static, the + configuration is read once on startup, and LDAP isn't used anymore. But, if +diff --git a/includes/dhcpd.h b/includes/dhcpd.h +index 5830bdb..63d58e5 100644 +--- a/includes/dhcpd.h ++++ b/includes/dhcpd.h +@@ -712,6 +712,7 @@ struct lease_state { + # define SV_LDAP_TLS_CIPHERS 76 + # define SV_LDAP_TLS_RANDFILE 77 + #endif ++# define SV_LDAP_INIT_RETRY 78 + #endif + + #if !defined (DEFAULT_PING_TIMEOUT) +@@ -734,29 +735,6 @@ struct lease_state { + # define DEFAULT_MIN_ACK_DELAY_USECS 10000 /* 1/100 second */ + #endif + +-#if defined(LDAP_CONFIGURATION) +-# define SV_LDAP_SERVER 60 +-# define SV_LDAP_PORT 61 +-# define SV_LDAP_USERNAME 62 +-# define SV_LDAP_PASSWORD 63 +-# define SV_LDAP_BASE_DN 64 +-# define SV_LDAP_METHOD 65 +-# define SV_LDAP_DEBUG_FILE 66 +-# define SV_LDAP_DHCP_SERVER_CN 67 +-# define SV_LDAP_REFERRALS 68 +-#if defined (LDAP_USE_SSL) +-# define SV_LDAP_SSL 69 +-# define SV_LDAP_TLS_REQCERT 70 +-# define SV_LDAP_TLS_CA_FILE 71 +-# define SV_LDAP_TLS_CA_DIR 72 +-# define SV_LDAP_TLS_CERT 73 +-# define SV_LDAP_TLS_KEY 74 +-# define SV_LDAP_TLS_CRLCHECK 75 +-# define SV_LDAP_TLS_CIPHERS 76 +-# define SV_LDAP_TLS_RANDFILE 77 +-#endif +-#endif +- + #if !defined (DEFAULT_DEFAULT_LEASE_TIME) + # define DEFAULT_DEFAULT_LEASE_TIME 43200 + #endif +diff --git a/includes/ldap_casa.h b/includes/ldap_casa.h +new file mode 100644 +index 0000000..b1dad7f +--- /dev/null ++++ b/includes/ldap_casa.h +@@ -0,0 +1,101 @@ ++/* ldap_casa.h ++ ++ Definition for CASA modules... */ ++ ++/* Copyright (c) 2006 Novell, Inc. ++ ++ * All rights reserved. ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * 1.Redistributions of source code must retain the above copyright notice, ++ * this list of conditions and the following disclaimer. ++ * 2.Redistributions in binary form must reproduce the above copyright notice, ++ * this list of conditions and the following disclaimer in the documentation ++ * and/or other materials provided with the distribution. ++ * 3.Neither the name of ISC, ISC DHCP, nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ ++ * THIS SOFTWARE IS PROVIDED BY INTERNET SYSTEMS CONSORTIUM AND CONTRIBUTORS ++ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ISC OR CONTRIBUTORS BE LIABLE ++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, ++ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ++ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ++ * POSSIBILITY OF SUCH DAMAGE. ++ ++ * This file was written by S Kalyanasundaram ++ */ ++/* ++ * Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") ++ * Copyright (c) 1995-2003 by Internet Software Consortium ++ * ++ * Permission to use, copy, modify, and distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES ++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT ++ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ++ * ++ * Internet Systems Consortium, Inc. ++ * 950 Charter Street ++ * Redwood City, CA 94063 ++ * ++ * https://www.isc.org/ ++ */ ++ ++#if defined(LDAP_CASA_AUTH) ++#ifndef __LDAP_CASA_H__ ++#define __LDAP_CASA_H__ ++ ++#include ++ ++#define MICASA_LIB "libmicasa.so.1" ++ ++SSCS_TYPEDEF_LIBCALL(int, CASA_GetCredential_T) ++( ++ uint32_t ssFlags, ++ SSCS_SECRET_ID_T *appSecretID, ++ SSCS_SECRET_ID_T *sharedSecretID, ++ uint32_t *credentialType, ++ void *credential, ++ SSCS_EXT_T *ext ++); ++SSCS_TYPEDEF_LIBCALL(int, CASA_SetCredential_T) ++( ++ uint32_t ssFlags, ++ SSCS_SECRET_ID_T *appSecretID, ++ SSCS_SECRET_ID_T *sharedSecretID, ++ uint32_t credentialType, ++ void *credential, ++ SSCS_EXT_T *ext ++); ++ ++SSCS_TYPEDEF_LIBCALL(int, CASA_RemoveCredential_T) ++( ++ uint32_t ssFlags, ++ SSCS_SECRET_ID_T *appSecretID, ++ SSCS_SECRET_ID_T *sharedSecretID, ++ SSCS_EXT_T *ext ++); ++static CASA_GetCredential_T p_miCASAGetCredential = NULL; ++static CASA_SetCredential_T p_miCASASetCredential = NULL; ++static CASA_RemoveCredential_T p_miCASARemoveCredential = NULL; ++static void *casaIDK = NULL; ++ ++int load_casa(void); ++static void release_casa(void); ++int load_uname_pwd_from_miCASA(char **, char **); ++ ++#endif /* __LDAP_CASA_H__ */ ++#endif /* LDAP_CASA_AUTH */ ++ +diff --git a/server/Makefile.am b/server/Makefile.am +index dc5d4f3..c4c2417 100644 +--- a/server/Makefile.am ++++ b/server/Makefile.am +@@ -15,7 +15,7 @@ dhcpd_SOURCES = dhcpd.c dhcp.c bootp.c confpars.c db.c class.c failover.c \ + dhcpd_CFLAGS = $(LDAP_CFLAGS) + dhcpd_LDADD = ../common/libdhcp.a ../omapip/libomapi.a \ + ../dhcpctl/libdhcpctl.a ../bind/lib/libdns.a \ +- ../bind/lib/libisc.a ++ ../bind/lib/libisc.a $(LDAP_LIBS) + + man_MANS = dhcpd.8 dhcpd.conf.5 dhcpd.leases.5 + EXTRA_DIST = $(man_MANS) +diff --git a/server/ldap.c b/server/ldap.c +index 8a7d695..6e7f508 100644 +--- a/server/ldap.c ++++ b/server/ldap.c +@@ -40,6 +40,10 @@ + #include "dhcpd.h" + #include + #include ++#include ++#include ++#include ++#include + + #if defined(LDAP_CONFIGURATION) + +@@ -57,7 +61,9 @@ static char *ldap_server = NULL, + static int ldap_port = LDAP_PORT, + ldap_method = LDAP_METHOD_DYNAMIC, + ldap_referrals = -1, +- ldap_debug_fd = -1; ++ ldap_debug_fd = -1, ++ ldap_enable_retry = -1, ++ ldap_init_retry = -1; + #if defined (LDAP_USE_SSL) + static int ldap_use_ssl = -1, /* try TLS if possible */ + ldap_tls_reqcert = -1, +@@ -80,12 +86,269 @@ typedef struct ldap_dn_node { + static ldap_dn_node *ldap_service_dn_head = NULL; + static ldap_dn_node *ldap_service_dn_tail = NULL; + ++static int ldap_read_function (struct parse *cfile); ++ ++static struct parse * ++x_parser_init(const char *name) ++{ ++ struct parse *cfile; ++ isc_result_t res; ++ char *inbuf; ++ ++ inbuf = dmalloc (LDAP_BUFFER_SIZE, MDL); ++ if (inbuf == NULL) ++ return NULL; ++ ++ cfile = (struct parse *) NULL; ++ res = new_parse (&cfile, -1, inbuf, LDAP_BUFFER_SIZE, name, 0); ++ if (res != ISC_R_SUCCESS) ++ { ++ dfree(inbuf, MDL); ++ return NULL; ++ } ++ /* the buffer is still empty */ ++ cfile->bufsiz = LDAP_BUFFER_SIZE; ++ cfile->buflen = cfile->bufix = 0; ++ /* attach ldap read function */ ++ cfile->read_function = ldap_read_function; ++ return cfile; ++} ++ ++static isc_result_t ++x_parser_free(struct parse **cfile) ++{ ++ if (cfile && *cfile) ++ { ++ if ((*cfile)->inbuf) ++ dfree((*cfile)->inbuf, MDL); ++ (*cfile)->inbuf = NULL; ++ (*cfile)->bufsiz = 0; ++ return end_parse(cfile); ++ } ++ return ISC_R_SUCCESS; ++} ++ ++static int ++x_parser_resize(struct parse *cfile, size_t len) ++{ ++ size_t size; ++ char * temp; ++ ++ /* grow by len rounded up at LDAP_BUFFER_SIZE */ ++ size = cfile->bufsiz + (len | (LDAP_BUFFER_SIZE-1)) + 1; ++ ++ /* realloc would be better, but there isn't any */ ++ if ((temp = dmalloc (size, MDL)) != NULL) ++ { ++#if defined (DEBUG_LDAP) ++ log_info ("Reallocated %s buffer from %zu to %zu", ++ cfile->tlname, cfile->bufsiz, size); ++#endif ++ memcpy(temp, cfile->inbuf, cfile->bufsiz); ++ dfree(cfile->inbuf, MDL); ++ cfile->inbuf = temp; ++ cfile->bufsiz = size; ++ return 1; ++ } ++ ++ /* ++ * Hmm... what is worser, consider it as fatal error and ++ * bail out completely or discard config data in hope it ++ * is "only" an option in dynamic host lookup? ++ */ ++ log_error("Unable to reallocated %s buffer from %zu to %zu", ++ cfile->tlname, cfile->bufsiz, size); ++ return 0; ++} + + static char * +-x_strncat(char *dst, const char *src, size_t dst_size) ++x_parser_strcat(struct parse *cfile, const char *str) ++{ ++ size_t cur = strlen(cfile->inbuf); ++ size_t len = strlen(str); ++ size_t cnt; ++ ++ if (cur + len >= cfile->bufsiz && !x_parser_resize(cfile, len)) ++ return NULL; ++ ++ cnt = cfile->bufsiz > cur ? cfile->bufsiz - cur - 1 : 0; ++ return strncat(cfile->inbuf, str, cnt); ++} ++ ++static inline void ++x_parser_reset(struct parse *cfile) ++{ ++ cfile->inbuf[0] = '\0'; ++ cfile->bufix = cfile->buflen = 0; ++} ++ ++static inline size_t ++x_parser_length(struct parse *cfile) ++{ ++ cfile->buflen = strlen(cfile->inbuf); ++ return cfile->buflen; ++} ++ ++static char * ++x_strxform(char *dst, const char *src, size_t dst_size, ++ int (*xform)(int)) ++{ ++ if(dst && src && dst_size) ++ { ++ size_t len, pos; ++ ++ len = strlen(src); ++ for(pos=0; pos < len && pos + 1 < dst_size; pos++) ++ dst[pos] = xform((int)src[pos]); ++ dst[pos] = '\0'; ++ ++ return dst; ++ } ++ return NULL; ++} ++ ++static int ++get_host_entry(char *fqdnname, size_t fqdnname_size, ++ char *hostaddr, size_t hostaddr_size) ++{ ++#if defined(MAXHOSTNAMELEN) ++ char hname[MAXHOSTNAMELEN+1]; ++#else ++ char hname[65]; ++#endif ++ struct hostent *hp; ++ ++ if (NULL == fqdnname || 1 >= fqdnname_size) ++ return -1; ++ ++ memset(hname, 0, sizeof(hname)); ++ if (gethostname(hname, sizeof(hname)-1)) ++ return -1; ++ ++ if (NULL == (hp = gethostbyname(hname))) ++ return -1; ++ ++ strncpy(fqdnname, hp->h_name, fqdnname_size-1); ++ fqdnname[fqdnname_size-1] = '\0'; ++ ++ if (hostaddr != NULL) ++ { ++ if (hp->h_addr != NULL) ++ { ++ struct in_addr *aptr = (struct in_addr *)hp->h_addr; ++#if defined(HAVE_INET_NTOP) ++ if (hostaddr_size >= INET_ADDRSTRLEN && ++ inet_ntop(AF_INET, aptr, hostaddr, hostaddr_size) != NULL) ++ { ++ return 0; ++ } ++#else ++ char *astr = inet_ntoa(*aptr); ++ size_t alen = strlen(astr); ++ if (astr && alen > 0 && hostaddr_size > alen) ++ { ++ strncpy(hostaddr, astr, hostaddr_size-1); ++ hostaddr[hostaddr_size-1] = '\0'; ++ return 0; ++ } ++#endif ++ } ++ return -1; ++ } ++ return 0; ++} ++ ++static int ++is_iface_address(struct ifaddrs *addrs, struct in_addr *addr) + { +- size_t len = strlen(dst); +- return strncat(dst, src, dst_size > len ? dst_size - len - 1: 0); ++ struct ifaddrs *ia; ++ struct sockaddr_in *sa; ++ int num = 0; ++ ++ if(addrs == NULL || addr == NULL) ++ return -1; ++ ++ for (ia = addrs; ia != NULL; ia = ia->ifa_next) ++ { ++ ++num; ++ if (ia->ifa_addr && (ia->ifa_flags & IFF_UP) && ++ ia->ifa_addr->sa_family == AF_INET) ++ { ++ sa = (struct sockaddr_in *)(ia->ifa_addr); ++ if (addr->s_addr == sa->sin_addr.s_addr) ++ return num; ++ } ++ } ++ return 0; ++} ++ ++static int ++get_host_address(const char *hostname, char *hostaddr, size_t hostaddr_size, struct ifaddrs *addrs) ++{ ++ if (hostname && *hostname && hostaddr && hostaddr_size) ++ { ++ struct in_addr addr; ++ ++#if defined(HAVE_INET_PTON) ++ if (inet_pton(AF_INET, hostname, &addr) == 1) ++#else ++ if (inet_aton(hostname, &addr) != 0) ++#endif ++ { ++ /* it is already IP address string */ ++ if(strlen(hostname) < hostaddr_size) ++ { ++ strncpy(hostaddr, hostname, hostaddr_size-1); ++ hostaddr[hostaddr_size-1] = '\0'; ++ ++ if (addrs != NULL && is_iface_address (addrs, &addr) > 0) ++ return 1; ++ else ++ return 0; ++ } ++ } ++ else ++ { ++ struct hostent *hp; ++ if ((hp = gethostbyname(hostname)) != NULL && hp->h_addr != NULL) ++ { ++ struct in_addr *aptr = (struct in_addr *)hp->h_addr; ++ int mret = 0; ++ ++ if (addrs != NULL) ++ { ++ char **h; ++ for (h=hp->h_addr_list; *h; h++) ++ { ++ struct in_addr *haddr = (struct in_addr *)*h; ++ if (is_iface_address (addrs, haddr) > 0) ++ { ++ aptr = haddr; ++ mret = 1; ++ } ++ } ++ } ++ ++#if defined(HAVE_INET_NTOP) ++ if (hostaddr_size >= INET_ADDRSTRLEN && ++ inet_ntop(AF_INET, aptr, hostaddr, hostaddr_size) != NULL) ++ { ++ return mret; ++ } ++#else ++ char *astr = inet_ntoa(*aptr); ++ size_t alen = strlen(astr); ++ if (astr && alen > 0 && alen < hostaddr_size) ++ { ++ strncpy(hostaddr, astr, hostaddr_size-1); ++ hostaddr[hostaddr_size-1] = '\0'; ++ return mret; ++ } ++#endif ++ } ++ } ++ } ++ return -1; + } + + static void +@@ -102,19 +365,52 @@ ldap_parse_class (struct ldap_config_stack *item, struct parse *cfile) + return; + } + +- x_strncat (cfile->inbuf, "class \"", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, tempbv[0]->bv_val, LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, "\" {\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "class \""); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, "\" {\n"); + + item->close_brace = 1; + ldap_value_free_len (tempbv); + } + ++static int ++is_hex_string(const char *str) ++{ ++ int colon = 1; ++ int xdigit = 0; ++ size_t i; ++ ++ if (!str) ++ return 0; ++ ++ if (*str == '-') ++ str++; ++ ++ for (i=0; str[i]; ++i) ++ { ++ if (str[i] == ':') ++ { ++ xdigit = 0; ++ if(++colon > 1) ++ return 0; ++ } ++ else if(isxdigit((unsigned char)str[i])) ++ { ++ colon = 0; ++ if (++xdigit > 2) ++ return 0; ++ } ++ else ++ return 0; ++ } ++ return i > 0 && !colon; ++} + + static void + ldap_parse_subclass (struct ldap_config_stack *item, struct parse *cfile) + { + struct berval **tempbv, **classdata; ++ char *tmp; + + if ((tempbv = ldap_get_values_len (ld, item->ldent, "cn")) == NULL || + tempbv[0] == NULL) +@@ -136,11 +432,22 @@ ldap_parse_subclass (struct ldap_config_stack *item, struct parse *cfile) + return; + } + +- x_strncat (cfile->inbuf, "subclass ", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, classdata[0]->bv_val, LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, " ", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, tempbv[0]->bv_val, LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, " {\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "subclass \""); ++ x_parser_strcat (cfile, classdata[0]->bv_val); ++ if (is_hex_string(tempbv[0]->bv_val)) ++ { ++ x_parser_strcat (cfile, "\" "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, " {\n"); ++ } ++ else ++ { ++ tmp = quotify_string(tempbv[0]->bv_val, MDL); ++ x_parser_strcat (cfile, "\" \""); ++ x_parser_strcat (cfile, tmp); ++ x_parser_strcat (cfile, "\" {\n"); ++ dfree(tmp, MDL); ++ } + + item->close_brace = 1; + ldap_value_free_len (tempbv); +@@ -164,14 +471,18 @@ ldap_parse_host (struct ldap_config_stack *item, struct parse *cfile) + + hwaddr = ldap_get_values_len (ld, item->ldent, "dhcpHWAddress"); + +- x_strncat (cfile->inbuf, "host ", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, tempbv[0]->bv_val, LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "host "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, " {\n"); + +- if (hwaddr != NULL && hwaddr[0] != NULL) ++ if (hwaddr != NULL) + { +- x_strncat (cfile->inbuf, " {\nhardware ", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, hwaddr[0]->bv_val, LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE); ++ if (hwaddr[0] != NULL) ++ { ++ x_parser_strcat (cfile, "hardware "); ++ x_parser_strcat (cfile, hwaddr[0]->bv_val); ++ x_parser_strcat (cfile, ";\n"); ++ } + ldap_value_free_len (hwaddr); + } + +@@ -194,9 +505,9 @@ ldap_parse_shared_network (struct ldap_config_stack *item, struct parse *cfile) + return; + } + +- x_strncat (cfile->inbuf, "shared-network \"", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, tempbv[0]->bv_val, LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, "\" {\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "shared-network \""); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, "\" {\n"); + + item->close_brace = 1; + ldap_value_free_len (tempbv); +@@ -249,14 +560,14 @@ ldap_parse_subnet (struct ldap_config_stack *item, struct parse *cfile) + return; + } + +- x_strncat (cfile->inbuf, "subnet ", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, tempbv[0]->bv_val, LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "subnet "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); + +- x_strncat (cfile->inbuf, " netmask ", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, " netmask "); + parse_netmask (strtol (netmaskstr[0]->bv_val, NULL, 10), netmaskbuf); +- x_strncat (cfile->inbuf, netmaskbuf, LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, netmaskbuf); + +- x_strncat (cfile->inbuf, " {\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, " {\n"); + + ldap_value_free_len (tempbv); + ldap_value_free_len (netmaskstr); +@@ -265,11 +576,12 @@ ldap_parse_subnet (struct ldap_config_stack *item, struct parse *cfile) + { + for (i=0; tempbv[i] != NULL; i++) + { +- x_strncat (cfile->inbuf, "range", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, " ", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, tempbv[i]->bv_val, LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "range"); ++ x_parser_strcat (cfile, " "); ++ x_parser_strcat (cfile, tempbv[i]->bv_val); ++ x_parser_strcat (cfile, ";\n"); + } ++ ldap_value_free_len (tempbv); + } + + item->close_brace = 1; +@@ -282,17 +594,17 @@ ldap_parse_pool (struct ldap_config_stack *item, struct parse *cfile) + struct berval **tempbv; + int i; + +- x_strncat (cfile->inbuf, "pool {\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "pool {\n"); + + if ((tempbv = ldap_get_values_len (ld, item->ldent, "dhcpRange")) != NULL) + { +- x_strncat (cfile->inbuf, "range", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "range"); + for (i=0; tempbv[i] != NULL; i++) + { +- x_strncat (cfile->inbuf, " ", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, tempbv[i]->bv_val, LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, " "); ++ x_parser_strcat (cfile, tempbv[i]->bv_val); + } +- x_strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, ";\n"); + ldap_value_free_len (tempbv); + } + +@@ -300,8 +612,8 @@ ldap_parse_pool (struct ldap_config_stack *item, struct parse *cfile) + { + for (i=0; tempbv[i] != NULL; i++) + { +- x_strncat (cfile->inbuf, tempbv[i]->bv_val, LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, tempbv[i]->bv_val); ++ x_parser_strcat (cfile, ";\n"); + } + ldap_value_free_len (tempbv); + } +@@ -313,7 +625,7 @@ ldap_parse_pool (struct ldap_config_stack *item, struct parse *cfile) + static void + ldap_parse_group (struct ldap_config_stack *item, struct parse *cfile) + { +- x_strncat (cfile->inbuf, "group {\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "group {\n"); + item->close_brace = 1; + } + +@@ -325,25 +637,25 @@ ldap_parse_key (struct ldap_config_stack *item, struct parse *cfile) + + if ((tempbv = ldap_get_values_len (ld, item->ldent, "cn")) != NULL) + { +- x_strncat (cfile->inbuf, "key ", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, tempbv[0]->bv_val, LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, " {\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "key "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, " {\n"); + ldap_value_free_len (tempbv); + } + + if ((tempbv = ldap_get_values_len (ld, item->ldent, "dhcpKeyAlgorithm")) != NULL) + { +- x_strncat (cfile->inbuf, "algorithm ", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, tempbv[0]->bv_val, LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "algorithm "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, ";\n"); + ldap_value_free_len (tempbv); + } + + if ((tempbv = ldap_get_values_len (ld, item->ldent, "dhcpKeySecret")) != NULL) + { +- x_strncat (cfile->inbuf, "secret ", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, tempbv[0]->bv_val, LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "secret "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, ";\n"); + ldap_value_free_len (tempbv); + } + +@@ -361,18 +673,18 @@ ldap_parse_zone (struct ldap_config_stack *item, struct parse *cfile) + + if ((tempbv = ldap_get_values_len (ld, item->ldent, "cn")) != NULL) + { +- x_strncat (cfile->inbuf, "zone ", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, tempbv[0]->bv_val, LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, " {\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "zone "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, " {\n"); + ldap_value_free_len (tempbv); + } + + if ((tempbv = ldap_get_values_len (ld, item->ldent, "dhcpDnsZoneServer")) != NULL) + { +- x_strncat (cfile->inbuf, "primary ", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, tempbv[0]->bv_val, LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "primary "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); + +- x_strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, ";\n"); + ldap_value_free_len (tempbv); + } + +@@ -400,9 +712,9 @@ ldap_parse_zone (struct ldap_config_stack *item, struct parse *cfile) + strncpy (keyCn, cnFindStart, len); + keyCn[len] = '\0'; + +- x_strncat (cfile->inbuf, "key ", LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, keyCn, LDAP_BUFFER_SIZE); +- x_strncat (cfile->inbuf, ";\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "key "); ++ x_parser_strcat (cfile, keyCn); ++ x_parser_strcat (cfile, ";\n"); + + dfree (keyCn, MDL); + } +@@ -415,6 +727,228 @@ ldap_parse_zone (struct ldap_config_stack *item, struct parse *cfile) + + + static void ++ldap_parse_failover (struct ldap_config_stack *item, struct parse *cfile) ++{ ++ struct berval **tempbv, **peername; ++ struct ifaddrs *addrs = NULL; ++ char srvaddr[2][64] = {"\0", "\0"}; ++ int primary, split = 0, match; ++ struct utsname unme; ++ ++ if ((peername = ldap_get_values_len (ld, item->ldent, "cn")) == NULL || ++ peername[0] == NULL) ++ { ++ if (peername != NULL) ++ ldap_value_free_len (peername); ++ ++ // ldap with disabled schema checks? fail to avoid syntax error. ++ log_error("Unable to find mandatory failover peering name attribute"); ++ return; ++ } ++ ++ /* Get all interface addresses */ ++ getifaddrs(&addrs); ++ ++ /* ++ ** when dhcpFailOverPrimaryServer or dhcpFailOverSecondaryServer ++ ** matches one of our IP address, the following valiables are set: ++ ** - primary is 1 when we are primary or 0 when we are secondary ++ ** - srvaddr[0] contains ip address of the primary ++ ** - srvaddr[1] contains ip address of the secondary ++ */ ++ primary = -1; ++ if ((tempbv = ldap_get_values_len (ld, item->ldent, "dhcpFailOverPrimaryServer")) != NULL && ++ tempbv[0] != NULL) ++ { ++ match = get_host_address (tempbv[0]->bv_val, srvaddr[0], sizeof(srvaddr[0]), addrs); ++ if (match >= 0) ++ { ++ /* we are the primary */ ++ if (match > 0) ++ primary = 1; ++ } ++ else ++ { ++ log_info("Can't resolve address of the primary failover '%s' server %s", ++ peername[0]->bv_val, tempbv[0]->bv_val); ++ ldap_value_free_len (tempbv); ++ ldap_value_free_len (peername); ++ if (addrs) ++ freeifaddrs(addrs); ++ return; ++ } ++ } ++ if (tempbv != NULL) ++ ldap_value_free_len (tempbv); ++ ++ if ((tempbv = ldap_get_values_len (ld, item->ldent, "dhcpFailOverSecondaryServer")) != NULL && ++ tempbv[0] != NULL) ++ { ++ match = get_host_address (tempbv[0]->bv_val, srvaddr[1], sizeof(srvaddr[1]), addrs); ++ if (match >= 0) ++ { ++ if (match > 0) ++ { ++ if (primary == 1) ++ { ++ log_info("Both, primary and secondary failover '%s' server" ++ " attributes match our local address", peername[0]->bv_val); ++ ldap_value_free_len (tempbv); ++ ldap_value_free_len (peername); ++ if (addrs) ++ freeifaddrs(addrs); ++ return; ++ } ++ ++ /* we are the secondary */ ++ primary = 0; ++ } ++ } ++ else ++ { ++ log_info("Can't resolve address of the secondary failover '%s' server %s", ++ peername[0]->bv_val, tempbv[0]->bv_val); ++ ldap_value_free_len (tempbv); ++ ldap_value_free_len (peername); ++ if (addrs) ++ freeifaddrs(addrs); ++ return; ++ } ++ } ++ if (tempbv != NULL) ++ ldap_value_free_len (tempbv); ++ ++ ++ if (primary == -1 || srvaddr[0] == '\0' || srvaddr[1] == '\0') ++ { ++ log_error("Could not decide if the server type is primary" ++ " or secondary for failover peering '%s'.", peername[0]->bv_val); ++ ldap_value_free_len (peername); ++ if (addrs) ++ freeifaddrs(addrs); ++ return; ++ } ++ ++ x_parser_strcat (cfile, "failover peer \""); ++ x_parser_strcat (cfile, peername[0]->bv_val); ++ x_parser_strcat (cfile, "\" {\n"); ++ ++ if (primary) ++ x_parser_strcat (cfile, "primary;\n"); ++ else ++ x_parser_strcat (cfile, "secondary;\n"); ++ ++ x_parser_strcat (cfile, "address "); ++ if (primary) ++ x_parser_strcat (cfile, srvaddr[0]); ++ else ++ x_parser_strcat (cfile, srvaddr[1]); ++ x_parser_strcat (cfile, ";\n"); ++ ++ x_parser_strcat (cfile, "peer address "); ++ if (primary) ++ x_parser_strcat (cfile, srvaddr[1]); ++ else ++ x_parser_strcat (cfile, srvaddr[0]); ++ x_parser_strcat (cfile, ";\n"); ++ ++ if ((tempbv = ldap_get_values_len (ld, item->ldent, "dhcpFailOverPrimaryPort")) != NULL && ++ tempbv[0] != NULL) ++ { ++ if (primary) ++ x_parser_strcat (cfile, "port "); ++ else ++ x_parser_strcat (cfile, "peer port "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, ";\n"); ++ } ++ if (tempbv != NULL) ++ ldap_value_free_len (tempbv); ++ ++ if ((tempbv = ldap_get_values_len (ld, item->ldent, "dhcpFailOverSecondaryPort")) != NULL && ++ tempbv[0] != NULL) ++ { ++ if (primary) ++ x_parser_strcat (cfile, "peer port "); ++ else ++ x_parser_strcat (cfile, "port "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, ";\n"); ++ } ++ if (tempbv != NULL) ++ ldap_value_free_len (tempbv); ++ ++ if ((tempbv = ldap_get_values_len (ld, item->ldent, "dhcpFailOverResponseDelay")) != NULL && ++ tempbv[0] != NULL) ++ { ++ x_parser_strcat (cfile, "max-response-delay "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, ";\n"); ++ } ++ if (tempbv != NULL) ++ ldap_value_free_len (tempbv); ++ ++ if ((tempbv = ldap_get_values_len (ld, item->ldent, "dhcpFailOverUnackedUpdates")) != NULL && ++ tempbv[0] != NULL) ++ { ++ x_parser_strcat (cfile, "max-unacked-updates "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, ";\n"); ++ } ++ if (tempbv != NULL) ++ ldap_value_free_len (tempbv); ++ ++ if ((tempbv = ldap_get_values_len (ld, item->ldent, "dhcpFailOverLoadBalanceTime")) != NULL && ++ tempbv[0] != NULL) ++ { ++ x_parser_strcat (cfile, "load balance max seconds "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, ";\n"); ++ } ++ if (tempbv != NULL) ++ ldap_value_free_len (tempbv); ++ ++ tempbv = NULL; ++ if (primary && ++ (tempbv = ldap_get_values_len (ld, item->ldent, "dhcpMaxClientLeadTime")) != NULL && ++ tempbv[0] != NULL) ++ { ++ x_parser_strcat (cfile, "mclt "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, ";\n"); ++ } ++ if (tempbv != NULL) ++ ldap_value_free_len (tempbv); ++ ++ tempbv = NULL; ++ if (primary && ++ (tempbv = ldap_get_values_len (ld, item->ldent, "dhcpFailOverSplit")) != NULL && ++ tempbv[0] != NULL) ++ { ++ x_parser_strcat (cfile, "split "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, ";\n"); ++ split = 1; ++ } ++ if (tempbv != NULL) ++ ldap_value_free_len (tempbv); ++ ++ tempbv = NULL; ++ if (primary && !split && ++ (tempbv = ldap_get_values_len (ld, item->ldent, "dhcpFailOverHashBucketAssignment")) != NULL && ++ tempbv[0] != NULL) ++ { ++ x_parser_strcat (cfile, "hba "); ++ x_parser_strcat (cfile, tempbv[0]->bv_val); ++ x_parser_strcat (cfile, ";\n"); ++ } ++ if (tempbv != NULL) ++ ldap_value_free_len (tempbv); ++ ++ item->close_brace = 1; ++} ++ ++static void + add_to_config_stack (LDAPMessage * res, LDAPMessage * ent) + { + struct ldap_config_stack *ns; +@@ -428,7 +962,6 @@ add_to_config_stack (LDAPMessage * res, LDAPMessage * ent) + ldap_stack = ns; + } + +- + static void + ldap_stop() + { +@@ -570,6 +1103,7 @@ ldap_rebind_cb (LDAP *ld, LDAP_CONST char *url, ber_tag_t request, ber_int_t msg + { + log_error ("Error: Cannot init LDAPS session to %s:%d: %s", + ldapurl->lud_host, ldapurl->lud_port, ldap_err2string (ret)); ++ ldap_free_urldesc(ldapurl); + return ret; + } + else +@@ -585,6 +1119,7 @@ ldap_rebind_cb (LDAP *ld, LDAP_CONST char *url, ber_tag_t request, ber_int_t msg + { + log_error ("Error: Cannot start TLS session to %s:%d: %s", + ldapurl->lud_host, ldapurl->lud_port, ldap_err2string (ret)); ++ ldap_free_urldesc(ldapurl); + return ret; + } + else +@@ -609,9 +1144,40 @@ ldap_rebind_cb (LDAP *ld, LDAP_CONST char *url, ber_tag_t request, ber_int_t msg + log_error ("Error: Cannot login into ldap server %s:%d: %s", + ldapurl->lud_host, ldapurl->lud_port, ldap_err2string (ret)); + } ++ ldap_free_urldesc(ldapurl); + return ret; + } + ++static int ++_do_ldap_retry(int ret, const char *server, int port) ++{ ++ static int inform = 1; ++ ++ if (ldap_enable_retry > 0 && ret == LDAP_SERVER_DOWN && ldap_init_retry > 0) ++ { ++ if (inform || (ldap_init_retry % 10) == 0) ++ { ++ inform = 0; ++ log_info ("Can't contact LDAP server %s:%d: retrying for %d sec", ++ server, port, ldap_init_retry); ++ } ++ sleep(1); ++ return ldap_init_retry--; ++ } ++ return 0; ++} ++ ++static struct berval * ++_do_ldap_str2esc_filter_bv(const char *str, ber_len_t len, struct berval *bv_o) ++{ ++ struct berval bv_i; ++ ++ if (!str || !bv_o || (ber_str2bv(str, len, 0, &bv_i) == NULL) || ++ (ldap_bv2escaped_filter_value(&bv_i, bv_o) != 0)) ++ return NULL; ++ return bv_o; ++} ++ + static void + ldap_start (void) + { +@@ -642,6 +1208,7 @@ ldap_start (void) + ldap_debug_file = _do_lookup_dhcp_string_option (options, + SV_LDAP_DEBUG_FILE); + ldap_referrals = _do_lookup_dhcp_enum_option (options, SV_LDAP_REFERRALS); ++ ldap_init_retry = _do_lookup_dhcp_int_option (options, SV_LDAP_INIT_RETRY); + + #if defined (LDAP_USE_SSL) + ldap_use_ssl = _do_lookup_dhcp_enum_option (options, SV_LDAP_SSL); +@@ -854,7 +1421,13 @@ ldap_start (void) + } + else if (ldap_use_ssl != LDAP_SSL_OFF) + { +- if ((ret = ldap_start_tls_s (ld, NULL, NULL)) != LDAP_SUCCESS) ++ do ++ { ++ ret = ldap_start_tls_s (ld, NULL, NULL); ++ } ++ while(_do_ldap_retry(ret, ldap_server, ldap_port) > 0); ++ ++ if (ret != LDAP_SUCCESS) + { + log_error ("Error: Cannot start TLS session to %s:%d: %s", + ldap_server, ldap_port, ldap_err2string (ret)); +@@ -874,8 +1447,14 @@ ldap_start (void) + creds.bv_val = strdup(ldap_password); + creds.bv_len = strlen(ldap_password); + +- if ((ret = ldap_sasl_bind_s (ld, ldap_username, LDAP_SASL_SIMPLE, +- &creds, NULL, NULL, NULL)) != LDAP_SUCCESS) ++ do ++ { ++ ret = ldap_sasl_bind_s (ld, ldap_username, LDAP_SASL_SIMPLE, ++ &creds, NULL, NULL, NULL); ++ } ++ while(_do_ldap_retry(ret, ldap_server, ldap_port) > 0); ++ ++ if (ret != LDAP_SUCCESS) + { + log_error ("Error: Cannot login into ldap server %s:%d: %s", + ldap_server, ldap_port, ldap_err2string (ret)); +@@ -895,7 +1474,15 @@ parse_external_dns (LDAPMessage * ent) + { + char *search[] = {"dhcpOptionsDN", "dhcpSharedNetworkDN", "dhcpSubnetDN", + "dhcpGroupDN", "dhcpHostDN", "dhcpClassesDN", +- "dhcpPoolDN", NULL}; ++ "dhcpPoolDN", "dhcpZoneDN", "dhcpFailOverPeerDN", NULL}; ++ ++ /* TODO: dhcpKeyDN can't be added. It is referenced in dhcpDnsZone to ++ retrive the key name (cn). Adding keyDN will reflect adding a key ++ declaration inside the zone configuration. ++ ++ dhcpSubClassesDN cant be added. It is also similar to the above. ++ Needs schema change. ++ */ + LDAPMessage * newres, * newent; + struct berval **tempbv; + int i, j, ret; +@@ -935,7 +1522,7 @@ parse_external_dns (LDAPMessage * ent) + } + + #if defined (DEBUG_LDAP) +- log_info ("Adding contents of subtree '%s' to config stack from '%s' reference", tempbv[j], search[i]); ++ log_info ("Adding contents of subtree '%s' to config stack from '%s' reference", tempbv[j]->bv_val, search[i]); + #endif + for (newent = ldap_first_entry (ld, newres); + newent != NULL; +@@ -990,17 +1577,17 @@ next_ldap_entry (struct parse *cfile) + + if (ldap_stack != NULL && ldap_stack->close_brace) + { +- x_strncat (cfile->inbuf, "}\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "}\n"); + ldap_stack->close_brace = 0; + } + + while (ldap_stack != NULL && +- (ldap_stack->ldent == NULL || +- (ldap_stack->ldent = ldap_next_entry (ld, ldap_stack->ldent)) == NULL)) ++ (ldap_stack->ldent == NULL || ( ldap_stack->processed && ++ (ldap_stack->ldent = ldap_next_entry (ld, ldap_stack->ldent)) == NULL))) + { + if (ldap_stack->close_brace) + { +- x_strncat (cfile->inbuf, "}\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "}\n"); + ldap_stack->close_brace = 0; + } + +@@ -1011,7 +1598,7 @@ next_ldap_entry (struct parse *cfile) + + if (ldap_stack != NULL && ldap_stack->close_brace) + { +- x_strncat (cfile->inbuf, "}\n", LDAP_BUFFER_SIZE); ++ x_parser_strcat (cfile, "}\n"); + ldap_stack->close_brace = 0; + } + } +@@ -1067,13 +1654,13 @@ check_statement_end (const char *statement) + + + static isc_result_t +-ldap_parse_entry_options (LDAPMessage *ent, char *buffer, size_t size, ++ldap_parse_entry_options (LDAPMessage *ent, struct parse *cfile, + int *lease_limit) + { + struct berval **tempbv; + int i; + +- if (ent == NULL || buffer == NULL || size == 0) ++ if (ent == NULL || cfile == NULL) + return (ISC_R_FAILURE); + + if ((tempbv = ldap_get_values_len (ld, ent, "dhcpStatements")) != NULL) +@@ -1087,16 +1674,16 @@ ldap_parse_entry_options (LDAPMessage *ent, char *buffer, size_t size, + continue; + } + +- x_strncat (buffer, tempbv[i]->bv_val, size); ++ x_parser_strcat (cfile, tempbv[i]->bv_val); + + switch((int) check_statement_end (tempbv[i]->bv_val)) + { + case '}': + case ';': +- x_strncat (buffer, "\n", size); ++ x_parser_strcat (cfile, "\n"); + break; + default: +- x_strncat (buffer, ";\n", size); ++ x_parser_strcat (cfile, ";\n"); + break; + } + } +@@ -1107,15 +1694,15 @@ ldap_parse_entry_options (LDAPMessage *ent, char *buffer, size_t size, + { + for (i=0; tempbv[i] != NULL; i++) + { +- x_strncat (buffer, "option ", size); +- x_strncat (buffer, tempbv[i]->bv_val, size); ++ x_parser_strcat (cfile, "option "); ++ x_parser_strcat (cfile, tempbv[i]->bv_val); + switch ((int) check_statement_end (tempbv[i]->bv_val)) + { + case ';': +- x_strncat (buffer, "\n", size); ++ x_parser_strcat (cfile, "\n"); + break; + default: +- x_strncat (buffer, ";\n", size); ++ x_parser_strcat (cfile, ";\n"); + break; + } + } +@@ -1132,9 +1719,10 @@ ldap_generate_config_string (struct parse *cfile) + struct berval **objectClass; + char *dn; + struct ldap_config_stack *entry; +- LDAPMessage * ent, * res; ++ LDAPMessage * ent, * res, *entfirst, *resfirst; + int i, ignore, found; +- int ret; ++ int ret, parsedn = 1; ++ size_t len = cfile->buflen; + + if (ld == NULL) + ldap_start (); +@@ -1145,7 +1733,8 @@ ldap_generate_config_string (struct parse *cfile) + if ((objectClass = ldap_get_values_len (ld, entry->ldent, + "objectClass")) == NULL) + return; +- ++ ++ entry->processed = 1; + ignore = 0; + found = 1; + for (i=0; objectClass[i] != NULL; i++) +@@ -1164,6 +1753,8 @@ ldap_generate_config_string (struct parse *cfile) + ldap_parse_key (entry, cfile); + else if (strcasecmp (objectClass[i]->bv_val, "dhcpDnsZone") == 0) + ldap_parse_zone (entry, cfile); ++ else if (strcasecmp (objectClass[i]->bv_val, "dhcpFailOverPeer") == 0) ++ ldap_parse_failover (entry, cfile); + else if (strcasecmp (objectClass[i]->bv_val, "dhcpHost") == 0) + { + if (ldap_method == LDAP_METHOD_STATIC) +@@ -1187,7 +1778,7 @@ ldap_generate_config_string (struct parse *cfile) + else + found = 0; + +- if (found && cfile->inbuf[0] == '\0') ++ if (found && x_parser_length(cfile) <= len) + { + ignore = 1; + break; +@@ -1202,23 +1793,36 @@ ldap_generate_config_string (struct parse *cfile) + return; + } + +- ldap_parse_entry_options(entry->ldent, cfile->inbuf, +- LDAP_BUFFER_SIZE-1, NULL); ++ ldap_parse_entry_options(entry->ldent, cfile, NULL); + + dn = ldap_get_dn (ld, entry->ldent); +- ++ if (dn == NULL) ++ { ++ ldap_stop(); ++ return; ++ } + #if defined(DEBUG_LDAP) +- if (dn != NULL) +- log_info ("Found LDAP entry '%s'", dn); ++ log_info ("Found LDAP entry '%s'", dn); + #endif + +- if (dn == NULL || +- (ret = ldap_search_ext_s (ld, dn, LDAP_SCOPE_ONELEVEL, +- "objectClass=*", NULL, 0, NULL, NULL, ++ if ((ret = ldap_search_ext_s (ld, dn, LDAP_SCOPE_ONELEVEL, ++ "(!(|(|(objectClass=dhcpTSigKey)(objectClass=dhcpClass)) (objectClass=dhcpFailOverPeer)))", ++ NULL, 0, NULL, NULL, + NULL, 0, &res)) != LDAP_SUCCESS) + { +- if (dn) +- ldap_memfree (dn); ++ ldap_memfree (dn); ++ ++ ldap_stop(); ++ return; ++ } ++ ++ if ((ret = ldap_search_ext_s (ld, dn, LDAP_SCOPE_ONELEVEL, ++ "(|(|(objectClass=dhcpTSigKey)(objectClass=dhcpClass)) (objectClass=dhcpFailOverPeer))", ++ NULL, 0, NULL, NULL, ++ NULL, 0, &resfirst)) != LDAP_SUCCESS) ++ { ++ ldap_memfree (dn); ++ ldap_msgfree (res); + + ldap_stop(); + return; +@@ -1226,17 +1830,33 @@ ldap_generate_config_string (struct parse *cfile) + + ldap_memfree (dn); + +- if ((ent = ldap_first_entry (ld, res)) != NULL) ++ ent = ldap_first_entry(ld, res); ++ entfirst = ldap_first_entry(ld, resfirst); ++ ++ if (ent == NULL && entfirst == NULL) ++ { ++ parse_external_dns (entry->ldent); ++ next_ldap_entry (cfile); ++ } ++ ++ if (ent != NULL) + { + add_to_config_stack (res, ent); + parse_external_dns (entry->ldent); ++ parsedn = 0; + } + else ++ ldap_msgfree (res); ++ ++ if (entfirst != NULL) + { +- ldap_msgfree (res); +- parse_external_dns (entry->ldent); +- next_ldap_entry (cfile); ++ add_to_config_stack (resfirst, entfirst); ++ if(parsedn) ++ parse_external_dns (entry->ldent); ++ + } ++ else ++ ldap_msgfree (resfirst); + } + + +@@ -1269,25 +1889,30 @@ ldap_write_debug (const void *buff, size_t size) + static int + ldap_read_function (struct parse *cfile) + { +- cfile->inbuf[0] = '\0'; +- cfile->buflen = 0; +- +- while (ldap_stack != NULL && *cfile->inbuf == '\0') ++ size_t len; ++ ++ /* append when in saved state */ ++ if (cfile->saved_state == NULL) ++ { ++ cfile->inbuf[0] = '\0'; ++ cfile->bufix = 0; ++ cfile->buflen = 0; ++ } ++ len = cfile->buflen; ++ ++ while (ldap_stack != NULL && x_parser_length(cfile) <= len) + ldap_generate_config_string (cfile); + +- if (ldap_stack == NULL && *cfile->inbuf == '\0') ++ if (x_parser_length(cfile) <= len && ldap_stack == NULL) + return (EOF); + +- cfile->bufix = 1; +- cfile->buflen = strlen (cfile->inbuf) - 1; +- if (cfile->buflen > 0) +- ldap_write_debug (cfile->inbuf, cfile->buflen); +- ++ if (cfile->buflen > len) ++ ldap_write_debug (cfile->inbuf + len, cfile->buflen - len); + #if defined (DEBUG_LDAP) +- log_info ("Sending config line '%s'", cfile->inbuf); ++ log_info ("Sending config portion '%s'", cfile->inbuf + len); + #endif + +- return (cfile->inbuf[0]); ++ return (cfile->inbuf[cfile->bufix++]); + } + + +@@ -1322,38 +1947,12 @@ ldap_get_host_name (LDAPMessage * ent) + } + + +-static int +-getfqhostname(char *fqhost, size_t size) +-{ +-#if defined(MAXHOSTNAMELEN) +- char hname[MAXHOSTNAMELEN]; +-#else +- char hname[65]; +-#endif +- struct hostent *hp; +- +- if(NULL == fqhost || 1 >= size) +- return -1; +- +- memset(hname, 0, sizeof(hname)); +- if( gethostname(hname, sizeof(hname)-1)) +- return -1; +- +- if(NULL == (hp = gethostbyname(hname))) +- return -1; +- +- strncpy(fqhost, hp->h_name, size-1); +- fqhost[size-1] = '\0'; +- return 0; +-} +- +- + isc_result_t + ldap_read_config (void) + { + LDAPMessage * ldres, * hostres, * ent, * hostent; + char hfilter[1024], sfilter[1024], fqdn[257]; +- char *buffer, *hostdn; ++ char *hostdn; + ldap_dn_node *curr = NULL; + struct parse *cfile; + struct utsname unme; +@@ -1361,52 +1960,95 @@ ldap_read_config (void) + size_t length; + int ret, cnt; + struct berval **tempbv = NULL; ++ struct berval bv_o[2]; + ++ if (local_family != AF_INET) ++ return (ISC_R_SUCCESS); ++ ++ cfile = x_parser_init("LDAP"); ++ if (cfile == NULL) ++ return (ISC_R_NOMEMORY); ++ ++ ldap_enable_retry = 1; + if (ld == NULL) + ldap_start (); ++ ldap_enable_retry = 0; ++ + if (ld == NULL) +- return (ldap_server == NULL ? ISC_R_SUCCESS : ISC_R_FAILURE); +- +- buffer = dmalloc (LDAP_BUFFER_SIZE+1, MDL); +- if (buffer == NULL) +- return (ISC_R_FAILURE); ++ { ++ x_parser_free(&cfile); ++ return (ldap_server == NULL ? ISC_R_SUCCESS : ISC_R_FAILURE); ++ } + +- cfile = (struct parse *) NULL; +- res = new_parse (&cfile, -1, buffer, LDAP_BUFFER_SIZE, "LDAP", 0); +- if (res != ISC_R_SUCCESS) +- return (res); +- + uname (&unme); + if (ldap_dhcp_server_cn != NULL) + { ++ if (_do_ldap_str2esc_filter_bv(ldap_dhcp_server_cn, 0, &bv_o[0]) == NULL) ++ { ++ log_error ("Cannot escape ldap filter value %s: %m", ldap_dhcp_server_cn); ++ x_parser_free(&cfile); ++ return (ISC_R_FAILURE); ++ } ++ + snprintf (hfilter, sizeof (hfilter), +- "(&(objectClass=dhcpServer)(cn=%s))", ldap_dhcp_server_cn); ++ "(&(objectClass=dhcpServer)(cn=%s))", bv_o[0].bv_val); ++ ++ ber_memfree(bv_o[0].bv_val); + } + else +- { +- if(0 == getfqhostname(fqdn, sizeof(fqdn))) + { +- snprintf (hfilter, sizeof (hfilter), +- "(&(objectClass=dhcpServer)(|(cn=%s)(cn=%s)))", +- unme.nodename, fqdn); ++ if (_do_ldap_str2esc_filter_bv(unme.nodename, 0, &bv_o[0]) == NULL) ++ { ++ log_error ("Cannot escape ldap filter value %s: %m", unme.nodename); ++ x_parser_free(&cfile); ++ return (ISC_R_FAILURE); ++ } ++ ++ if(0 == get_host_entry(fqdn, sizeof(fqdn), NULL, 0)) ++ { ++ if (_do_ldap_str2esc_filter_bv(fqdn, 0, &bv_o[1]) == NULL) ++ { ++ log_error ("Cannot escape ldap filter value %s: %m", fqdn); ++ ber_memfree(bv_o[0].bv_val); ++ x_parser_free(&cfile); ++ return (ISC_R_FAILURE); ++ } ++ ++ snprintf (hfilter, sizeof (hfilter), ++ "(&(objectClass=dhcpServer)(|(cn=%s)(cn=%s)))", ++ bv_o[0].bv_val, bv_o[1].bv_val); ++ ++ ber_memfree(bv_o[1].bv_val); ++ } ++ else ++ { ++ snprintf (hfilter, sizeof (hfilter), ++ "(&(objectClass=dhcpServer)(cn=%s))", ++ bv_o[0].bv_val); ++ } ++ ++ ber_memfree(bv_o[0].bv_val); + } +- else ++ ++ ldap_enable_retry = 1; ++ do + { +- snprintf (hfilter, sizeof (hfilter), +- "(&(objectClass=dhcpServer)(cn=%s))", unme.nodename); ++ hostres = NULL; ++ ret = ldap_search_ext_s (ld, ldap_base_dn, LDAP_SCOPE_SUBTREE, ++ hfilter, NULL, 0, NULL, NULL, NULL, 0, ++ &hostres); + } ++ while(_do_ldap_retry(ret, ldap_server, ldap_port) > 0); ++ ldap_enable_retry = 0; + +- } +- hostres = NULL; +- if ((ret = ldap_search_ext_s (ld, ldap_base_dn, LDAP_SCOPE_SUBTREE, +- hfilter, NULL, 0, NULL, NULL, NULL, 0, +- &hostres)) != LDAP_SUCCESS) ++ if(ret != LDAP_SUCCESS) + { + log_error ("Cannot find host LDAP entry %s %s", +- ((ldap_dhcp_server_cn == NULL)?(unme.nodename):(ldap_dhcp_server_cn)), hfilter); ++ ((ldap_dhcp_server_cn == NULL)?(unme.nodename):(ldap_dhcp_server_cn)), hfilter); + if(NULL != hostres) + ldap_msgfree (hostres); + ldap_stop(); ++ x_parser_free(&cfile); + return (ISC_R_FAILURE); + } + +@@ -1415,6 +2057,7 @@ ldap_read_config (void) + log_error ("Error: Cannot find LDAP entry matching %s", hfilter); + ldap_msgfree (hostres); + ldap_stop(); ++ x_parser_free(&cfile); + return (ISC_R_FAILURE); + } + +@@ -1428,7 +2071,9 @@ ldap_read_config (void) + (tempbv = ldap_get_values_len (ld, hostent, "dhcpServiceDN")) == NULL || + tempbv[0] == NULL) + { +- log_error ("Error: Cannot find LDAP entry matching %s", hfilter); ++ log_error ("Error: No dhcp service is associated with the server %s %s", ++ (hostdn ? "dn" : "name"), (hostdn ? hostdn : ++ (ldap_dhcp_server_cn ? ldap_dhcp_server_cn : unme.nodename))); + + if (tempbv != NULL) + ldap_value_free_len (tempbv); +@@ -1437,6 +2082,7 @@ ldap_read_config (void) + ldap_memfree (hostdn); + ldap_msgfree (hostres); + ldap_stop(); ++ x_parser_free(&cfile); + return (ISC_R_FAILURE); + } + +@@ -1444,37 +2090,51 @@ ldap_read_config (void) + log_info ("LDAP: Parsing dhcpServer options '%s' ...", hostdn); + #endif + +- cfile->inbuf[0] = '\0'; +- ldap_parse_entry_options(hostent, cfile->inbuf, LDAP_BUFFER_SIZE, NULL); +- cfile->buflen = strlen (cfile->inbuf); +- if(cfile->buflen > 0) ++ res = ldap_parse_entry_options(hostent, cfile, NULL); ++ if (res != ISC_R_SUCCESS) + { +- ldap_write_debug (cfile->inbuf, cfile->buflen); ++ ldap_value_free_len (tempbv); ++ ldap_msgfree (hostres); ++ ldap_memfree (hostdn); ++ ldap_stop(); ++ x_parser_free(&cfile); ++ return res; ++ } + ++ if (x_parser_length(cfile) > 0) ++ { + res = conf_file_subparse (cfile, root_group, ROOT_GROUP); + if (res != ISC_R_SUCCESS) + { + log_error ("LDAP: cannot parse dhcpServer entry '%s'", hostdn); ++ ldap_value_free_len (tempbv); ++ ldap_msgfree (hostres); + ldap_memfree (hostdn); + ldap_stop(); ++ x_parser_free(&cfile); + return res; + } +- cfile->inbuf[0] = '\0'; ++ x_parser_reset(cfile); + } + ldap_msgfree (hostres); + +- /* +- ** attach ldap (tree) read function now +- */ +- cfile->bufix = cfile->buflen = 0; +- cfile->read_function = ldap_read_function; +- + res = ISC_R_SUCCESS; + for (cnt=0; tempbv[cnt] != NULL; cnt++) + { ++ ++ if (_do_ldap_str2esc_filter_bv(hostdn, 0, &bv_o[0]) == NULL) ++ { ++ log_error ("Cannot escape ldap filter value %s: %m", hostdn); ++ res = ISC_R_FAILURE; ++ break; ++ } ++ + snprintf(sfilter, sizeof(sfilter), "(&(objectClass=dhcpService)" +- "(|(dhcpPrimaryDN=%s)(dhcpSecondaryDN=%s)))", +- hostdn, hostdn); ++ "(|(|(dhcpPrimaryDN=%s)(dhcpSecondaryDN=%s))(dhcpServerDN=%s)))", ++ bv_o[0].bv_val, bv_o[0].bv_val, bv_o[0].bv_val); ++ ++ ber_memfree(bv_o[0].bv_val); ++ + ldres = NULL; + if ((ret = ldap_search_ext_s (ld, tempbv[cnt]->bv_val, LDAP_SCOPE_BASE, + sfilter, NULL, 0, NULL, NULL, NULL, +@@ -1490,7 +2150,7 @@ ldap_read_config (void) + + if ((ent = ldap_first_entry (ld, ldres)) == NULL) + { +- log_error ("Error: Cannot find dhcpService DN '%s' with primary or secondary server reference. Please update the LDAP server entry '%s'", ++ log_error ("Error: Cannot find dhcpService DN '%s' with server reference. Please update the LDAP server entry '%s'", + tempbv[cnt]->bv_val, hostdn); + + ldap_msgfree(ldres); +@@ -1534,7 +2194,7 @@ ldap_read_config (void) + log_fatal ("no memory to remember ldap service dn"); + + #if defined (DEBUG_LDAP) +- log_info ("LDAP: Parsing dhcpService DN '%s' ...", tempbv[cnt]); ++ log_info ("LDAP: Parsing dhcpService DN '%s' ...", tempbv[cnt]->bv_val); + #endif + add_to_config_stack (ldres, ent); + res = conf_file_subparse (cfile, root_group, ROOT_GROUP); +@@ -1545,7 +2205,7 @@ ldap_read_config (void) + } + } + +- end_parse (&cfile); ++ x_parser_free(&cfile); + ldap_close_debug_fd(); + + ldap_memfree (hostdn); +@@ -1593,17 +2253,18 @@ ldap_parse_options (LDAPMessage * ent, struct group *group, + struct class **class) + { + int declaration, lease_limit; +- char option_buffer[8192]; + enum dhcp_token token; + struct parse *cfile; + isc_result_t res; + const char *val; + + lease_limit = 0; +- *option_buffer = '\0'; +- +- /* This block of code will try to find the parent of the host, and +- if it is a group object, fetch the options and apply to the host. */ ++ cfile = x_parser_init(type == HOST_DECL ? "LDAP-HOST" : "LDAP-SUBCLASS"); ++ if (cfile == NULL) ++ return (lease_limit); ++ ++ /* This block of code will try to find the parent of the host, and ++ if it is a group object, fetch the options and apply to the host. */ + if (type == HOST_DECL) + { + char *hostdn, *basedn, *temp1, *temp2, filter[1024]; +@@ -1625,16 +2286,29 @@ ldap_parse_options (LDAPMessage * ent, struct group *group, + + if (temp2 != NULL) + { +- snprintf (filter, sizeof(filter), +- "(&(cn=%.*s)(objectClass=dhcpGroup))", +- (int)(temp2 - temp1), temp1); ++ struct berval bv_o; ++ ++ if (_do_ldap_str2esc_filter_bv(temp1, (temp2 - temp1), &bv_o) == NULL) ++ { ++ log_error ("Cannot escape ldap filter value %.*s: %m", ++ (int)(temp2 - temp1), temp1); ++ filter[0] = '\0'; ++ } ++ else ++ { ++ snprintf (filter, sizeof(filter), ++ "(&(cn=%s)(objectClass=dhcpGroup))", ++ bv_o.bv_val); ++ ++ ber_memfree(bv_o.bv_val); ++ } + + basedn = strchr (temp1, ','); + if (basedn != NULL) + ++basedn; + } + +- if (basedn != NULL && *basedn != '\0') ++ if (basedn != NULL && *basedn != '\0' && filter[0] != '\0') + { + ret = ldap_search_ext_s (ld, basedn, LDAP_SCOPE_SUBTREE, filter, + NULL, 0, NULL, NULL, NULL, 0, &groupdn); +@@ -1642,13 +2316,11 @@ ldap_parse_options (LDAPMessage * ent, struct group *group, + { + if ((entry = ldap_first_entry (ld, groupdn)) != NULL) + { +- res = ldap_parse_entry_options (entry, option_buffer, +- sizeof(option_buffer) - 1, +- &lease_limit); ++ res = ldap_parse_entry_options (entry, cfile, &lease_limit); + if (res != ISC_R_SUCCESS) + { + /* reset option buffer discarding any results */ +- *option_buffer = '\0'; ++ x_parser_reset(cfile); + lease_limit = 0; + } + } +@@ -1659,24 +2331,18 @@ ldap_parse_options (LDAPMessage * ent, struct group *group, + } + } + +- res = ldap_parse_entry_options (ent, option_buffer, sizeof(option_buffer) - 1, +- &lease_limit); +- if (res != ISC_R_SUCCESS) +- return (lease_limit); +- +- option_buffer[sizeof(option_buffer) - 1] = '\0'; +- if (*option_buffer == '\0') +- return (lease_limit); +- +- cfile = (struct parse *) NULL; +- res = new_parse (&cfile, -1, option_buffer, strlen (option_buffer), +- type == HOST_DECL ? "LDAP-HOST" : "LDAP-SUBCLASS", 0); ++ res = ldap_parse_entry_options (ent, cfile, &lease_limit); + if (res != ISC_R_SUCCESS) +- return (lease_limit); ++ { ++ x_parser_free(&cfile); ++ return (lease_limit); ++ } + +-#if defined (DEBUG_LDAP) +- log_info ("Sending the following options: '%s'", option_buffer); +-#endif ++ if (x_parser_length(cfile) == 0) ++ { ++ x_parser_free(&cfile); ++ return (lease_limit); ++ } + + declaration = 0; + do +@@ -1687,7 +2353,7 @@ ldap_parse_options (LDAPMessage * ent, struct group *group, + declaration = parse_statement (cfile, group, type, host, declaration); + } while (1); + +- end_parse (&cfile); ++ x_parser_free(&cfile); + + return (lease_limit); + } +@@ -1703,7 +2369,14 @@ find_haddr_in_ldap (struct host_decl **hp, int htype, unsigned hlen, + struct host_decl * host; + isc_result_t status; + ldap_dn_node *curr; ++ char up_hwaddr[20]; ++ char lo_hwaddr[20]; + int ret; ++ struct berval bv_o[2]; ++ ++ ++ if (local_family != AF_INET) ++ return (0); + + if (ldap_method == LDAP_METHOD_STATIC) + return (0); +@@ -1733,9 +2406,28 @@ find_haddr_in_ldap (struct host_decl **hp, int htype, unsigned hlen, + ** FIXME: It is not guaranteed, that the dhcpHWAddress attribute + ** contains _exactly_ "type addr" with one space between! + */ ++ snprintf(lo_hwaddr, sizeof(lo_hwaddr), "%s", ++ print_hw_addr (htype, hlen, haddr)); ++ x_strxform(up_hwaddr, lo_hwaddr, sizeof(up_hwaddr), toupper); ++ ++ if (_do_ldap_str2esc_filter_bv(lo_hwaddr, 0, &bv_o[0]) == NULL) ++ { ++ log_error ("Cannot escape ldap filter value %s: %m", lo_hwaddr); ++ return (0); ++ } ++ if (_do_ldap_str2esc_filter_bv(up_hwaddr, 0, &bv_o[1]) == NULL) ++ { ++ log_error ("Cannot escape ldap filter value %s: %m", up_hwaddr); ++ ber_memfree(bv_o[0].bv_val); ++ return (0); ++ } ++ + snprintf (buf, sizeof (buf), +- "(&(objectClass=dhcpHost)(dhcpHWAddress=%s %s))", +- type_str, print_hw_addr (htype, hlen, haddr)); ++ "(&(objectClass=dhcpHost)(|(dhcpHWAddress=%s %s)(dhcpHWAddress=%s %s)))", ++ type_str, bv_o[0].bv_val, type_str, bv_o[1].bv_val); ++ ++ ber_memfree(bv_o[0].bv_val); ++ ber_memfree(bv_o[1].bv_val); + + res = ent = NULL; + for (curr = ldap_service_dn_head; +@@ -1862,7 +2554,13 @@ find_subclass_in_ldap (struct class *class, struct class **newclass, + int ret, lease_limit; + isc_result_t status; + ldap_dn_node *curr; +- char buf[1024]; ++ char buf[2048]; ++ struct berval bv_class; ++ struct berval bv_cdata; ++ char *hex_1; ++ ++ if (local_family != AF_INET) ++ return (0); + + if (ldap_method == LDAP_METHOD_STATIC) + return (0); +@@ -1872,10 +2570,33 @@ find_subclass_in_ldap (struct class *class, struct class **newclass, + if (ld == NULL) + return (0); + ++ hex_1 = print_hex_1 (data->len, data->data, 1024); ++ if (*hex_1 == '"') ++ { ++ /* result is a quotted not hex string: ldap escape the original string */ ++ if (_do_ldap_str2esc_filter_bv(data->data, data->len, &bv_cdata) == NULL) ++ { ++ log_error ("Cannot escape ldap filter value %s: %m", hex_1); ++ return (0); ++ } ++ hex_1 = NULL; ++ } ++ if (_do_ldap_str2esc_filter_bv(class->name, strlen (class->name), &bv_class) == NULL) ++ { ++ log_error ("Cannot escape ldap filter value %s: %m", class->name); ++ if (hex_1 == NULL) ++ ber_memfree(bv_cdata.bv_val); ++ return (0); ++ } ++ + snprintf (buf, sizeof (buf), + "(&(objectClass=dhcpSubClass)(cn=%s)(dhcpClassData=%s))", +- print_hex_1 (data->len, data->data, 60), +- print_hex_2 (strlen (class->name), (u_int8_t *) class->name, 60)); ++ (hex_1 == NULL ? bv_cdata.bv_val : hex_1), bv_class.bv_val); ++ ++ if (hex_1 == NULL) ++ ber_memfree(bv_cdata.bv_val); ++ ber_memfree(bv_class.bv_val); ++ + #if defined (DEBUG_LDAP) + log_info ("Searching LDAP for %s", buf); + #endif +diff --git a/server/ldap_casa.c b/server/ldap_casa.c +index 952d9b9..cd10157 100644 +--- a/server/ldap_casa.c ++++ b/server/ldap_casa.c +@@ -55,8 +55,10 @@ + */ + + #if defined(LDAP_CASA_AUTH) +-#include "ldap_casa.h" + #include "dhcpd.h" ++#include "ldap_casa.h" ++#include ++#include + + int + load_casa (void) +diff --git a/server/stables.c b/server/stables.c +index da25764..cf85334 100644 +--- a/server/stables.c ++++ b/server/stables.c +@@ -259,6 +259,7 @@ static struct option server_options[] = { + { "ldap-tls-ciphers", "t", &server_universe, 76, 1 }, + { "ldap-tls-randfile", "t", &server_universe, 77, 1 }, + #endif /* LDAP_USE_SSL */ ++ { "ldap-init-retry", "d", &server_universe, 78, 1 }, + #endif /* LDAP_CONFIGURATION */ + { NULL, NULL, NULL, 0, 0 } + }; +-- +1.8.4 + diff --git a/0008-dhcp-4.1.1-P1-lpf-bind-msg-fix.patch b/0008-dhcp-4.1.1-P1-lpf-bind-msg-fix.patch new file mode 100644 index 0000000..caa0c34 --- /dev/null +++ b/0008-dhcp-4.1.1-P1-lpf-bind-msg-fix.patch @@ -0,0 +1,25 @@ +From a9d31f9f8356fba3fc49ead5afdfd8cca5a4a535 Mon Sep 17 00:00:00 2001 +From: Marius Tomaschewski +Date: Tue, 12 Jun 2012 08:54:23 +0200 +Subject: [PATCH] dhcp-4.1.1-P1-lpf-bind-msg-fix + +--- + common/lpf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/common/lpf.c b/common/lpf.c +index 44f5f54..82c8b76 100644 +--- a/common/lpf.c ++++ b/common/lpf.c +@@ -94,7 +94,7 @@ int if_register_lpf (info) + if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || + errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || + errno == EAFNOSUPPORT || errno == EINVAL) { +- log_error ("socket: %m - make sure"); ++ log_error ("bind: %m - make sure"); + log_error ("CONFIG_PACKET (Packet socket) %s", + "and CONFIG_FILTER"); + log_error ("(Socket Filtering) are enabled %s", +-- +1.8.4 + diff --git a/dhcp-4.2.2-xen-checksum.diff b/0009-dhcp-4.2.6-xen-checksum.patch similarity index 80% rename from dhcp-4.2.2-xen-checksum.diff rename to 0009-dhcp-4.2.6-xen-checksum.patch index dc900ed..dd2592c 100644 --- a/dhcp-4.2.2-xen-checksum.diff +++ b/0009-dhcp-4.2.6-xen-checksum.patch @@ -1,21 +1,36 @@ +From 16e50fd8fbd606ba04ac814f9fff883ecb9e110c Mon Sep 17 00:00:00 2001 +From: Marius Tomaschewski +Date: Fri, 18 Feb 2011 13:18:32 +0100 +Subject: [PATCH] dhcp-4.2.6-xen-checksum + +--- + common/bpf.c | 2 +- + common/dlpi.c | 2 +- + common/lpf.c | 84 ++++++++++++++++++++++++++++++++++++++++++-------------- + common/nit.c | 2 +- + common/packet.c | 4 +-- + common/upf.c | 2 +- + includes/dhcpd.h | 2 +- + 7 files changed, 70 insertions(+), 28 deletions(-) + diff --git a/common/bpf.c b/common/bpf.c -index b0ef657..8bd5727 100644 +index d6d6013..559b414 100644 --- a/common/bpf.c +++ b/common/bpf.c -@@ -485,7 +485,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) - offset = decode_udp_ip_header (interface, - interface -> rbuf, - interface -> rbuf_offset, +@@ -480,7 +480,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) + /* Decode the IP and UDP headers... */ + offset = decode_udp_ip_header(interface, interface->rbuf, + interface->rbuf_offset, - from, hdr.bh_caplen, &paylen); -+ from, hdr.bh_caplen, &paylen, 0); ++ from, hdr.bh_caplen, &paylen, 0); /* If the IP or UDP checksum was bad, skip the packet... */ if (offset < 0) { diff --git a/common/dlpi.c b/common/dlpi.c -index 8f2c73d..b9eb1d3 100644 +index 391fb91..14e95d2 100644 --- a/common/dlpi.c +++ b/common/dlpi.c -@@ -693,7 +693,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) +@@ -691,7 +691,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) length -= offset; #endif offset = decode_udp_ip_header (interface, dbuf, bufix, @@ -25,10 +40,10 @@ index 8f2c73d..b9eb1d3 100644 /* * If the IP or UDP checksum was bad, skip the packet... diff --git a/common/lpf.c b/common/lpf.c -index 16eecc9..4bdb0f1 100644 +index 82c8b76..6639809 100644 --- a/common/lpf.c +++ b/common/lpf.c -@@ -29,19 +29,33 @@ +@@ -30,19 +30,33 @@ #include "dhcpd.h" #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE) #include @@ -63,7 +78,7 @@ index 16eecc9..4bdb0f1 100644 /* Reinitializes the specified interface after an address change. This is not required for packet-filter APIs. */ -@@ -67,10 +81,14 @@ int if_register_lpf (info) +@@ -68,10 +82,14 @@ int if_register_lpf (info) struct interface_info *info; { int sock; @@ -80,7 +95,7 @@ index 16eecc9..4bdb0f1 100644 htons((short)ETH_P_ALL))) < 0) { if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || -@@ -85,11 +103,16 @@ int if_register_lpf (info) +@@ -86,11 +104,16 @@ int if_register_lpf (info) log_fatal ("Open a socket for LPF: %m"); } @@ -100,7 +115,7 @@ index 16eecc9..4bdb0f1 100644 if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || errno == EAFNOSUPPORT || errno == EINVAL) { -@@ -171,9 +194,18 @@ static void lpf_gen_filter_setup (struct interface_info *); +@@ -172,9 +195,18 @@ static void lpf_gen_filter_setup (struct interface_info *); void if_register_receive (info) struct interface_info *info; { @@ -119,7 +134,7 @@ index 16eecc9..4bdb0f1 100644 #if defined (HAVE_TR_SUPPORT) if (info -> hw_address.hbuf [0] == HTYPE_IEEE802) lpf_tr_filter_setup (info); -@@ -295,7 +327,6 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto) +@@ -296,7 +328,6 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto) double hh [16]; double ih [1536 / sizeof (double)]; unsigned char *buf = (unsigned char *)ih; @@ -127,7 +142,7 @@ index 16eecc9..4bdb0f1 100644 int result; int fudge; -@@ -316,17 +347,7 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto) +@@ -317,17 +348,7 @@ ssize_t send_packet (interface, packet, raw, len, from, to, hto) (unsigned char *)raw, len); memcpy (buf + ibufp, raw, len); @@ -146,7 +161,7 @@ index 16eecc9..4bdb0f1 100644 if (result < 0) log_error ("send_packet: %m"); return result; -@@ -343,14 +364,35 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) +@@ -344,14 +365,35 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) { int length = 0; int offset = 0; @@ -184,7 +199,7 @@ index 16eecc9..4bdb0f1 100644 bufix = 0; /* Decode the physical header... */ offset = decode_hw_header (interface, ibuf, bufix, hfrom); -@@ -367,7 +409,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) +@@ -368,7 +410,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) /* Decode the IP and UDP headers... */ offset = decode_udp_ip_header (interface, ibuf, bufix, from, @@ -194,10 +209,10 @@ index 16eecc9..4bdb0f1 100644 /* If the IP or UDP checksum was bad, skip the packet... */ if (offset < 0) diff --git a/common/nit.c b/common/nit.c -index 3822206..0da9c36 100644 +index a43bcf3..3fdef1d 100644 --- a/common/nit.c +++ b/common/nit.c -@@ -369,7 +369,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) +@@ -363,7 +363,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) /* Decode the IP and UDP headers... */ offset = decode_udp_ip_header (interface, ibuf, bufix, @@ -207,10 +222,10 @@ index 3822206..0da9c36 100644 /* If the IP or UDP checksum was bad, skip the packet... */ if (offset < 0) diff --git a/common/packet.c b/common/packet.c -index 42bca69..fd2d975 100644 +index 45e96e8..73e786d 100644 --- a/common/packet.c +++ b/common/packet.c -@@ -211,7 +211,7 @@ ssize_t +@@ -226,7 +226,7 @@ ssize_t decode_udp_ip_header(struct interface_info *interface, unsigned char *buf, unsigned bufix, struct sockaddr_in *from, unsigned buflen, @@ -219,7 +234,7 @@ index 42bca69..fd2d975 100644 { unsigned char *data; struct ip ip; -@@ -322,7 +322,7 @@ decode_udp_ip_header(struct interface_info *interface, +@@ -337,7 +337,7 @@ decode_udp_ip_header(struct interface_info *interface, 8, IPPROTO_UDP + ulen)))); udp_packets_seen++; @@ -229,10 +244,10 @@ index 42bca69..fd2d975 100644 if (udp_packets_seen > 4 && (udp_packets_seen / udp_packets_bad_checksum) < 2) { diff --git a/common/upf.c b/common/upf.c -index feb82a2..fff3949 100644 +index de2129e..6a02077 100644 --- a/common/upf.c +++ b/common/upf.c -@@ -320,7 +320,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) +@@ -314,7 +314,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom) /* Decode the IP and UDP headers... */ offset = decode_udp_ip_header (interface, ibuf, bufix, @@ -242,10 +257,10 @@ index feb82a2..fff3949 100644 /* If the IP or UDP checksum was bad, skip the packet... */ if (offset < 0) diff --git a/includes/dhcpd.h b/includes/dhcpd.h -index adf04cc..ded57a9 100644 +index 63d58e5..68262e9 100644 --- a/includes/dhcpd.h +++ b/includes/dhcpd.h -@@ -2793,7 +2793,7 @@ ssize_t decode_hw_header (struct interface_info *, unsigned char *, +@@ -2788,7 +2788,7 @@ ssize_t decode_hw_header (struct interface_info *, unsigned char *, unsigned, struct hardware *); ssize_t decode_udp_ip_header (struct interface_info *, unsigned char *, unsigned, struct sockaddr_in *, @@ -255,5 +270,5 @@ index adf04cc..ded57a9 100644 /* ethernet.c */ void assemble_ethernet_header (struct interface_info *, unsigned char *, -- -1.7.3.4 +1.8.4 diff --git a/dhcp-4.2.4-dhclient-option-checks.bnc675052.diff b/0010-dhcp-4.2.2-dhclient-option-checks.patch similarity index 60% rename from dhcp-4.2.4-dhclient-option-checks.bnc675052.diff rename to 0010-dhcp-4.2.2-dhclient-option-checks.patch index 53058c8..5e746bd 100644 --- a/dhcp-4.2.4-dhclient-option-checks.bnc675052.diff +++ b/0010-dhcp-4.2.2-dhclient-option-checks.patch @@ -1,8 +1,18 @@ +From 48c1bbb9cbd6d6e71178e82fd45a7409efbb9d72 Mon Sep 17 00:00:00 2001 +From: Marius Tomaschewski +Date: Wed, 27 Apr 2011 13:56:47 +0200 +Subject: [PATCH] dhcp-4.2.2-dhclient-option-checks + +--- + client/dhclient.c | 6 +++--- + common/options.c | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + diff --git a/client/dhclient.c b/client/dhclient.c -index 1afccd5..37ec809 100644 +index b7a14fe..19a527b 100644 --- a/client/dhclient.c +++ b/client/dhclient.c -@@ -3275,7 +3275,7 @@ void script_write_params (client, prefix, lease) +@@ -3301,7 +3301,7 @@ void script_write_params (client, prefix, lease) } else { log_error("suspect value in %s " "option - discarded", @@ -11,7 +21,7 @@ index 1afccd5..37ec809 100644 } } -@@ -3288,7 +3288,7 @@ void script_write_params (client, prefix, lease) +@@ -3314,7 +3314,7 @@ void script_write_params (client, prefix, lease) } else { log_error("suspect value in %s " "option - discarded", @@ -20,7 +30,7 @@ index 1afccd5..37ec809 100644 } } -@@ -4216,7 +4216,7 @@ static int check_domain_name(const char *ptr, size_t len, int dots) +@@ -4283,7 +4283,7 @@ static int check_domain_name(const char *ptr, size_t len, int dots) const char *p; /* not empty or complete length not over 255 characters */ @@ -30,10 +40,10 @@ index 1afccd5..37ec809 100644 /* consists of [[:alnum:]-]+ labels separated by [.] */ diff --git a/common/options.c b/common/options.c -index e485222..bc9bb97 100644 +index 56bb151..be44a70 100644 --- a/common/options.c +++ b/common/options.c -@@ -3918,7 +3918,7 @@ pretty_escape(char **dst, char *dend, const unsigned char **src, +@@ -3979,7 +3979,7 @@ pretty_escape(char **dst, char *dend, const unsigned char **src, } } else if (**src == '"' || **src == '\'' || **src == '$' || **src == '`' || **src == '\\' || **src == '|' || @@ -42,3 +52,6 @@ index e485222..bc9bb97 100644 if (*dst + 2 > dend) return -1; +-- +1.8.4 + diff --git a/dhcp-4.2.2-close-on-exec.diff b/0011-dhcp-4.2.6-close-on-exec.patch similarity index 78% rename from dhcp-4.2.2-close-on-exec.diff rename to 0011-dhcp-4.2.6-close-on-exec.patch index ccd31b6..076e4f1 100644 --- a/dhcp-4.2.2-close-on-exec.diff +++ b/0011-dhcp-4.2.6-close-on-exec.patch @@ -1,8 +1,32 @@ +From 0ae45af28ebda5770465f84ac0f69f28ed6b7b07 Mon Sep 17 00:00:00 2001 +From: Marius Tomaschewski +Date: Thu, 18 Aug 2011 14:09:06 +0200 +Subject: [PATCH] dhcp-4.2.6-close-on-exec + +--- + client/clparse.c | 4 ++-- + client/dhclient.c | 10 +++++----- + common/bpf.c | 2 +- + common/discover.c | 4 ++-- + common/dlpi.c | 2 +- + common/nit.c | 2 +- + common/resolv.c | 2 +- + common/upf.c | 2 +- + dst/dst_api.c | 8 ++++---- + dst/prandom.c | 4 ++-- + omapip/trace.c | 6 +++--- + relay/dhcrelay.c | 5 +++-- + server/confpars.c | 2 +- + server/db.c | 6 +++--- + server/dhcpd.c | 4 ++-- + server/ldap.c | 2 +- + 16 files changed, 33 insertions(+), 32 deletions(-) + diff --git a/client/clparse.c b/client/clparse.c -index 9de4ce2..ca24ba6 100644 +index 646229f..3e9f9b1 100644 --- a/client/clparse.c +++ b/client/clparse.c -@@ -220,7 +220,7 @@ int read_client_conf_file (const char *name, struct interface_info *ip, +@@ -221,7 +221,7 @@ int read_client_conf_file (const char *name, struct interface_info *ip, int token; isc_result_t status; @@ -11,7 +35,7 @@ index 9de4ce2..ca24ba6 100644 return uerr2isc (errno); cfile = NULL; -@@ -257,7 +257,7 @@ void read_client_leases () +@@ -258,7 +258,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. */ @@ -21,19 +45,19 @@ index 9de4ce2..ca24ba6 100644 cfile = NULL; diff --git a/client/dhclient.c b/client/dhclient.c -index 82c26bb..a1cab01 100644 +index 19a527b..dbc6f38 100644 --- a/client/dhclient.c +++ b/client/dhclient.c -@@ -423,7 +423,7 @@ main(int argc, char **argv) { +@@ -422,7 +422,7 @@ main(int argc, char **argv) { + long temp; 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; -@@ -2689,7 +2689,7 @@ void rewrite_client_leases () +@@ -2728,7 +2728,7 @@ void rewrite_client_leases () if (leaseFile != NULL) fclose (leaseFile); @@ -42,7 +66,7 @@ index 82c26bb..a1cab01 100644 if (leaseFile == NULL) { log_error ("can't create %s: %m", path_dhclient_db); return; -@@ -2799,7 +2799,7 @@ write_duid(struct data_string *duid) +@@ -2849,7 +2849,7 @@ write_duid(struct data_string *duid) return DHCP_R_INVALIDARG; if (leaseFile == NULL) { /* XXX? */ @@ -51,7 +75,7 @@ index 82c26bb..a1cab01 100644 if (leaseFile == NULL) { log_error("can't create %s: %m", path_dhclient_db); return ISC_R_IOERROR; -@@ -2847,7 +2847,7 @@ write_client6_lease(struct client_state *client, struct dhc6_lease *lease, +@@ -2897,7 +2897,7 @@ write_client6_lease(struct client_state *client, struct dhc6_lease *lease, return DHCP_R_INVALIDARG; if (leaseFile == NULL) { /* XXX? */ @@ -60,7 +84,7 @@ index 82c26bb..a1cab01 100644 if (leaseFile == NULL) { log_error("can't create %s: %m", path_dhclient_db); return ISC_R_IOERROR; -@@ -2979,7 +2979,7 @@ int write_client_lease (client, lease, rewrite, makesure) +@@ -3029,7 +3029,7 @@ int write_client_lease (client, lease, rewrite, makesure) return 1; if (leaseFile == NULL) { /* XXX */ @@ -70,7 +94,7 @@ index 82c26bb..a1cab01 100644 log_error ("can't create %s: %m", path_dhclient_db); return 0; diff --git a/common/bpf.c b/common/bpf.c -index 8bd5727..7b8f1d4 100644 +index 559b414..076d9bc 100644 --- a/common/bpf.c +++ b/common/bpf.c @@ -94,7 +94,7 @@ int if_register_bpf (info) @@ -83,10 +107,10 @@ index 8bd5727..7b8f1d4 100644 if (errno == EBUSY) { continue; diff --git a/common/discover.c b/common/discover.c -index 1d84219..93a278e 100644 +index 4b40a70..6a0540b 100644 --- a/common/discover.c +++ b/common/discover.c -@@ -421,7 +421,7 @@ begin_iface_scan(struct iface_conf_list *ifaces) { +@@ -412,7 +412,7 @@ begin_iface_scan(struct iface_conf_list *ifaces) { int len; int i; @@ -95,7 +119,7 @@ index 1d84219..93a278e 100644 if (ifaces->fp == NULL) { log_error("Error opening '/proc/net/dev' to list interfaces"); return 0; -@@ -456,7 +456,7 @@ begin_iface_scan(struct iface_conf_list *ifaces) { +@@ -447,7 +447,7 @@ begin_iface_scan(struct iface_conf_list *ifaces) { #ifdef DHCPv6 if (local_family == AF_INET6) { @@ -105,10 +129,10 @@ index 1d84219..93a278e 100644 log_error("Error opening '/proc/net/if_inet6' to " "list IPv6 interfaces; %m"); diff --git a/common/dlpi.c b/common/dlpi.c -index b9eb1d3..c044ec6 100644 +index 14e95d2..efaba3a 100644 --- a/common/dlpi.c +++ b/common/dlpi.c -@@ -806,7 +806,7 @@ dlpiopen(const char *ifname) { +@@ -804,7 +804,7 @@ dlpiopen(const char *ifname) { } *dp = '\0'; @@ -118,10 +142,10 @@ index b9eb1d3..c044ec6 100644 /* diff --git a/common/nit.c b/common/nit.c -index 0da9c36..896cbb6 100644 +index 3fdef1d..dc62081 100644 --- a/common/nit.c +++ b/common/nit.c -@@ -81,7 +81,7 @@ int if_register_nit (info) +@@ -75,7 +75,7 @@ int if_register_nit (info) struct strioctl sio; /* Open a NIT device */ @@ -131,10 +155,10 @@ index 0da9c36..896cbb6 100644 log_fatal ("Can't open NIT device for %s: %m", info -> name); diff --git a/common/resolv.c b/common/resolv.c -index b29d4cf..d946ccc 100644 +index 526cebf..2ac8d43 100644 --- a/common/resolv.c +++ b/common/resolv.c -@@ -49,7 +49,7 @@ void read_resolv_conf (parse_time) +@@ -44,7 +44,7 @@ void read_resolv_conf (parse_time) struct domain_search_list *dp, *dl, *nd; isc_result_t status; @@ -144,10 +168,10 @@ index b29d4cf..d946ccc 100644 return; } diff --git a/common/upf.c b/common/upf.c -index fff3949..4f9318e 100644 +index 6a02077..e5cafcf 100644 --- a/common/upf.c +++ b/common/upf.c -@@ -77,7 +77,7 @@ int if_register_upf (info) +@@ -71,7 +71,7 @@ int if_register_upf (info) /* %Audit% Cannot exceed 36 bytes. %2004.06.17,Safe% */ sprintf(filename, "/dev/pf/pfilt%d", b); @@ -157,7 +181,7 @@ index fff3949..4f9318e 100644 if (errno == EBUSY) { continue; diff --git a/dst/dst_api.c b/dst/dst_api.c -index 8925c66..fa4eb5f 100644 +index 3993b1e..aadcc1f 100644 --- a/dst/dst_api.c +++ b/dst/dst_api.c @@ -437,7 +437,7 @@ dst_s_write_private_key(const DST_KEY *key) @@ -169,7 +193,7 @@ index 8925c66..fa4eb5f 100644 int nn; if ((nn = fwrite(encoded_block, 1, len, fp)) != len) { EREPORT(("dst_write_private_key(): Write failure on %s %d != %d errno=%d\n", -@@ -494,7 +494,7 @@ dst_s_read_public_key(const char *in_name, const unsigned in_id, int in_alg) +@@ -495,7 +495,7 @@ dst_s_read_public_key(const char *in_name, const unsigned in_id, int in_alg) * flags, proto, alg stored as decimal (or hex numbers FIXME). * (FIXME: handle parentheses for line continuation.) */ @@ -178,7 +202,7 @@ index 8925c66..fa4eb5f 100644 EREPORT(("dst_read_public_key(): Public Key not found %s\n", name)); return (NULL); -@@ -620,7 +620,7 @@ dst_s_write_public_key(const DST_KEY *key) +@@ -621,7 +621,7 @@ dst_s_write_public_key(const DST_KEY *key) return (0); } /* create public key file */ @@ -187,7 +211,7 @@ index 8925c66..fa4eb5f 100644 EREPORT(("DST_write_public_key: open of file:%s failed (errno=%d)\n", filename, errno)); return (0); -@@ -854,7 +854,7 @@ dst_s_read_private_key_file(char *name, DST_KEY *pk_key, unsigned in_id, +@@ -855,7 +855,7 @@ dst_s_read_private_key_file(char *name, DST_KEY *pk_key, unsigned in_id, return (0); } /* first check if we can find the key file */ @@ -197,10 +221,10 @@ index 8925c66..fa4eb5f 100644 filename, dst_path[0] ? dst_path : (char *) getcwd(NULL, PATH_MAX - 1))); diff --git a/dst/prandom.c b/dst/prandom.c -index 4de3fe4..fbbe07c 100644 +index d207993..775cb23 100644 --- a/dst/prandom.c +++ b/dst/prandom.c -@@ -269,7 +269,7 @@ get_dev_random(u_char *output, unsigned size) +@@ -270,7 +270,7 @@ get_dev_random(u_char *output, unsigned size) s = stat("/dev/random", &st); if (s == 0 && S_ISCHR(st.st_mode)) { @@ -219,10 +243,10 @@ index 4de3fe4..fbbe07c 100644 for (no = 0; (i = fread(buf, sizeof(*buf), sizeof(buf), fp)) > 0; no += i) diff --git a/omapip/trace.c b/omapip/trace.c -index 9fd3fb5..9c4e11e 100644 +index 23e4e50..846b42b 100644 --- a/omapip/trace.c +++ b/omapip/trace.c -@@ -141,10 +141,10 @@ isc_result_t trace_begin (const char *filename, +@@ -138,10 +138,10 @@ isc_result_t trace_begin (const char *filename, return DHCP_R_INVALIDARG; } @@ -235,7 +259,7 @@ index 9fd3fb5..9c4e11e 100644 0600); } -@@ -431,7 +431,7 @@ void trace_file_replay (const char *filename) +@@ -429,7 +429,7 @@ void trace_file_replay (const char *filename) isc_result_t result; int len; @@ -245,10 +269,10 @@ index 9fd3fb5..9c4e11e 100644 log_error("Can't open tracefile %s: %m", filename); return; diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c -index f21f16f..d2aa90e 100644 +index 6f42927..4ef6737 100644 --- a/relay/dhcrelay.c +++ b/relay/dhcrelay.c -@@ -540,13 +540,14 @@ main(int argc, char **argv) { +@@ -539,13 +539,14 @@ main(int argc, char **argv) { if (no_pid_file == ISC_FALSE) { pfdesc = open(path_dhcrelay_pid, @@ -266,10 +290,10 @@ index f21f16f..d2aa90e 100644 log_error("Can't fdopen %s: %m", path_dhcrelay_pid); diff --git a/server/confpars.c b/server/confpars.c -index c0742d4..62568e9 100644 +index 684f9c1..3b5a840 100644 --- a/server/confpars.c +++ b/server/confpars.c -@@ -116,7 +116,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group, +@@ -110,7 +110,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group, } #endif @@ -279,10 +303,10 @@ index c0742d4..62568e9 100644 log_error ("Can't open lease database %s: %m --", path_dhcpd_db); diff --git a/server/db.c b/server/db.c -index dc75321..be5db26 100644 +index c2630ea..59e96dd 100644 --- a/server/db.c +++ b/server/db.c -@@ -1035,7 +1035,7 @@ void db_startup (testp) +@@ -1050,7 +1050,7 @@ void db_startup (testp) } #endif if (!testp) { @@ -291,7 +315,7 @@ index dc75321..be5db26 100644 if (!db_file) log_fatal ("Can't open %s for append.", path_dhcpd_db); expire_all_pools (); -@@ -1074,7 +1074,7 @@ int new_lease_file () +@@ -1089,7 +1089,7 @@ int new_lease_file () db_validity = lease_file_is_corrupt; snprintf (newfname, sizeof(newfname), "%s.XXXXXX", path_dhcpd_db); @@ -300,7 +324,7 @@ index dc75321..be5db26 100644 if (db_fd < 0) { log_error ("Can't create new lease file: %m"); return 0; -@@ -1083,7 +1083,7 @@ int new_lease_file () +@@ -1098,7 +1098,7 @@ int new_lease_file () log_error ("Can't fchmod new lease file: %m"); goto fail; } @@ -310,10 +334,10 @@ index dc75321..be5db26 100644 close(db_fd); goto fdfail; diff --git a/server/dhcpd.c b/server/dhcpd.c -index 27e04e4..9233d26 100644 +index b4c1bef..41a9efe 100644 --- a/server/dhcpd.c +++ b/server/dhcpd.c -@@ -809,7 +809,7 @@ main(int argc, char **argv) { +@@ -805,7 +805,7 @@ main(int argc, char **argv) { */ if (no_pid_file == ISC_FALSE) { /*Read previous pid file. */ @@ -322,7 +346,7 @@ index 27e04e4..9233d26 100644 status = read(i, pbuf, (sizeof pbuf) - 1); close (i); if (status > 0) { -@@ -828,7 +828,7 @@ main(int argc, char **argv) { +@@ -824,7 +824,7 @@ main(int argc, char **argv) { } /* Write new pid file. */ @@ -332,10 +356,10 @@ index 27e04e4..9233d26 100644 sprintf(pbuf, "%d\n", (int) getpid()); IGNORE_RET (write(i, pbuf, strlen(pbuf))); diff --git a/server/ldap.c b/server/ldap.c -index 68acbbb..77efe26 100644 +index 6e7f508..d1cde27 100644 --- a/server/ldap.c +++ b/server/ldap.c -@@ -1098,7 +1098,7 @@ ldap_start (void) +@@ -1252,7 +1252,7 @@ ldap_start (void) if (ldap_debug_file != NULL && ldap_debug_fd == -1) { @@ -345,5 +369,5 @@ index 68acbbb..77efe26 100644 log_error ("Error opening debug LDAP log file %s: %s", ldap_debug_file, strerror (errno)); -- -1.7.3.4 +1.8.4 diff --git a/0012-dhcp-4.2.2-quiet-dhclient.patch b/0012-dhcp-4.2.2-quiet-dhclient.patch new file mode 100644 index 0000000..fb65da4 --- /dev/null +++ b/0012-dhcp-4.2.2-quiet-dhclient.patch @@ -0,0 +1,26 @@ +From 61b4b713b630febf170c58c9ebbba2e01bb28eff Mon Sep 17 00:00:00 2001 +From: Marius Tomaschewski +Date: Thu, 18 Aug 2011 15:09:01 +0200 +Subject: [PATCH] dhcp-4.2.2-quiet-dhclient + +--- + client/dhclient.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/client/dhclient.c b/client/dhclient.c +index dbc6f38..65d9eeb 100644 +--- a/client/dhclient.c ++++ b/client/dhclient.c +@@ -451,6 +451,9 @@ main(int argc, char **argv) { + } else { + log_perror = 0; + quiet_interface_discovery = 1; ++#if !defined(DEBUG) ++ setlogmask(LOG_UPTO(LOG_NOTICE)); ++#endif + } + + /* If we're given a relay agent address to insert, for testing +-- +1.8.4 + diff --git a/0013-dhcp-4.2.3-P1-dhclient-log-pid.patch b/0013-dhcp-4.2.3-P1-dhclient-log-pid.patch new file mode 100644 index 0000000..dabb4cf --- /dev/null +++ b/0013-dhcp-4.2.3-P1-dhclient-log-pid.patch @@ -0,0 +1,25 @@ +From d571408b5386b9bd72fd123b30298bdca8103b18 Mon Sep 17 00:00:00 2001 +From: Marius Tomaschewski +Date: Tue, 12 Jun 2012 10:21:57 +0200 +Subject: [PATCH] dhcp-4.2.3-P1-dhclient-log-pid + +--- + client/dhclient.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/client/dhclient.c b/client/dhclient.c +index 65d9eeb..8af0a42 100644 +--- a/client/dhclient.c ++++ b/client/dhclient.c +@@ -141,7 +141,7 @@ main(int argc, char **argv) { + else if (fd != -1) + close(fd); + +- openlog("dhclient", LOG_NDELAY, LOG_DAEMON); ++ openlog("dhclient", LOG_NDELAY | LOG_PID, LOG_DAEMON); + + #if !(defined(DEBUG) || defined(__CYGWIN32__)) + setlogmask(LOG_UPTO(LOG_INFO)); +-- +1.8.4 + diff --git a/dhcp-4.2.4-interface-discovery-using-getifaddrs.patch b/0014-Fixed-linux-interface-discovery-using-getifaddrs.patch similarity index 83% rename from dhcp-4.2.4-interface-discovery-using-getifaddrs.patch rename to 0014-Fixed-linux-interface-discovery-using-getifaddrs.patch index 9f507b3..7b88477 100644 --- a/dhcp-4.2.4-interface-discovery-using-getifaddrs.patch +++ b/0014-Fixed-linux-interface-discovery-using-getifaddrs.patch @@ -1,8 +1,6 @@ -From 29ef7e3c25a709e8f0daadc41f34360ac6d88435 Mon Sep 17 00:00:00 2001 +From bd50ec560d7bec064190e4d430c066e170732c0e Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Tue, 27 Nov 2012 17:44:06 +0100 -References: bnc#791289 -Upstream: sent [ISC-Bugs #31992] Subject: [PATCH] Fixed linux interface discovery using getifaddrs Unlike dhcp 3.x, dhcp 4.x scans interfaces from /proc/net/dev, @@ -15,17 +13,15 @@ dhcp-server is unable to find any address and fails to start. Changed to use getifaddrs() function, which retrieves all IP addresses on linux systems and is available since GLIBC 2.3. - -Signed-off-by: Marius Tomaschewski --- - common/discover.c | 51 ++++++++++++++++++++++++++++++++++++++++++++------- - 1 Datei geändert, 44 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-) + common/discover.c | 51 ++++++++++++++++++++++++++++++++++++++++++++------- + 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/common/discover.c b/common/discover.c -index 1d84219..cbcb1b9 100644 +index 6a0540b..1dcaa02 100644 --- a/common/discover.c +++ b/common/discover.c -@@ -379,7 +379,7 @@ end_iface_scan(struct iface_conf_list *ifaces) { +@@ -370,7 +370,7 @@ end_iface_scan(struct iface_conf_list *ifaces) { ifaces->sock = -1; } @@ -34,7 +30,7 @@ index 1d84219..cbcb1b9 100644 /* * Linux support * ------------- -@@ -388,6 +388,14 @@ end_iface_scan(struct iface_conf_list *ifaces) { +@@ -379,6 +379,14 @@ end_iface_scan(struct iface_conf_list *ifaces) { * about interfaces, along with selected ioctl() calls. * * Linux low level access is documented in the netdevice man page. @@ -49,7 +45,7 @@ index 1d84219..cbcb1b9 100644 */ /* -@@ -760,11 +768,11 @@ end_iface_scan(struct iface_conf_list *ifaces) { +@@ -751,11 +759,11 @@ end_iface_scan(struct iface_conf_list *ifaces) { #else /* @@ -64,7 +60,7 @@ index 1d84219..cbcb1b9 100644 * * The getifaddrs() man page describes the use. */ -@@ -821,10 +829,39 @@ next_iface(struct iface_info *info, int *err, struct iface_conf_list *ifaces) { +@@ -812,10 +820,39 @@ next_iface(struct iface_info *info, int *err, struct iface_conf_list *ifaces) { *err = 1; return 0; } @@ -108,5 +104,5 @@ index 1d84219..cbcb1b9 100644 *err = 0; return 1; -- -1.7.10.4 +1.8.4 diff --git a/dhcp-4.2.4-P2-do-not-die-on-sigpipe.patch b/0015-Ignore-SIGPIPE-to-not-die-in-socket-code.patch similarity index 74% rename from dhcp-4.2.4-P2-do-not-die-on-sigpipe.patch rename to 0015-Ignore-SIGPIPE-to-not-die-in-socket-code.patch index c36fb06..db0b792 100644 --- a/dhcp-4.2.4-P2-do-not-die-on-sigpipe.patch +++ b/0015-Ignore-SIGPIPE-to-not-die-in-socket-code.patch @@ -1,9 +1,7 @@ -From 633817ad53adbdeb4054b750e1f0bd4ce58f341b Mon Sep 17 00:00:00 2001 +From d9b443ef38da92bd325f5118a2a6ddc21fae098e Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Thu, 20 Dec 2012 10:25:53 +0100 Subject: [PATCH] Ignore SIGPIPE to not die in socket code -References: bnc#794578 -Upstream: sent [ISC-Bugs #32222] Installed SIG_IGN handler for SIGPIPE to not die before the errno==EPIPE checks in the socket code are reached. @@ -13,25 +11,15 @@ dhcp, does not set any signal handlers. Reported upstream as [ISC-Bugs #32222], IMO regression to [ISC-Bugs #22269] as the SO_NOSIGPIPE socket option isn't available e.g. on Linux. - -Signed-off-by: Marius Tomaschewski --- - omapip/isclib.c | 33 ++++++++++++++++++++++++++++++++- - 1 Datei geändert, 32 Zeilen hinzugefügt(+), 1 Zeile entfernt(-) + omapip/isclib.c | 32 +++++++++++++++++++++++++++++++- + 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/omapip/isclib.c b/omapip/isclib.c -index 1534dde..27bb887 100644 +index afab262..9b7ff5f 100644 --- a/omapip/isclib.c +++ b/omapip/isclib.c -@@ -28,6 +28,7 @@ - #include "dhcpd.h" - - #include -+#include - - dhcp_context_t dhcp_gbl_ctx; - -@@ -67,6 +68,23 @@ isclib_cleanup(void) +@@ -69,6 +69,23 @@ isclib_cleanup(void) return; } @@ -55,7 +43,7 @@ index 1534dde..27bb887 100644 isc_result_t dhcp_context_create(void) { isc_result_t result; -@@ -104,7 +122,20 @@ dhcp_context_create(void) { +@@ -106,7 +123,20 @@ dhcp_context_create(void) { result = isc_app_ctxstart(dhcp_gbl_ctx.actx); if (result != ISC_R_SUCCESS) @@ -78,5 +66,5 @@ index 1534dde..27bb887 100644 result = isc_taskmgr_createinctx(dhcp_gbl_ctx.mctx, -- -1.7.10.4 +1.8.4 diff --git a/0016-server-log-DHCPv6-addresses-assigned-to-clients.patch b/0016-server-log-DHCPv6-addresses-assigned-to-clients.patch new file mode 100644 index 0000000..7f40ac9 --- /dev/null +++ b/0016-server-log-DHCPv6-addresses-assigned-to-clients.patch @@ -0,0 +1,23 @@ +From 39c796224826836f0b0d1ab42f93a973545a94b0 Mon Sep 17 00:00:00 2001 +From: Marius Tomaschewski +Date: Mon, 10 Feb 2014 15:12:49 +0100 +Subject: [PATCH] server: log DHCPv6 addresses assigned to clients + +--- + includes/site.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/includes/site.h b/includes/site.h +index 3de180c..1b6d0c0 100644 +--- a/includes/site.h ++++ b/includes/site.h +@@ -281,5 +281,5 @@ + This default to off to avoid changes to what is currently + logged. */ + +-/* #define LOG_V6_ADDRESSES */ ++#define LOG_V6_ADDRESSES + +-- +1.8.4 + diff --git a/config-guess-sub-update.patch b/config-guess-sub-update.patch deleted file mode 100644 index bbad8ae..0000000 --- a/config-guess-sub-update.patch +++ /dev/null @@ -1,2584 +0,0 @@ -Index: config.guess -=================================================================== ---- config.guess.orig -+++ config.guess -@@ -1,13 +1,14 @@ - #! /bin/sh - # Attempt to guess a canonical system name. - # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, --# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -+# 2011, 2012, 2013 Free Software Foundation, Inc. - --timestamp='2009-01-17' -+timestamp='2012-12-30' - - # This file is free software; you can redistribute it and/or modify it - # under the terms of the GNU General Public License as published by --# the Free Software Foundation; either version 2 of the License, or -+# the Free Software Foundation; either version 3 of the License, or - # (at your option) any later version. - # - # This program is distributed in the hope that it will be useful, but -@@ -16,24 +17,22 @@ timestamp='2009-01-17' - # General Public License for more details. - # - # You should have received a copy of the GNU General Public License --# along with this program; if not, write to the Free Software --# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+# along with this program; if not, see . - # - # As a special exception to the GNU General Public License, if you - # distribute this file as part of a program that contains a - # configuration script generated by Autoconf, you may include it under --# the same distribution terms that you use for the rest of that program. -- --# Originally written by Per Bothner . --# Please send patches to . Submit a context --# diff and a properly formatted ChangeLog entry. -+# the same distribution terms that you use for the rest of that -+# program. This Exception is an additional permission under section 7 -+# of the GNU General Public License, version 3 ("GPLv3"). -+# -+# Originally written by Per Bothner. - # --# This script attempts to guess a canonical system name similar to --# config.sub. If it succeeds, it prints the system name on stdout, and --# exits with 0. Otherwise, it exits with 1. -+# You can get the latest version of this script from: -+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD - # --# The plan is that this can be called by configure scripts if you --# don't specify an explicit build system type. -+# Please send patches with a ChangeLog entry to config-patches@gnu.org. -+ - - me=`echo "$0" | sed -e 's,.*/,,'` - -@@ -53,8 +52,9 @@ version="\ - GNU config.guess ($timestamp) - - Originally written by Per Bothner. --Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 --Free Software Foundation, Inc. -+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, -+2012, 2013 Free Software Foundation, Inc. - - This is free software; see the source for copying conditions. There is NO - warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." -@@ -66,11 +66,11 @@ Try \`$me --help' for more information." - while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) -- echo "$timestamp" ; exit 0 ;; -+ echo "$timestamp" ; exit ;; - --version | -v ) -- echo "$version" ; exit 0 ;; -+ echo "$version" ; exit ;; - --help | --h* | -h ) -- echo "$usage"; exit 0 ;; -+ echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. -@@ -104,7 +104,7 @@ set_cc_for_build=' - trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; - trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; - : ${TMPDIR=/tmp} ; -- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || -+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -@@ -123,7 +123,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; --esac ;' -+esac ; set_cc_for_build= ;' - - # This is needed to find uname on a Pyramid OSx when run in the BSD universe. - # (ghazi@noc.rutgers.edu 1994-08-24) -@@ -158,6 +158,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; -+ sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched -@@ -166,7 +167,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ -- | grep __ELF__ >/dev/null -+ | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? -@@ -176,7 +177,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ - fi - ;; - *) -- os=netbsd -+ os=netbsd - ;; - esac - # The OS release -@@ -196,62 +197,34 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" -- exit 0 ;; -- amd64:OpenBSD:*:*) -- echo x86_64-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- amiga:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- cats:OpenBSD:*:*) -- echo arm-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- hp300:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- luna88k:OpenBSD:*:*) -- echo m88k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- mac68k:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- macppc:OpenBSD:*:*) -- echo powerpc-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- mvme68k:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- mvme88k:OpenBSD:*:*) -- echo m88k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- mvmeppc:OpenBSD:*:*) -- echo powerpc-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- sgi:OpenBSD:*:*) -- echo mips64-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -- sun3:OpenBSD:*:*) -- echo m68k-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; -+ *:Bitrig:*:*) -+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` -+ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} -+ exit ;; - *:OpenBSD:*:*) -- echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} -- exit 0 ;; -+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` -+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} -+ exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; -+ *:SolidBSD:*:*) -+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} -+ exit ;; - macppc:MirBSD:*:*) -- echo powerppc-unknown-mirbsd${UNAME_RELEASE} -- exit 0 ;; -+ echo powerpc-unknown-mirbsd${UNAME_RELEASE} -+ exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) -- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` -+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on -@@ -297,37 +270,46 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` -- exit 0 ;; -+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code. -+ exitcode=$? -+ trap '' 0 -+ exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix -- exit 0 ;; -+ exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 -- exit 0 ;; -+ exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 -- exit 0;; -+ exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos -- exit 0 ;; -+ exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos -- exit 0 ;; -+ exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition -- exit 0 ;; -+ exit ;; -+ *:z/VM:*:*) -+ echo s390-ibm-zvmoe -+ exit ;; - *:OS400:*:*) -- echo powerpc-ibm-os400 -- exit 0 ;; -+ echo powerpc-ibm-os400 -+ exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} -- exit 0;; -+ exit ;; -+ arm*:riscos:*:*|arm*:RISCOS:*:*) -+ echo arm-unknown-riscos -+ exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp -- exit 0;; -+ exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then -@@ -335,32 +317,51 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ - else - echo pyramid-pyramid-bsd - fi -- exit 0 ;; -+ exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 -- exit 0 ;; -+ exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 -- exit 0 ;; -- DRS?6000:UNIX_SV:4.2*:7*) -+ exit ;; -+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in -- sparc) echo sparc-icl-nx7 && exit 0 ;; -+ sparc) echo sparc-icl-nx7; exit ;; - esac ;; -+ s390x:SunOS:*:*) -+ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -+ exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -- exit 0 ;; -+ exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -- exit 0 ;; -- i86pc:SunOS:5.*:*) -- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -- exit 0 ;; -+ exit ;; -+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) -+ echo i386-pc-auroraux${UNAME_RELEASE} -+ exit ;; -+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) -+ eval $set_cc_for_build -+ SUN_ARCH="i386" -+ # If there is a compiler, see if it is configured for 64-bit objects. -+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. -+ # This test works for both compilers. -+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then -+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ -+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ -+ grep IS_64BIT_ARCH >/dev/null -+ then -+ SUN_ARCH="x86_64" -+ fi -+ fi -+ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -+ exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -- exit 0 ;; -+ exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) -@@ -369,10 +370,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` -- exit 0 ;; -+ exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 -@@ -384,10 +385,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac -- exit 0 ;; -+ exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor -@@ -397,41 +398,41 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) -- echo m68k-atari-mint${UNAME_RELEASE} -- exit 0 ;; -+ echo m68k-atari-mint${UNAME_RELEASE} -+ exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) -- echo m68k-atari-mint${UNAME_RELEASE} -- exit 0 ;; -+ echo m68k-atari-mint${UNAME_RELEASE} -+ exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) -- echo m68k-milan-mint${UNAME_RELEASE} -- exit 0 ;; -+ echo m68k-milan-mint${UNAME_RELEASE} -+ exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) -- echo m68k-hades-mint${UNAME_RELEASE} -- exit 0 ;; -+ echo m68k-hades-mint${UNAME_RELEASE} -+ exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) -- echo m68k-unknown-mint${UNAME_RELEASE} -- exit 0 ;; -+ echo m68k-unknown-mint${UNAME_RELEASE} -+ exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 -- exit 0 ;; -+ exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -@@ -455,35 +456,36 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:$ - exit (-1); - } - EOF -- $CC_FOR_BUILD -o $dummy $dummy.c \ -- && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ -- && exit 0 -+ $CC_FOR_BUILD -o $dummy $dummy.c && -+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && -+ SYSTEM_NAME=`$dummy $dummyarg` && -+ { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax -- exit 0 ;; -+ exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax -- exit 0 ;; -+ exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax -- exit 0 ;; -+ exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix -- exit 0 ;; -+ exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 -- exit 0 ;; -+ exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 -- exit 0 ;; -+ exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 -- exit 0 ;; -+ exit ;; - AViiON:dgux:*:*) -- # DG/UX returns AViiON for all architectures -- UNAME_PROCESSOR=`/usr/bin/uname -p` -+ # DG/UX returns AViiON for all architectures -+ UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ -@@ -496,29 +498,29 @@ EOF - else - echo i586-dg-dgux${UNAME_RELEASE} - fi -- exit 0 ;; -+ exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 -- exit 0 ;; -+ exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 -- exit 0 ;; -+ exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 -- exit 0 ;; -+ exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd -- exit 0 ;; -+ exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` -- exit 0 ;; -+ exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. -- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id -- exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' -+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id -+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix -- exit 0 ;; -+ exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` -@@ -526,7 +528,7 @@ EOF - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} -- exit 0 ;; -+ exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build -@@ -541,15 +543,19 @@ EOF - exit(0); - } - EOF -- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 -- echo rs6000-ibm-aix3.2.5 -+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` -+ then -+ echo "$SYSTEM_NAME" -+ else -+ echo rs6000-ibm-aix3.2.5 -+ fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi -- exit 0 ;; -- *:AIX:*:[45]) -+ exit ;; -+ *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 -@@ -562,28 +568,28 @@ EOF - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} -- exit 0 ;; -+ exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix -- exit 0 ;; -+ exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 -- exit 0 ;; -+ exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to -- exit 0 ;; # report: romp-ibm BSD 4.3 -+ exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx -- exit 0 ;; -+ exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 -- exit 0 ;; -+ exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd -- exit 0 ;; -+ exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 -- exit 0 ;; -+ exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in -@@ -592,52 +598,52 @@ EOF - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` -- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` -- case "${sc_cpu_version}" in -- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 -- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 -- 532) # CPU_PA_RISC2_0 -- case "${sc_kernel_bits}" in -- 32) HP_ARCH="hppa2.0n" ;; -- 64) HP_ARCH="hppa2.0w" ;; -+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` -+ case "${sc_cpu_version}" in -+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 -+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 -+ 532) # CPU_PA_RISC2_0 -+ case "${sc_kernel_bits}" in -+ 32) HP_ARCH="hppa2.0n" ;; -+ 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 -- esac ;; -- esac -+ esac ;; -+ esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build -- sed 's/^ //' << EOF >$dummy.c -+ sed 's/^ //' << EOF >$dummy.c -+ -+ #define _HPUX_SOURCE -+ #include -+ #include -+ -+ int main () -+ { -+ #if defined(_SC_KERNEL_BITS) -+ long bits = sysconf(_SC_KERNEL_BITS); -+ #endif -+ long cpu = sysconf (_SC_CPU_VERSION); - -- #define _HPUX_SOURCE -- #include -- #include -- -- int main () -- { -- #if defined(_SC_KERNEL_BITS) -- long bits = sysconf(_SC_KERNEL_BITS); -- #endif -- long cpu = sysconf (_SC_CPU_VERSION); -- -- switch (cpu) -- { -- case CPU_PA_RISC1_0: puts ("hppa1.0"); break; -- case CPU_PA_RISC1_1: puts ("hppa1.1"); break; -- case CPU_PA_RISC2_0: -- #if defined(_SC_KERNEL_BITS) -- switch (bits) -- { -- case 64: puts ("hppa2.0w"); break; -- case 32: puts ("hppa2.0n"); break; -- default: puts ("hppa2.0"); break; -- } break; -- #else /* !defined(_SC_KERNEL_BITS) */ -- puts ("hppa2.0"); break; -- #endif -- default: puts ("hppa1.0"); break; -- } -- exit (0); -- } -+ switch (cpu) -+ { -+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break; -+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break; -+ case CPU_PA_RISC2_0: -+ #if defined(_SC_KERNEL_BITS) -+ switch (bits) -+ { -+ case 64: puts ("hppa2.0w"); break; -+ case 32: puts ("hppa2.0n"); break; -+ default: puts ("hppa2.0"); break; -+ } break; -+ #else /* !defined(_SC_KERNEL_BITS) */ -+ puts ("hppa2.0"); break; -+ #endif -+ default: puts ("hppa1.0"); break; -+ } -+ exit (0); -+ } - EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa -@@ -645,9 +651,19 @@ EOF - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then -- # avoid double evaluation of $set_cc_for_build -- test -n "$CC_FOR_BUILD" || eval $set_cc_for_build -- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null -+ eval $set_cc_for_build -+ -+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating -+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler -+ # generating 64-bit code. GNU and HP use different nomenclature: -+ # -+ # $ CC_FOR_BUILD=cc ./config.guess -+ # => hppa2.0w-hp-hpux11.23 -+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess -+ # => hppa64-hp-hpux11.23 -+ -+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | -+ grep -q __LP64__ - then - HP_ARCH="hppa2.0w" - else -@@ -655,11 +671,11 @@ EOF - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} -- exit 0 ;; -+ exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} -- exit 0 ;; -+ exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -@@ -687,216 +703,269 @@ EOF - exit (0); - } - EOF -- $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 -+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && -+ { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 -- exit 0 ;; -+ exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd -- exit 0 ;; -+ exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd -- exit 0 ;; -+ exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix -- exit 0 ;; -+ exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf -- exit 0 ;; -+ exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf -- exit 0 ;; -+ exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi -- exit 0 ;; -+ exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites -- exit 0 ;; -+ exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd -- exit 0 ;; -+ exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi -- exit 0 ;; -+ exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd -- exit 0 ;; -+ exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd -- exit 0 ;; -+ exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd -- exit 0 ;; -+ exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -- exit 0 ;; -+ exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' -- exit 0 ;; -+ exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -- exit 0 ;; -+ exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -- exit 0 ;; -+ exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -- exit 0 ;; -+ exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' -- exit 0 ;; -+ exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` -- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` -- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` -- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" -- exit 0 ;; -+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` -+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` -+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" -+ exit ;; - 5000:UNIX_System_V:4.*:*) -- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` -- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` -- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" -- exit 0 ;; -+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` -+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` -+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" -+ exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:FreeBSD:*:*) -- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` -- exit 0 ;; -+ UNAME_PROCESSOR=`/usr/bin/uname -p` -+ case ${UNAME_PROCESSOR} in -+ amd64) -+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; -+ *) -+ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; -+ esac -+ exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin -- exit 0 ;; -- i*:MINGW*:*) -+ exit ;; -+ *:MINGW64*:*) -+ echo ${UNAME_MACHINE}-pc-mingw64 -+ exit ;; -+ *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 -- exit 0 ;; -+ exit ;; -+ i*:MSYS*:*) -+ echo ${UNAME_MACHINE}-pc-msys -+ exit ;; -+ i*:windows32*:*) -+ # uname -m includes "-pc" on this system. -+ echo ${UNAME_MACHINE}-mingw32 -+ exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 -- exit 0 ;; -- x86:Interix*:[34]*) -- echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' -- exit 0 ;; -+ exit ;; -+ *:Interix*:*) -+ case ${UNAME_MACHINE} in -+ x86) -+ echo i586-pc-interix${UNAME_RELEASE} -+ exit ;; -+ authenticamd | genuineintel | EM64T) -+ echo x86_64-unknown-interix${UNAME_RELEASE} -+ exit ;; -+ IA64) -+ echo ia64-unknown-interix${UNAME_RELEASE} -+ exit ;; -+ esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks -- exit 0 ;; -+ exit ;; -+ 8664:Windows_NT:*) -+ echo x86_64-pc-mks -+ exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix -- exit 0 ;; -+ exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin -- exit 0 ;; -+ exit ;; -+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) -+ echo x86_64-unknown-cygwin -+ exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin -- exit 0 ;; -+ exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` -- exit 0 ;; -+ exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` -- exit 0 ;; -+ exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu -- exit 0 ;; -+ exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix -- exit 0 ;; -+ exit ;; -+ aarch64:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ exit ;; -+ aarch64_be:Linux:*:*) -+ UNAME_MACHINE=aarch64_be -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ exit ;; -+ alpha:Linux:*:*) -+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in -+ EV5) UNAME_MACHINE=alphaev5 ;; -+ EV56) UNAME_MACHINE=alphaev56 ;; -+ PCA56) UNAME_MACHINE=alphapca56 ;; -+ PCA57) UNAME_MACHINE=alphapca56 ;; -+ EV6) UNAME_MACHINE=alphaev6 ;; -+ EV67) UNAME_MACHINE=alphaev67 ;; -+ EV68*) UNAME_MACHINE=alphaev68 ;; -+ esac -+ objdump --private-headers /bin/sh | grep -q ld.so.1 -+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi -+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} -+ exit ;; - arm*:Linux:*:*) -+ eval $set_cc_for_build -+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ -+ | grep -q __ARM_EABI__ -+ then -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ else -+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ -+ | grep -q __ARM_PCS_VFP -+ then -+ echo ${UNAME_MACHINE}-unknown-linux-gnueabi -+ else -+ echo ${UNAME_MACHINE}-unknown-linux-gnueabihf -+ fi -+ fi -+ exit ;; -+ avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -+ exit ;; - cris:Linux:*:*) -- echo cris-axis-linux-gnu -- exit 0 ;; -+ echo ${UNAME_MACHINE}-axis-linux-gnu -+ exit ;; - crisv32:Linux:*:*) -- echo crisv32-axis-linux-gnu -- exit 0 ;; -+ echo ${UNAME_MACHINE}-axis-linux-gnu -+ exit ;; - frv:Linux:*:*) -- echo frv-unknown-linux-gnu -- exit 0 ;; -- ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -- m32r*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -- m68*:Linux:*:*) -+ exit ;; -+ hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -- mips:Linux:*:*) -+ exit ;; -+ i*86:Linux:*:*) -+ LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -- #undef CPU -- #undef mips -- #undef mipsel -- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) -- CPU=mipsel -- #else -- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) -- CPU=mips -- #else -- CPU= -- #endif -+ #ifdef __dietlibc__ -+ LIBC=dietlibc - #endif - EOF -- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` -- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 -- ;; -- mips64:Linux:*:*) -+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` -+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}" -+ exit ;; -+ ia64:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ exit ;; -+ m32r*:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ exit ;; -+ m68*:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ exit ;; -+ mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU -- #undef mips64 -- #undef mips64el -+ #undef ${UNAME_MACHINE} -+ #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) -- CPU=mips64el -+ CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) -- CPU=mips64 -+ CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif - EOF -- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` -- test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 -+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` -+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; -- ppc:Linux:*:*) -- echo powerpc-unknown-linux-gnu -- exit 0 ;; -- ppc64:Linux:*:*) -- echo powerpc64-unknown-linux-gnu -- exit 0 ;; -- alpha:Linux:*:*) -- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in -- EV5) UNAME_MACHINE=alphaev5 ;; -- EV56) UNAME_MACHINE=alphaev56 ;; -- PCA56) UNAME_MACHINE=alphapca56 ;; -- PCA57) UNAME_MACHINE=alphapca56 ;; -- EV6) UNAME_MACHINE=alphaev6 ;; -- EV67) UNAME_MACHINE=alphaev67 ;; -- EV68*) UNAME_MACHINE=alphaev68 ;; -- esac -- objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null -- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi -- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} -- exit 0 ;; -+ or32:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ exit ;; -+ padre:Linux:*:*) -+ echo sparc-unknown-linux-gnu -+ exit ;; -+ parisc64:Linux:*:* | hppa64:Linux:*:*) -+ echo hppa64-unknown-linux-gnu -+ exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in -@@ -904,115 +973,71 @@ EOF - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac -- exit 0 ;; -- parisc64:Linux:*:* | hppa64:Linux:*:*) -- echo hppa64-unknown-linux-gnu -- exit 0 ;; -+ exit ;; -+ ppc64:Linux:*:*) -+ echo powerpc64-unknown-linux-gnu -+ exit ;; -+ ppc:Linux:*:*) -+ echo powerpc-unknown-linux-gnu -+ exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux -- exit 0 ;; -+ exit ;; - sh64*:Linux:*:*) -- echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -+ exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu -- exit 0 ;; -+ exit ;; -+ tile*:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ exit ;; -+ vax:Linux:*:*) -+ echo ${UNAME_MACHINE}-dec-linux-gnu -+ exit ;; - x86_64:Linux:*:*) -- echo x86_64-unknown-linux-gnu -- exit 0 ;; -- i*86:Linux:*:*) -- # The BFD linker knows what the default object file format is, so -- # first see if it will tell us. cd to the root directory to prevent -- # problems with other programs or directories called `ld' in the path. -- # Set LC_ALL=C to ensure ld outputs messages in English. -- ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ -- | sed -ne '/supported targets:/!d -- s/[ ][ ]*/ /g -- s/.*supported targets: *// -- s/ .*// -- p'` -- case "$ld_supported_targets" in -- elf32-i386) -- TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" -- ;; -- a.out-i386-linux) -- echo "${UNAME_MACHINE}-pc-linux-gnuaout" -- exit 0 ;; -- coff-i386) -- echo "${UNAME_MACHINE}-pc-linux-gnucoff" -- exit 0 ;; -- "") -- # Either a pre-BFD a.out linker (linux-gnuoldld) or -- # one that does not give us useful --help. -- echo "${UNAME_MACHINE}-pc-linux-gnuoldld" -- exit 0 ;; -- esac -- # Determine whether the default compiler is a.out or elf -- eval $set_cc_for_build -- sed 's/^ //' << EOF >$dummy.c -- #include -- #ifdef __ELF__ -- # ifdef __GLIBC__ -- # if __GLIBC__ >= 2 -- LIBC=gnu -- # else -- LIBC=gnulibc1 -- # endif -- # else -- LIBC=gnulibc1 -- # endif -- #else -- #ifdef __INTEL_COMPILER -- LIBC=gnu -- #else -- LIBC=gnuaout -- #endif -- #endif -- #ifdef __dietlibc__ -- LIBC=dietlibc -- #endif --EOF -- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` -- test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 -- test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 -- ;; -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ exit ;; -+ xtensa*:Linux:*:*) -+ echo ${UNAME_MACHINE}-unknown-linux-gnu -+ exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 -- exit 0 ;; -+ exit ;; - i*86:UNIX_SV:4.2MP:2.*) -- # Unixware is an offshoot of SVR4, but it has its own version -- # number series starting with 2... -- # I am not positive that other SVR4 systems won't match this, -+ # Unixware is an offshoot of SVR4, but it has its own version -+ # number series starting with 2... -+ # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. -- # Use sysv4.2uw... so that sysv4* matches it. -+ # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} -- exit 0 ;; -+ exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx -- exit 0 ;; -+ exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop -- exit 0 ;; -+ exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos -- exit 0 ;; -- i*86:syllable:*:*) -+ exit ;; -+ i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable -- exit 0 ;; -- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) -+ exit ;; -+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp -- exit 0 ;; -+ exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then -@@ -1020,15 +1045,16 @@ EOF - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi -- exit 0 ;; -- i*86:*:5:[78]*) -+ exit ;; -+ i*86:*:5:[678]*) -+ # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} -- exit 0 ;; -+ exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi -- exit 0 ;; -+ exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv -- exit 0 ;; -+ exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv -- exit 0 ;; -+ exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix -- exit 0 ;; -+ exit ;; - M68*:*:R3V[5678]*:*) -- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; -+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ -- && echo i486-ncr-sysv4.3${OS_REL} && exit 0 -+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ -- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; -+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) -- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ -- && echo i486-ncr-sysv4 && exit 0 ;; -+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ -+ && { echo i486-ncr-sysv4; exit; } ;; -+ NCR*:*:4.2:* | MPRAS*:*:4.2:*) -+ OS_REL='.3' -+ test -r /etc/.relid \ -+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` -+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ -+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } -+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ -+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } -+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ -+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 -- exit 0 ;; -+ exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} -- exit 0 ;; -- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) -+ exit ;; -+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 -- exit 0 ;; -+ exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 -- exit 0 ;; -+ exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` -@@ -1120,69 +1159,97 @@ EOF - else - echo ns32k-sni-sysv - fi -- exit 0 ;; -- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort -- # says -- echo i586-unisys-sysv4 -- exit 0 ;; -+ exit ;; -+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort -+ # says -+ echo i586-unisys-sysv4 -+ exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 -- exit 0 ;; -+ exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 -- exit 0 ;; -+ exit ;; -+ i*86:VOS:*:*) -+ # From Paul.Green@stratus.com. -+ echo ${UNAME_MACHINE}-stratus-vos -+ exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos -- exit 0 ;; -+ exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 -- exit 0 ;; -+ exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then -- echo mips-nec-sysv${UNAME_RELEASE} -+ echo mips-nec-sysv${UNAME_RELEASE} - else -- echo mips-unknown-sysv${UNAME_RELEASE} -+ echo mips-unknown-sysv${UNAME_RELEASE} - fi -- exit 0 ;; -+ exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos -- exit 0 ;; -+ exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos -- exit 0 ;; -+ exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos -- exit 0 ;; -+ exit ;; -+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible. -+ echo i586-pc-haiku -+ exit ;; -+ x86_64:Haiku:*:*) -+ echo x86_64-unknown-haiku -+ exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; -+ SX-7:SUPER-UX:*:*) -+ echo sx7-nec-superux${UNAME_RELEASE} -+ exit ;; -+ SX-8:SUPER-UX:*:*) -+ echo sx8-nec-superux${UNAME_RELEASE} -+ exit ;; -+ SX-8R:SUPER-UX:*:*) -+ echo sx8r-nec-superux${UNAME_RELEASE} -+ exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in -- *86) UNAME_PROCESSOR=i686 ;; -+ i386) -+ eval $set_cc_for_build -+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then -+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ -+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ -+ grep IS_64BIT_ARCH >/dev/null -+ then -+ UNAME_PROCESSOR="x86_64" -+ fi -+ fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then -@@ -1190,22 +1257,28 @@ EOF - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:QNX:*:4*) - echo i386-pc-qnx -- exit 0 ;; -+ exit ;; -+ NEO-?:NONSTOP_KERNEL:*:*) -+ echo neo-tandem-nsk${UNAME_RELEASE} -+ exit ;; -+ NSE-*:NONSTOP_KERNEL:*:*) -+ echo nse-tandem-nsk${UNAME_RELEASE} -+ exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux -- exit 0 ;; -+ exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv -- exit 0 ;; -+ exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} -- exit 0 ;; -+ exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 -@@ -1216,43 +1289,55 @@ EOF - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 -- exit 0 ;; -+ exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 -- exit 0 ;; -+ exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex -- exit 0 ;; -+ exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 -- exit 0 ;; -+ exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 -- exit 0 ;; -+ exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 -- exit 0 ;; -+ exit ;; - *:ITS:*:*) - echo pdp10-unknown-its -- exit 0 ;; -+ exit ;; - SEI:*:*:SEIUX) -- echo mips-sei-seiux${UNAME_RELEASE} -- exit 0 ;; -+ echo mips-sei-seiux${UNAME_RELEASE} -+ exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` -- exit 0 ;; -+ exit ;; - *:*VMS:*:*) -- UNAME_MACHINE=`(uname -p) 2>/dev/null` -+ UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in -- A*) echo alpha-dec-vms && exit 0 ;; -- I*) echo ia64-dec-vms && exit 0 ;; -- V*) echo vax-dec-vms && exit 0 ;; -- esac -+ A*) echo alpha-dec-vms ; exit ;; -+ I*) echo ia64-dec-vms ; exit ;; -+ V*) echo vax-dec-vms ; exit ;; -+ esac ;; -+ *:XENIX:*:SysV) -+ echo i386-pc-xenix -+ exit ;; -+ i*86:skyos:*:*) -+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' -+ exit ;; -+ i*86:rdos:*:*) -+ echo ${UNAME_MACHINE}-pc-rdos -+ exit ;; -+ i*86:AROS:*:*) -+ echo ${UNAME_MACHINE}-pc-aros -+ exit ;; -+ x86_64:VMkernel:*:*) -+ echo ${UNAME_MACHINE}-unknown-esx -+ exit ;; - esac - --#echo '(No uname command or uname output not recognized.)' 1>&2 --#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 -- - eval $set_cc_for_build - cat >$dummy.c < - printf ("m68k-sony-newsos%s\n", - #ifdef NEWSOS4 -- "4" -+ "4" - #else -- "" -+ "" - #endif -- ); exit (0); -+ ); exit (0); - #endif - #endif - - #if defined (__arm) && defined (__acorn) && defined (__unix) -- printf ("arm-acorn-riscix"); exit (0); -+ printf ("arm-acorn-riscix\n"); exit (0); - #endif - - #if defined (hp300) && !defined (hpux) -@@ -1368,11 +1453,12 @@ main () - } - EOF - --$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 -+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && -+ { echo "$SYSTEM_NAME"; exit; } - - # Apollos put the system type in the environment. - --test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } -+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - - # Convex versions that predate uname can use getsysinfo(1) - -@@ -1381,22 +1467,22 @@ then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd -- exit 0 ;; -+ exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi -- exit 0 ;; -+ exit ;; - c34*) - echo c34-convex-bsd -- exit 0 ;; -+ exit ;; - c38*) - echo c38-convex-bsd -- exit 0 ;; -+ exit ;; - c4*) - echo c4-convex-bsd -- exit 0 ;; -+ exit ;; - esac - fi - -@@ -1407,7 +1493,9 @@ This script, last modified $timestamp, h - the operating system you are using. It is advised that you - download the most up to date version of the config scripts from - -- ftp://ftp.gnu.org/pub/gnu/config/ -+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD -+and -+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - - If the version you run ($0) is already up to date, please - send the following data and any information you think might be -Index: config.sub -=================================================================== ---- config.sub.orig -+++ config.sub -@@ -1,42 +1,42 @@ - #! /bin/sh - # Configuration validation subroutine script. - # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, --# 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. -+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -+# 2011, 2012, 2013 Free Software Foundation, Inc. - --timestamp='2004-08-29' -+timestamp='2013-01-23' - --# This file is (in principle) common to ALL GNU software. --# The presence of a machine in this file suggests that SOME GNU software --# can handle that machine. It does not imply ALL GNU software can. --# --# This file is free software; you can redistribute it and/or modify --# it under the terms of the GNU General Public License as published by --# the Free Software Foundation; either version 2 of the License, or -+# This file is free software; you can redistribute it and/or modify it -+# under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 3 of the License, or - # (at your option) any later version. - # --# This program is distributed in the hope that it will be useful, --# but WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --# GNU General Public License for more details. -+# This program is distributed in the hope that it will be useful, but -+# WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# General Public License for more details. - # - # You should have received a copy of the GNU General Public License --# along with this program; if not, write to the Free Software --# Foundation, Inc., 59 Temple Place - Suite 330, --# Boston, MA 02111-1307, USA. -- -+# along with this program; if not, see . -+# - # As a special exception to the GNU General Public License, if you - # distribute this file as part of a program that contains a - # configuration script generated by Autoconf, you may include it under --# the same distribution terms that you use for the rest of that program. -+# the same distribution terms that you use for the rest of that -+# program. This Exception is an additional permission under section 7 -+# of the GNU General Public License, version 3 ("GPLv3"). -+ - --# Please send patches to . Submit a context --# diff and a properly formatted ChangeLog entry. -+# Please send patches with a ChangeLog entry to config-patches@gnu.org. - # - # Configuration subroutine to validate and canonicalize a configuration type. - # Supply the specified configuration type as an argument. - # If it is invalid, we print an error message on stderr and exit with code 1. - # Otherwise, we print the canonical config type on stdout and succeed. - -+# You can get the latest version of this script from: -+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD -+ - # This file is supposed to be the same for all GNU packages - # and recognize all the CPU types, system types and aliases - # that are meaningful with *any* GNU software. -@@ -70,8 +70,9 @@ Report bugs and patches to ) { - next if ($line =~ /^\#/); - if ($level == 1) { ---- contrib/listlease -+++ contrib/listlease 2010/09/29 10:08:10 -@@ -14,7 +14,7 @@ use strict; - my $LastLease = ''; - my $savelease = 0; - my $prlease = 0; --my $LFILE = "/var/lib/dhcp/dhcpd.leases"; -+my $LFILE = "/var/lib/dhcp/db/dhcpd.leases"; - $LFILE = $ARGV[1] if ($ARGV[1] ne ''); - - open(FILE, $LFILE); diff --git a/contrib.tar.gz b/contrib.tar.gz index 515b10f..3895b7e 100644 --- a/contrib.tar.gz +++ b/contrib.tar.gz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:699a861ef8be1a62fe1efa802ae71d9045b55bfc61b4cd76c34f94e47be4952e -size 8333 +oid sha256:60a6f23074e23d01a8658c98c79fba9c64143a54367311b381f5fa92cbef7d2f +size 8702 diff --git a/dhcp-4.1.1-P1-lpf-bind-msg-fix.diff b/dhcp-4.1.1-P1-lpf-bind-msg-fix.diff deleted file mode 100644 index 96120f2..0000000 --- a/dhcp-4.1.1-P1-lpf-bind-msg-fix.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- dhcp-4.1.1-P1/common/lpf.c -+++ dhcp-4.1.1-P1/common/lpf.c 2010/07/02 10:39:33 -@@ -92,7 +92,7 @@ int if_register_lpf (info) - if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT || - errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT || - errno == EAFNOSUPPORT || errno == EINVAL) { -- log_error ("socket: %m - make sure"); -+ log_error ("bind: %m - make sure"); - log_error ("CONFIG_PACKET (Packet socket) %s", - "and CONFIG_FILTER"); - log_error ("(Socket Filtering) are enabled %s", diff --git a/dhcp-4.2.2-quiet-dhclient.bnc711420.diff b/dhcp-4.2.2-quiet-dhclient.bnc711420.diff deleted file mode 100644 index dc27937..0000000 --- a/dhcp-4.2.2-quiet-dhclient.bnc711420.diff +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/client/dhclient.c b/client/dhclient.c -index a1cab01..ff5ede5 100644 ---- a/client/dhclient.c -+++ b/client/dhclient.c -@@ -444,6 +444,9 @@ main(int argc, char **argv) { - } else { - log_perror = 0; - quiet_interface_discovery = 1; -+#if !defined(DEBUG) -+ setlogmask(LOG_UPTO(LOG_NOTICE)); -+#endif - } - - /* If we're given a relay agent address to insert, for testing --- -1.7.3.4 - diff --git a/dhcp-4.2.3-P1-dhclient-log-pid.diff b/dhcp-4.2.3-P1-dhclient-log-pid.diff deleted file mode 100644 index 7df647d..0000000 --- a/dhcp-4.2.3-P1-dhclient-log-pid.diff +++ /dev/null @@ -1,29 +0,0 @@ -From 1f30e4707e13cb09315cbda2cf36bae099285a79 Mon Sep 17 00:00:00 2001 -From: Marius Tomaschewski -Date: Thu, 5 Jan 2012 16:25:18 +0100 -Subject: [PATCH] Use pid number in dhclient log messages - -Troubleshooting help to make it visible which client is reporting -as there may be more than one running (v4 + v6 multiple interfaces). - -Signed-off-by: Marius Tomaschewski ---- - client/dhclient.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/client/dhclient.c b/client/dhclient.c -index ff5ede5..bee8e1d 100644 ---- a/client/dhclient.c -+++ b/client/dhclient.c -@@ -141,7 +141,7 @@ main(int argc, char **argv) { - else if (fd != -1) - close(fd); - -- openlog("dhclient", LOG_NDELAY, LOG_DAEMON); -+ openlog("dhclient", LOG_NDELAY | LOG_PID, LOG_DAEMON); - - #if !(defined(DEBUG) || defined(__CYGWIN32__)) - setlogmask(LOG_UPTO(LOG_INFO)); --- -1.7.7 - diff --git a/dhcp-4.2.5-P1.tar.gz b/dhcp-4.2.5-P1.tar.gz deleted file mode 100644 index 3a0ae0d..0000000 --- a/dhcp-4.2.5-P1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:59b06c9f5d775e46999b422c45b9229402c462b114ce1685617bfb2b8b028250 -size 8255960 diff --git a/dhcp-4.2.5-P1.tar.gz.asc b/dhcp-4.2.5-P1.tar.gz.asc deleted file mode 100644 index 63c2fb0..0000000 --- a/dhcp-4.2.5-P1.tar.gz.asc +++ /dev/null @@ -1,11 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.12 (NetBSD) - -iQEcBAABAgAGBQJRS2FeAAoJEEWseFcYnNvFjYIH/3S6p2g7sqAbTJaNA81UdIQc -mw2JgfejtbNGIdBhD+iM3AazwO9zVIQfD7mpHhIgSwtBXu2kYlCOaLy+GSTRLLWv -gu1/0J2JPJTx9WoMWYEOPG/qhYYQKX+Xj7ldIFat/7ADOGCYCfZWNhsYZ79T0GCL -tj/jX2bQXDzTeEMHHywBr8MdGGzn1k6mCduyENXpmTBlLT5PfdABWku5iu6efFMS -doLZ5rUYGxxBTmbZJLZjScNI2DNH2UTIxRx58rVYPaXNi91pPRflXoIDpwiKHYfK -6uqshS8z8bMGhSMTLdm5NcWS16ABCFOTmr2RCeQ144VD8L/FNgPEj+vNTMKb9Rs= -=klp9 ------END PGP SIGNATURE----- diff --git a/dhcp-4.2.5-ldap-mt01.patch.bz2 b/dhcp-4.2.5-ldap-mt01.patch.bz2 deleted file mode 100644 index 5a20252..0000000 --- a/dhcp-4.2.5-ldap-mt01.patch.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b300b487032a9eac6a0935351ef45415d58aaf1a196408a6209f43e72e70e622 -size 16766 diff --git a/dhcp-4.2.6.tar.gz b/dhcp-4.2.6.tar.gz new file mode 100644 index 0000000..27af539 --- /dev/null +++ b/dhcp-4.2.6.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab3aaab3c938a1c0e44fd75ee4d51682d35eb8328e991006cc6ee17514bfe291 +size 8935311 diff --git a/dhcp-4.2.6.tar.gz.asc b/dhcp-4.2.6.tar.gz.asc new file mode 100644 index 0000000..0e9dcfc --- /dev/null +++ b/dhcp-4.2.6.tar.gz.asc @@ -0,0 +1,11 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.12 (NetBSD) + +iQEcBAABAgAGBQJS79gLAAoJEEWseFcYnNvFa08H+wRSA6dSHI6I86Qth7rDLvUX +JpGUILrypagAadb6a+UzpvEluhP8hg8Lex/PnskgOHDhkBqqiQLKp38B+2/LqxhU +Tx+yh9TikCLEf/I5vj6CWhZT7nip3WqfhXv+Z0EeIxsjgXPw6VEgGPpj/M6F8qqM +dmGmuzBWeXSnMEIwDGGW03dijN0ngfWl+9Be9A3l7dzfUAUVM6PwtLt72GA60K98 +/X8ZOgsRy6vOI9Nc7R6JPPD9lxx7Qp6meN0y3OtXjSZ1tvdeEjk2HGNJaNh4P/oZ +vzwi1yxAVA7JY8XPPJsBydruFfTB2Qx5M/Kn57bQOZnlWwSgXds2pEbv2JfgpYU= +=sDT9 +-----END PGP SIGNATURE----- diff --git a/dhcp.LIESMICH b/dhcp.LIESMICH deleted file mode 100644 index f4b5574..0000000 --- a/dhcp.LIESMICH +++ /dev/null @@ -1,106 +0,0 @@ -/* README.SuSE zum ISC DHCP-Server */ - -Bevor Sie dhcpd benutzen koennen, muessen Sie ihn ueber - - /etc/sysconfig/dhcpd (grundsaetzliche Einst.) -und - - /etc/dhcpd.conf (Konfigurationsdatei) -konfigurieren. Eine Beispielkonfiguration finden Sie unter -/usr/share/doc/packages/dhcp-server/ - - -Paketfilter -=========== -Dieses Paket enthaelt ein zusaetzliches dhcpd-Binary (/usr/sbin/dhcpd.bsd), das -so kompiliert ist, dass es BSD Sockets anstatt LPF (Linux Packet -Filter) verwendet. - -Mit diesem binary ist es moeglich, den Netzwerkverkehr des Servers mit dem -Paketfilter des Kernels zu filtern, waehrend die sonst verwendeten Raw Sockets -den Paketfilter umgehen. Allerdings kann es dadurch in seltenen Faellen zu -Inkompatibilitaeten mit manchen DHCP-Clients (oder dazwischengeschalteten -DHCP-Gateways) kommen. Mehr Informationen und moegliche Seiteneffekte wurden -hier diskutiert: -http://marc.theaimsgroup.com/?l=dhcp-server&m=108791973729847&w=2 - -Es besteht die Moeglichkeit, das verwendete Binary ueber DHCPD_BINARY in -/etc/sysconfig/dhcpd festzulegen. - - -Option 119 (Searchlist) -======================= -Fuer diese relativ neue Option (DHCP Option 119, RFC3397) gibt es noch keinen -direkten Support im DHCP Server. Sie muss als freie Option definiert werden, -wenn der zu sendende String im DNS-Format komprimiert wurde, und kann -folgendermassen in die Konfiguration geschrieben werden: - -option searchlist code 119 = string; -option searchlist "\x07domain1\x07example\x03com\x00\x07domain2\xc0\x08"; - -Die erste Anweisung ist immer global zu verwenden; die zweite kann sich auch in -einem Subnet befinden. - -Der komprimierte String kann mit dem Programm -/usr/share/doc/packages/dhcp-server/dnscompr.py wie folgt erzeugt werden (Beispiel): - - # python /usr/share/doc/packages/dhcp-server/dnscompr.py domain1.example.com domain2.example.com -'\x07domain1\x07example\x03com\x00\x07domain2\xc0\x08' - -dnscompr.py benoetigt das python-dnspython Paket, das mit 10.0 ausgeliefert -wird. Fuer aeltere SUSE Linux Versionen gibt es das Python-Modul unter -http://ftp.suse.com/pub/people/poeml/python-dnspython/ - -Die Kompression ist in RFC 3397 sowie, in detaillierterer Form, in RFC1035 -beschrieben. - - -Chroot-"Gefaengnis" -=================== - -Unsere Version des ISC DHCP-Servers enthaelt einen modifizierten -'non-root/chroot'-Patch nach Ari Edelkind. Damit kann der dhcpd - - - als unprivilegierter Benutzer laufen - - in einer chroot-Umgebung laufen (/var/lib/dhcp) - -was (in dieser Kombination) die sicherste Moeglichkeit ist, den Server zu -betreiben. - -Die Konfigurationsdatei muss dafuer in /var/lib/dhcp/etc liegen, und wird -deshalb vom Init-Skript beim Start automatisch dorthin kopiert. Weitere Dateien -(Include-Dateien) koennen in /etc/sysconfig/dhcpd:DHCPD_CONF_INCLUDE_FILES -aufgefuehrt werden. - -Damit der dhcp-Daemon aus der chroot-Umgebung heraus weiter loggen kann, auch -wenn der Syslog-Daemon neu gestartet wird, wird in /etc/sysconfig/syslog -automatisch "-a /var/lib/dhcp/dev/log" hinzugefuegt. - - -WICHTIG: In der chroot-Umgebung kann dhcpcd nur dann Hostnamen -aufloesen, wenn folgende Dateien vorhanden sind: - /etc/localtime - /etc/host.conf - /etc/hosts - /etc/resolv.conf - /lib/libresolv.so.2 - /lib/libnss_dns.so.2 - /lib/libnss_dns6.so.2 -Beim Start des Init-Skriptes werden diese (zus. etwa 100 kB) deshalb nach -/var/lib/dhcp/ kopiert. (Diese Dateien muessen eventuell auf dem Laufenden -gehalten werden, wenn sie durch Skript wie /etc/ppp/ip-up dynamisch modifiziert -werden.) Wenn in der Konfigurationsdatei nur IP-Adressen anstelle von Hostnamen -verwenden, sind hier keine Probleme zu erwarten. - -Das chroot-Feature kann ueber DHCPD_RUN_CHROOTED in /etc/sysconfig/dhcpd zur -Not auch abgeschaltet werden. - - -Weitere Informationen finden Sie unter - -und - . - -Have a lot of fun! - - Your SuSE Team - - diff --git a/dhcp.README b/dhcp.README index 5123ba5..c27a131 100644 --- a/dhcp.README +++ b/dhcp.README @@ -1,55 +1,21 @@ -/* README.SuSE for the ISC DHCP server */ +/* README.SUSE for the ISC DHCP server */ Before you can run dhcpd, you have to configure it via - /etc/sysconfig/dhcpd (general settings) and - - /etc/dhcpd.conf (configuration file) + - /etc/dhcpd.conf (DHCPv4 configuration file) + - /etc/dhcpd6.conf (DHCPv6 configuration file) See /usr/share/doc/packages/dhcp-server for example configurations. -Note on packet filtering -======================== -This dhcp package contains an additional dhcpd binary (/usr/sbin/dhcpd.bsd) -which is compiled using BSD sockets instead of LPF (linux packet filter). +Option 119 (domain-search) vs. option 15 (domain-name) +====================================================== -Using that binary, the network traffic handled by dhcpd can be filtered by the -packet filter of the Linux kernel, while the raw sockets used normally would -bypass any filtering. However, there is a tiny number of setups where this can -result in incompatibilities with certain DHCP clients, or with DHCP relay -agents in between. More information and a discussion of side effects was -discussed here: -See http://marc.theaimsgroup.com/?l=dhcp-server&m=108791973729847&w=2 - -It is possible to choose the binary by adjusting DHCPD_BINARY in -/etc/sysconfig/dhcpd. - - -Option 119 (Searchlist) -======================= -For this relatively new option (DHCP Option 119, RFC3397) the server does not -have a dedicated configuration option yet. It must be declared as free option, -after compressing the search string with DNS compression (see below), and put -into the configuration like this: - -option searchlist code 119 = string; -option searchlist "\x07domain1\x07example\x03com\x00\x07domain2\xc0\x08"; - -The first line is always used globally; the second one could be placed in a -subnet block. - -The compressed string can be generated with the program -/usr/share/doc/packages/dhcp-server/dnscompr.py as shown here (example): - - # python /usr/share/doc/packages/dhcp-server/dnscompr.py domain1.example.com domain2.example.com -'\x07domain1\x07example\x03com\x00\x07domain2\xc0\x08' - -dnscompr.py needs the python-dnspython package installed, which is shipping -since 10.0. For older SUSE Linux versions the python-module can be found at -http://ftp.suse.com/pub/people/poeml/python-dnspython/ - -The compression is described in RFC 3397, and (with more detail) in RFC1035. - +The domain-name option supports only one, signgle domain (default domain). +The domain-search option supports a list of domain names. Please do not +abuse the domain-name option to provide a list -- it may be discarded by +dhcp clients. Chroot Jail @@ -66,11 +32,10 @@ which, in this combination, is the safest possible way of running dhcpd. In order to be found by dhcpd in the chroot jail, the configuration file will automatically copied to /var/lib/dhcp/etc/ when the server is started. Further conf files (include files) can be listed in DHCPD_CONF_INCLUDE_FILES -in /etc/sysconfig/dhcpd. - -To enable dhcpd to continue logging from the chroot environment even after -syslogd has been restarted, "-a /var/lib/dhcp/dev/log" is automatically added to the syslog configuration in /etc/sysconfig/syslog. +or DHCPD6_CONF_INCLUDE_FILES in /etc/sysconfig/dhcpd. +The /var/lib/dhcp/dev/log syslog socked is automatically provided in the +chroot environment as soon as it is initially set up. NOTE: In the chroot jail, dhcpd can't resolve hostnames unless it can find @@ -82,6 +47,7 @@ the following files: /lib/libresolv.so.2 /lib/libnss_dns.so.2 /lib/libnss_dns6.so.2 + .... Thererore, these files (about 100 kB) will automatically copied to the chroot jail when the server is started. (You might have to keep these current if they are modified dynamically by other programs (e.g./etc/ppp/ip-up) while @@ -89,14 +55,8 @@ dhcpd is running.) This is not a problem at all when you use IP addresses instead of host names in the config file. In case of trouble, you can also disable the chroot feature by setting -DHCPD_RUN_CHROOTED in /etc/sysconfig/dhcpd to "no". - -See - -and - -for more information. +DHCPD_RUN_CHROOTED/DHCPD6_RUN_CHROOTED in /etc/sysconfig/dhcpd to "no". Have a lot of fun! - Your SuSE Team + Your SUSE Linux Team diff --git a/dhcp.README.upgrade b/dhcp.README.upgrade deleted file mode 100644 index 91233a8..0000000 --- a/dhcp.README.upgrade +++ /dev/null @@ -1,36 +0,0 @@ -When upgrading from version 2 to version 3, there are three things that are -helpful to know: - - - - you must use the ddns-update-style keyword. Either set it to "none", e.g. - like this: - - ddns-update-style none; ddns-updates off; - - If you don't have a statement about ddns at all, dhcpd-3 will not start, - and give you a message about "ddns-update-style ad-hoc;". (Don't use that - one -- the ad-hoc style is depracated. Use the interim style instead.) - - If you used DDNS with 3.0beta1 versions and want to upgrade, you can - convert the lease file with this script: - /usr/share/doc/packages/dhcp/3.0b1-lease-convert - - - - in version 3, if you define an IP address range for dynamic allocation, it - will not work for bootp by default. Contrary to version 2 you have to - explicitely allow bootp like this: - - range dynamic-bootp 192.168.0.10 192.168.0.20; - - - - version 3 will not act as an "authoritative" server by default. That means - that it will not send DHCPNAKs for addresses that can't be requested. If you - run the principal DHCP server of your network, add the - - authoritative; - - statement to the subnet declaration. - - -Apart from that, you should be able to use the same configuration as before! -Please send comments to poeml@suse.de. diff --git a/dhcp.changes b/dhcp.changes index bbbbc22..aa0d199 100644 --- a/dhcp.changes +++ b/dhcp.changes @@ -1,3 +1,37 @@ +------------------------------------------------------------------- +Mon Feb 10 17:52:15 UTC 2014 - mt@suse.com + +- Initially switched to use systemd service files under systemd + and enabled Restart=on-abort (fate#315133). +- Update to ISC dhcp-4.2.6 release. See RELNOTES file for the + complete list of changes -- digest of fixes not in dhcp-4.2.5: + - Tidy up receive packet processing. + Thanks to Brad Plank of GTA for reporting the issue and + suggesting a possible patch. [ISC-Bugs #34447] + - 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] + - Added support for gentle shutdown after signal is received. + [ISC-Bugs #32692] [ISC-Bugs 34945] + - Enhance the DHCPv6 server logging to include the addresses + that are assigned to the clients. This can be enabled by + defining LOG_V6_ADDRESSES in site.h. [ISC-Bugs #26377] + - Fix an operation in the DDNS code to be a bitwise instead + of logical or. [ISC-Bugs #35138] +- Merged patches for dhcp-4.2.6 version to apply without fuzzy, + prepended patch number prefixes to match spec file patch nr, + added patch markup tags / bug numbers to the spec file. +- Applied contrib-lease-path pach to contrib.tar.gz + [- contrib-lease-path.diff] +- Changed to require automake and use its config.sub and guess + files instead of maintaining a patch. + [- config-guess-sub-update.patch] +- Enabled to log DHCPv6 addresses assigned by server to clients + [+ 0016-server-log-DHCPv6-addresses-assigned-to-clients.patch] +- Cleaned up documentation, rpmlint adjustments. + ------------------------------------------------------------------- Fri Jan 10 12:05:22 UTC 2014 - mt@suse.com diff --git a/dhcp.spec b/dhcp.spec index 9891c2f..72ff30b 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -16,7 +16,7 @@ # -%define isc_version 4.2.5-P1 +%define isc_version 4.2.6 %define susefw2dir %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services %define omc_prefix /usr/share/omc %define omc_svcdir %{omc_prefix}/svcinfo.d @@ -26,6 +26,11 @@ %define with_ldapcasa 0%{?sles_version} >= 10 || (%suse_version >= 1110 && %suse_version < 1140) # doc package is new on 11.3 %define with_doc_package %suse_version >= 1130 +%if 0%{?suse_version} >= 1310 +%bcond_without systemd +%else +%bcond_with systemd +%endif Name: dhcp %if %{with_ldap} @@ -36,7 +41,7 @@ BuildRequires: openldap2-devel %endif BuildRequires: dos2unix BuildRequires: libtool -Version: 4.2.5.P1 +Version: 4.2.6 Release: 0. Summary: Common Files Used by ISC DHCP Software License: BSD-3-Clause @@ -46,59 +51,74 @@ Source0: dhcp-%{isc_version}.tar.gz Source1: dhcp-%{isc_version}.tar.gz.asc Source2: %{name}.keyring # -Source10: rc.dhcpd -Source11: rc.dhcpd6 -Source12: rc.dhcrelay -Source13: rc.dhcrelay6 -Source14: sysconfig.dhcpd -Source15: sysconfig.syslog-dhcpd -Source16: sysconfig.dhcrelay +Source10: dhcpd.script +Source11: dhcrelay.script +%if %{with systemd} +Source12: dhcpd.service +Source13: dhcpd6.service +Source14: dhcrelay.service +Source15: dhcrelay6.service +%else +Source12: rc.dhcpd +Source13: rc.dhcpd6 +Source14: rc.dhcrelay +Source15: rc.dhcrelay6 +%endif +Source17: sysconfig.dhcpd +Source18: sysconfig.dhcrelay Source19: if-up.d.dhcpd-restart-hook # Source20: dhclient.conf Source21: dhclient6.conf Source22: dhcpd.conf Source23: dhcpd6.conf -Source24: dhclient-script +Source26: sysconfig.syslog-dhcpd +Source27: dhclient-script # Source30: dhcpd.xml Source31: dhcpd6.xml Source32: SuSEfirewall2.dhcp-server Source33: SuSEfirewall2.dhcp6-server # -Source40: dhcp.LIESMICH Source41: dhcp.README -Source42: dhcp.README.upgrade Source43: DDNS-howto.txt Source44: contrib.tar.gz Source45: examples.tar.gz -# -Patch10: dhcp-4.1.1-default-paths.diff +Patch1: 0001-dhcp-4.1.1-default-paths.patch # paranoia patch is included now, but not the # additional patch by thomas@suse.de not ... -Patch11: dhcp-4.1.1-paranoia.diff -Patch12: dhcp-4.2.2-man-includes.diff -Patch13: dhcp-4.1.1-tmpfile.diff -Patch15: contrib-lease-path.diff -Patch20: dhcp-4.1.1-dhclient-exec-filedes.diff -Patch21: dhcp-4.2.5-dhclient-send-hostname-rml.patch -## my patch repo lives here: http://users.suse.com/~mt/dhcp-ldap/dhcp-ldap.git/ -Patch30: dhcp-4.2.5-ldap-mt01.patch.bz2 -Patch40: dhcp-4.1.1-P1-lpf-bind-msg-fix.diff -Patch44: dhcp-4.2.2-xen-checksum.diff -Patch45: dhcp-4.2.4-dhclient-option-checks.bnc675052.diff -Patch46: dhcp-4.2.2-close-on-exec.diff -Patch47: dhcp-4.2.2-quiet-dhclient.bnc711420.diff -Patch48: dhcp-4.2.3-P1-dhclient-log-pid.diff -Patch49: dhcp-4.2.4-interface-discovery-using-getifaddrs.patch -Patch50: dhcp-4.2.4-P2-do-not-die-on-sigpipe.patch +Patch2: 0002-dhcp-4.1.1-paranoia.patch +Patch3: 0003-dhcp-4.2.2-man-includes.patch +Patch4: 0004-dhcp-4.1.1-tmpfile.patch +Patch5: 0005-dhcp-4.1.1-dhclient-exec-filedes.patch +Patch6: 0006-dhcp-4.2.5-dhclient-send-hostname-rml.patch +# PATCH-FIX-UPSTREAM ldap-patch bnc#788787,bnc#784640 +Patch7: 0007-dhcp-4.2.6-ldap-mt01.patch +# PATCH-FIX-UPSTREAM lpf-bind-msg-fix bnc#617795 +Patch8: 0008-dhcp-4.1.1-P1-lpf-bind-msg-fix.patch +# PATCH-FIX-SLE xen-checksum bnc#668194 +Patch9: 0009-dhcp-4.2.6-xen-checksum.patch +# PATCH-FIX-SLE dhclient-option-checks bnc#675052 +Patch10: 0010-dhcp-4.2.2-dhclient-option-checks.patch +# PATCH-FIX-OPENSUSE close-on-exec bnc#732910 +Patch11: 0011-dhcp-4.2.6-close-on-exec.patch +# PATCH-FIX-OPENSUSE quiet-dhclient bnc#711420 +Patch12: 0012-dhcp-4.2.2-quiet-dhclient.patch +# PATCH-FIX-OPENSUSE dhclient-log-pid +Patch13: 0013-dhcp-4.2.3-P1-dhclient-log-pid.patch +# PATCH-FIX-UPSTREAM use-getifaddrs bnc#791289,ISC-Bugs#31992 +Patch14: 0014-Fixed-linux-interface-discovery-using-getifaddrs.patch +# PATCH-FIX-UPSTREAM no-die-on-SIGPIPE bnc#794578,ISC-Bugs#32222 +Patch15: 0015-Ignore-SIGPIPE-to-not-die-in-socket-code.patch +# PATCH-FEATURE-UPSTREAM log-dhcpv6-client-addresses ISC-Bugs#26377 +Patch16: 0016-server-log-DHCPv6-addresses-assigned-to-clients.patch ## -Patch60: config-guess-sub-update.patch PreReq: /bin/touch /sbin/chkconfig sysconfig BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} > 1220 BuildRequires: gpg-offline %endif +BuildRequires: automake %package server Summary: ISC DHCP Server @@ -210,24 +230,24 @@ Authors: %endif %setup -q -n %{name}-%{isc_version} -a 44 -a 45 ## +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%if %{with_ldap} +%patch7 -p1 +%endif +%patch8 -p1 +%patch9 -p1 %patch10 -p1 %patch11 -p1 %patch12 -p1 %patch13 -p1 -%patch15 -p0 -%patch20 -p1 -%patch21 -p1 -%if %{with_ldap} -%patch30 -p1 -%endif -%patch40 -p1 -%patch44 -p1 -%patch45 -p1 -%patch46 -p1 -%patch47 -p1 -%patch48 -p1 -%patch49 -p1 -%patch50 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 ## find . -type f -name \*.cat\* -exec rm -f {} \; dos2unix contrib/ms2isc/* @@ -236,7 +256,10 @@ dos2unix contrib/ms2isc/* pushd bind gunzip -c bind.tar.gz | tar xf - rm -rf bind-*/contrib/dbus -patch -p0 -d bind-* < %{P:60} +bind_dir=$(ls -1d bind-*) +for i in /usr/share/automake-*/config.{sub,guess} ; do + install -v -m755 $i $bind_dir/ +done popd ## @@ -299,15 +322,16 @@ cat bind/install.log make %{?_smp_mflags} %check -# with a minimal config, see if it runs -echo "ddns-update-style interim;" > testconf -./server/dhcpd -4 -t -cf testconf || exit 1 -./server/dhcpd -6 -t -cf testconf || exit 1 +# check example config, see if it runs +./server/dhcpd -4 -t -cf $RPM_SOURCE_DIR/dhcpd.conf +./server/dhcpd -6 -t -cf $RPM_SOURCE_DIR/dhcpd6.conf # check syntax in our scripts bash -n $RPM_SOURCE_DIR/rc.dhcpd bash -n $RPM_SOURCE_DIR/rc.dhcpd6 bash -n $RPM_SOURCE_DIR/rc.dhcrelay bash -n $RPM_SOURCE_DIR/rc.dhcrelay6 +bash -n $RPM_SOURCE_DIR/dhcpd.script +bash -n $RPM_SOURCE_DIR/dhcrelay.script bash -n $RPM_SOURCE_DIR/dhclient-script %install @@ -316,7 +340,6 @@ make install DESTDIR="$RPM_BUILD_ROOT" # # directories install -d -m0755 $RPM_BUILD_ROOT/sbin -install -d -m0755 $RPM_BUILD_ROOT%{_sysconfdir}/init.d install -d -m0755 $RPM_BUILD_ROOT%{_sysconfdir}/dhcpd{,6}.d install -d -m0755 $RPM_BUILD_ROOT/%{susefw2dir} install -d -m0755 $RPM_BUILD_ROOT/%{omc_svcdir} @@ -343,23 +366,45 @@ install -m0644 $RPM_SOURCE_DIR/dhcpd6.conf $RPM_BUILD_ROOT%{_sysconfdir}/ install -m0644 $RPM_SOURCE_DIR/dhclient.conf $RPM_BUILD_ROOT%{_sysconfdir}/ install -m0644 $RPM_SOURCE_DIR/dhclient6.conf $RPM_BUILD_ROOT%{_sysconfdir}/ install -m0750 $RPM_SOURCE_DIR/dhclient-script $RPM_BUILD_ROOT/sbin/ -# init scripts +# helper / wrapper scripts +install -d -m0755 $RPM_BUILD_ROOT/usr/lib/dhcp +install -m0755 $RPM_SOURCE_DIR/dhcpd.script \ + $RPM_BUILD_ROOT/usr/lib/dhcp/dhcpd +install -m0755 $RPM_SOURCE_DIR/dhcrelay.script \ + $RPM_BUILD_ROOT/usr/lib/dhcp/dhcrelay +%if %{with systemd} +# service units +install -d -m0755 $RPM_BUILD_ROOT%{_unitdir} +install -m0644 $RPM_SOURCE_DIR/dhcpd.service \ + $RPM_BUILD_ROOT%{_unitdir}/dhcpd.service +install -m0644 $RPM_SOURCE_DIR/dhcpd6.service \ + $RPM_BUILD_ROOT%{_unitdir}/dhcpd6.service +install -m0644 $RPM_SOURCE_DIR/dhcrelay.service \ + $RPM_BUILD_ROOT%{_unitdir}/dhcrelay.service +install -m0644 $RPM_SOURCE_DIR/dhcrelay6.service \ + $RPM_BUILD_ROOT%{_unitdir}/dhcrelay6.service +# rcservice links +ln -sf %{_sbindir}/service $RPM_BUILD_ROOT%{_sbindir}/rcdhcpd +ln -sf %{_sbindir}/service $RPM_BUILD_ROOT%{_sbindir}/rcdhcpd6 +ln -sf %{_sbindir}/service $RPM_BUILD_ROOT%{_sbindir}/rcdhcrelay +ln -sf %{_sbindir}/service $RPM_BUILD_ROOT%{_sbindir}/rcdhcrelay6 +%else +# service scripts +install -d -m0755 $RPM_BUILD_ROOT%{_sysconfdir}/init.d install -m0755 $RPM_SOURCE_DIR/rc.dhcpd \ $RPM_BUILD_ROOT%{_sysconfdir}/init.d/dhcpd -ln -sf %{_sysconfdir}/init.d/dhcpd \ - $RPM_BUILD_ROOT%{_sbindir}/rcdhcpd install -m0755 $RPM_SOURCE_DIR/rc.dhcpd6 \ $RPM_BUILD_ROOT%{_sysconfdir}/init.d/dhcpd6 -ln -sf %{_sysconfdir}/init.d/dhcpd6 \ - $RPM_BUILD_ROOT%{_sbindir}/rcdhcpd6 install -m0755 $RPM_SOURCE_DIR/rc.dhcrelay \ $RPM_BUILD_ROOT%{_sysconfdir}/init.d/dhcrelay -ln -sf %{_sysconfdir}/init.d/dhcrelay \ - $RPM_BUILD_ROOT%{_sbindir}/rcdhcrelay install -m0755 $RPM_SOURCE_DIR/rc.dhcrelay6 \ $RPM_BUILD_ROOT%{_sysconfdir}/init.d/dhcrelay6 -ln -sf %{_sysconfdir}/init.d/dhcrelay6 \ - $RPM_BUILD_ROOT%{_sbindir}/rcdhcrelay6 +# rcservice links +ln -sf %{_sysconfdir}/init.d/dhcpd $RPM_BUILD_ROOT%{_sbindir}/rcdhcpd +ln -sf %{_sysconfdir}/init.d/dhcpd6 $RPM_BUILD_ROOT%{_sbindir}/rcdhcpd6 +ln -sf %{_sysconfdir}/init.d/dhcrelay $RPM_BUILD_ROOT%{_sbindir}/rcdhcrelay +ln -sf %{_sysconfdir}/init.d/dhcrelay6 $RPM_BUILD_ROOT%{_sbindir}/rcdhcrelay6 +%endif # sysconfig files install -m0644 $RPM_SOURCE_DIR/sysconfig.dhcpd \ $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates/ @@ -388,14 +433,13 @@ ln -sf ../scripts/dhcpd-restart-hook \ # fix manual page permissions find $RPM_BUILD_ROOT/%{_mandir} -type f | xargs chmod 644 # copy some documentation and examples from src dir -install -m0644 $RPM_SOURCE_DIR/dhcp.LIESMICH LIESMICH.SuSE -install -m0644 $RPM_SOURCE_DIR/dhcp.README README.SuSE -install -m0644 $RPM_SOURCE_DIR/dhcp.README.upgrade README.upgrade +install -m0644 $RPM_SOURCE_DIR/dhcp.README README.SUSE install -m0644 $RPM_SOURCE_DIR/DDNS-howto.txt . cp doc/examples/* ./examples/ rm -f doc/{References.xml,Makefile*} rm -f contrib/dhcp.spec rm -f $RPM_BUILD_ROOT/etc/{dhcpd,dhclient}.conf.example +find contrib doc/examples -type f | xargs chmod -x # install bind libs+includes needed for dhcp-devel pushd bind install -d -m0755 $RPM_BUILD_ROOT%_includedir/ @@ -412,9 +456,16 @@ popd /usr/sbin/useradd -r -g nogroup -s /bin/false -c "DHCP server daemon" -d /var/lib/dhcp dhcpd 2> /dev/null ||: %post server +%if %{with systemd} +%{fillup_only -ans dhcpd dhcpd} +%{fillup_only -ans syslog dhcpd} +%service_add_post dhcpd.service +%service_add_post dhcpd6.service +%else %{fillup_and_insserv -n dhcpd dhcpd dhcpd6} %{fillup_only -ans syslog dhcpd} -# update? +%endif +# FIXME: update? if [ ${FIRST_ARG:-0} -gt 1 ]; then if grep -q '^DHCPD_RUN_AS=.*nobody' etc/sysconfig/dhcpd; then tmpfile=$(mktemp -q etc/sysconfig/dhcpd.XXXXXX) @@ -431,29 +482,73 @@ if [ ${FIRST_ARG:-0} -gt 1 ]; then fi %preun server -%stop_on_removal dhcpd -%stop_on_removal dhcpd6 +%if %{with systemd} +%service_del_preun dhcpd.service +%service_del_preun dhcpd6.service +%else +if test -x /etc/init.d/dhcpd ; then + %stop_on_removal dhcpd +fi +if test -x /etc/init.d/dhcpd6 ; then + %stop_on_removal dhcpd6 +fi +%endif %postun server -%restart_on_update dhcpd -%restart_on_update dhcpd6 +%if %{with systemd} +%service_del_postun dhcpd.service +%service_del_postun dhcpd6.service +%else +if test -x /etc/init.d/dhcpd ; then + %restart_on_update dhcpd +fi +if test -x /etc/init.d/dhcpd6 ; then + %restart_on_update dhcpd6 +fi %insserv_cleanup +%endif %post relay +# %{rename_sysconfig_variable -f etc/sysconfig/dhcrelay DHCRELAY6_LOWER_INTERFACES_ARGS DHCRELAY6_LOWER_INTERFACES} %{rename_sysconfig_variable -f etc/sysconfig/dhcrelay DHCRELAY6_UPPER_INTERFACES_ARGS DHCRELAY6_UPPER_INTERFACES} +# +%if %{with systemd} +%{fillup_only -n dhcrelay dhcrelay} +%service_add_post dhcrelay.service +%service_add_post dhcrelay6.service +%else %{fillup_and_insserv -n dhcrelay dhcrelay dhcrelay6} +%endif %preun relay -%stop_on_removal dhcrelay -%stop_on_removal dhcrelay6 +%if %{with systemd} +%service_del_preun dhcrelay.service +%service_del_preun dhcrelay6.service +%else +if test -x /etc/init.d/dhcrelay ; then + %stop_on_removal dhcrelay +fi +if test -x /etc/init.d/dhcrelay6 ; then + %stop_on_removal dhcrelay6 +fi +%endif %postun relay -%restart_on_update dhcrelay -%restart_on_update dhcrelay6 +%if %{with systemd} +%service_del_postun dhcrelay.service +%service_del_postun dhcrelay6.service +%else +if test -x /etc/init.d/dhcrelay ; then + %restart_on_update dhcrelay +fi +if test -x /etc/init.d/dhcrelay6 ; then + %restart_on_update dhcrelay6 +fi %insserv_cleanup +%endif %post client test -e %{_localstatedir}/lib/dhcp/dhclient.leases || \ @@ -479,12 +574,19 @@ if ! test -f /.buildenv; then rm -rf $RPM_BUILD_ROOT; fi %{_sbindir}/dhcpd6 %{_sbindir}/rcdhcpd %{_sbindir}/rcdhcpd6 +%if %{with systemd} +%{_unitdir}/dhcpd.service +%{_unitdir}/dhcpd6.service +%else %config %{_sysconfdir}/init.d/dhcpd %config %{_sysconfdir}/init.d/dhcpd6 +%endif %config(noreplace) %{_sysconfdir}/dhcpd.conf %config(noreplace) %{_sysconfdir}/dhcpd6.conf %attr(755,root,root) %dir %config(noreplace) %ghost %{_sysconfdir}/dhcpd.d/ %attr(755,root,root) %dir %config(noreplace) %ghost %{_sysconfdir}/dhcpd6.d/ +%dir /usr/lib/dhcp +/usr/lib/dhcp/dhcpd %dir %{_localstatedir}/lib/dhcp %dir %{_localstatedir}/lib/dhcp/etc %dir %{_localstatedir}/lib/dhcp/dev @@ -519,8 +621,7 @@ if ! test -f /.buildenv; then rm -rf $RPM_BUILD_ROOT; fi %defattr(-,root,root) %endif %doc LICENSE README RELNOTES -%doc LIESMICH.* README.* -%doc DDNS-howto.txt doc/* +%doc README.* DDNS-howto.txt doc/* %doc contrib examples %files client @@ -543,8 +644,15 @@ if ! test -f /.buildenv; then rm -rf $RPM_BUILD_ROOT; fi %{_sbindir}/dhcrelay6 %{_sbindir}/rcdhcrelay %{_sbindir}/rcdhcrelay6 +%dir /usr/lib/dhcp +/usr/lib/dhcp/dhcrelay +%if %{with systemd} +%{_unitdir}/dhcrelay.service +%{_unitdir}/dhcrelay6.service +%else %config %{_sysconfdir}/init.d/dhcrelay %config %{_sysconfdir}/init.d/dhcrelay6 +%endif %doc %{_mandir}/man8/dhcrelay.8.gz %{_localstatedir}/adm/fillup-templates/sysconfig.dhcrelay diff --git a/dhcpd.script b/dhcpd.script new file mode 100644 index 0000000..0402896 --- /dev/null +++ b/dhcpd.script @@ -0,0 +1,475 @@ +#! /bin/bash +# Copyright (c) 1996, 1997, 1998 S.u.S.E. GmbH +# Copyright (c) 1998, 1999, 2000, 2001 SuSE GmbH +# Copyright (c) 2002, 2003 SuSE Linux AG +# Copyright (c) 2004-2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . +# +# Author: Rolf Haberrecker , 1997-1999 +# Peter Poeml , 2000-2006 +# Marius Tomaschewski , 2006-2010 +# +# /usr/lib/dhcp/dhcpd helper script, fromer /etc/init.d/dhcpd init script. +# +### +test -s /etc/sysconfig/dhcpd && . /etc/sysconfig/dhcpd + +SUPPORTS_CHROOT="yes" +SUPPORTS_RUN_AS="yes" +SUPPORTS_HUP="no" + +# note: $DAEMON_PIDFILE is a symlink to the +# $DAEMON_STATE$DAEMON_PIDFILE (also +# while DHCPD_RUN_CHROOTED=no) now, +# as DHCPD_RUN_AS is not allowed to +# create pid files in /var/run. + +DHCPv_OPT=$1 ; shift +case $DHCPv_OPT in +-4) + DAEMON='ISC DHCPv4 Server' + DAEMON_BIN=/usr/sbin/dhcpd + DAEMON_CONF=/etc/dhcpd.conf + DAEMON_STATE=/var/lib/dhcp + DAEMON_LEASES=dhcpd.leases + DAEMON_PIDFILE=/var/run/dhcpd.pid + STARTPROC_LOGFILE=/var/log/rc.dhcpd.log + LDAP_CONF=/etc/openldap/ldap.conf + + test "$DHCPD_RUN_CHROOTED" = "yes" && \ + CHROOT_PREFIX="$DAEMON_STATE" || CHROOT_PREFIX='' + + DHCPD_CONF_INCLUDE_FILES=${DHCPD_CONF_INCLUDE_FILES:-/etc/dhcpd.d} +;; +-6) + DAEMON='ISC DHCPv6 Server' + DAEMON_BIN=/usr/sbin/dhcpd + DAEMON_CONF=/etc/dhcpd6.conf + DAEMON_STATE=/var/lib/dhcp6 + DAEMON_LEASES=dhcpd6.leases + DAEMON_PIDFILE=/var/run/dhcpd6.pid + STARTPROC_LOGFILE=/var/log/rc.dhcpd6.log + LDAP_CONF="" + + test "$DHCPD6_RUN_CHROOTED" = "yes" && \ + CHROOT_PREFIX="$DAEMON_STATE" || CHROOT_PREFIX='' + + DHCPD_RUN_AS=$DHCPD6_RUN_AS + DHCPD_INTERFACE=$DHCPD6_INTERFACE + DHCPD_OTHER_ARGS=$DHCPD6_OTHER_ARGS + DHCPD_CONF_INCLUDE_FILES=${DHCPD6_CONF_INCLUDE_FILES:-/etc/dhcpd6.d} +;; +*) + echo >&2 "Usage: $0 <-4|-6> " + exit 2 +;; +esac + +# Shell functions sourced from /etc/rc.status: +# rc_check check and set local and overall rc status +# rc_status check and set local and overall rc status +# rc_status -v ditto but be verbose in local rc status +# rc_status -v -r ditto and clear the local rc status +# rc_failed set local and overall rc status to failed +# rc_failed set local and overall rc status to +# rc_reset clear local rc status (overall remains) +# rc_exit exit appropriate to overall rc status +. /etc/rc.status + +# First reset status of this service +rc_reset + +# Return values acc. to LSB for all commands but status: +# 0 - success +# 1 - generic or unspecified error +# 2 - invalid or excess argument(s) +# 3 - unimplemented feature (e.g. "reload") +# 4 - insufficient privilege +# 5 - program is not installed +# 6 - program is not configured +# 7 - program is not running +# +# Note that starting an already running service, stopping +# or restarting a not-running service as well as the restart +# with force-reload (in case signalling is not supported) are +# considered a success. + +if ! [ -x "$DAEMON_BIN" ]; then + case $1 in + stop) ;; + *) echo -n >&2 "\"$DAEMON_BIN\" is not an executable file. Exiting." + case $1 in + status) rc_failed 4 ;; + *) rc_failed 5 ;; + esac + rc_status -v + ;; + esac + rc_exit +fi +if ! [ -r "$DAEMON_CONF" ] ; then + case $1 in + stop|status) + if test ! -s /etc/sysconfig/dhcpd ; then + test -e $DAEMON_STATE/$DAEMON_PIDFILE && \ + CHROOT_PREFIX="$DAEMON_STATE" || CHROOT_PREFIX='' + fi + ;; + *) + echo -n >&2 "\"$DAEMON_CONF\" config file missed. Exiting." + rc_failed 6 + rc_status -v + rc_exit + ;; + esac +fi + +# remove empty pid files to avoid disturbing warnings by checkproc/killproc +# (these can occur if dhcpd does not start correctly) +test -e $DAEMON_PIDFILE && ! test -s $DAEMON_PIDFILE && rm $DAEMON_PIDFILE +test -e $DAEMON_STATE/$DAEMON_PIDFILE && ! test -s $DAEMON_STATE/$DAEMON_PIDFILE && rm $DAEMON_STATE/$DAEMON_PIDFILE + +case "$1" in + start) + echo -n "Starting $DAEMON " + + ## If there is no conf file, skip starting of dhcpd + ## and return with "program not configured" + if ! [ -f $DAEMON_CONF ]; then + echo -n "... no configuration file found"; + # Tell the user this has skipped + rc_status -s + # service is not configured + exit 6; + fi + + ## If the interfaces are not set, skip starting of dhcpd + ## and return with "program not configured" + if [ -z "$DHCPD_INTERFACE" ]; then + var="DHCPD_INTERFACE" + case $DHCPv_OPT in -6) var=DHCPD6_INTERFACE ;; esac + echo -n "... set $var in /etc/sysconfig/dhcpd" + # Tell the user this has skipped + rc_status -s + # service is not configured + exit 6; + fi + + if [ "$DHCPD_INTERFACE" = "ANY" ]; then + DHCPD_INTERFACE="" + fi + + jail=${CHROOT_PREFIX:-${DAEMON_STATE}}; leases=$DAEMON_LEASES + if ! [ -e $jail/db/$leases ]; then + # until 9.0, the lease file was in /var/lib/dhcp and part of the package + if test -e $jail/$leases -a '!' -L $jail/$leases; then + # this is the case where the %post script runs _before_ the old package is + # removed (i.e., dhcpd.leases has not renamed to .rpmsave yet) + mv $jail/$leases $jail/db/$leases && \ + ln -s db/$leases $jail/ + elif test -e $jail/$leases.rpmsave; then + # this is what's left when the package is already gone. + mv $jail/$leases.rpmsave $jail/db/$leases && \ + ln -s db/$leases $jail/ + else + # fresh installation: + # a lease file must be present. the server won't start without + touch $jail/db/$leases + fi + fi + + if test "$DHCPD_RUN_CHROOTED" = "yes" ; then + ## copy the conf file to the chroot jail (dhcpd has to be restarted anyway, + ## when it has changed) and change path to leases file + for i in $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES $LDAP_CONF /etc /dev; do + if test -d "${i}" ; then + test -d "$CHROOT_PREFIX/${i}" || \ + mkdir -p "$CHROOT_PREFIX/${i}" + elif test -e "${i}" ; then + test -d "$CHROOT_PREFIX/${i%/*}" || \ + mkdir -p "$CHROOT_PREFIX/${i%/*}" + fi + done + rm -f $CHROOT_PREFIX/dev/urandom + for i in $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES $LDAP_CONF /etc/{gai.conf,nsswitch.conf,resolv.conf,host.conf,hosts,localtime,bindresvport.blacklist} /dev/urandom; do + if ! test -e "$i"; then continue; fi # neither of them is absolutely necessary + cp -aL "$i" "${CHROOT_PREFIX}/${i%/*}/" &>/dev/null \ + || { echo "...$0:$LINENO: could not copy $i to chroot jail"; rc_failed; rc_status -v1; exit 6; } + done + libdir=$(basename $(echo ${CHROOT_PREFIX}/lib*)) + if test -x /usr/bin/ldd ; then + get_ldd_deps() + { + ldd_wl="\/${libdir}\/lib" + ldd_bl="\/${libdir}\/libc\." + /usr/bin/ldd "$1" | \ + while read -sr a b c d ; do + [ -n "$c" ] || continue + [[ $c =~ $ldd_wl ]] || continue + [[ $c =~ $ldd_bl ]] && continue + echo $c + done + } + else + get_ldd_deps() { :; } + fi + cplibs=`for i in /$libdir/{libresolv.so.*,libnss_*.so.*} \ + /$libdir/{libpthread.so.0,libdl.so.2,libgcc_s.so.*} ; + do + if [ -s "$i" ] ; then + echo "$i" + get_ldd_deps "$i" + fi + done | sort -u` + for i in $cplibs ; do + if [ -s "$i" ]; then + cp -pL "$i" "${CHROOT_PREFIX}/$libdir/" \ + || { echo "...$0:$LINENO: could not copy $i to chroot jail"; rc_failed; rc_status -v1; exit 6; } + fi + done + + # mount /proc into the chroot; the server fails if unable to read /proc/net/{dev,if_inet6} + mkdir -p ${CHROOT_PREFIX}/proc + mount -t proc -o ro proc ${CHROOT_PREFIX}/proc 2>/dev/null + + DHCPD_ARGS="-chroot $CHROOT_PREFIX -lf /db/$DAEMON_LEASES" + + ## If there is a pid file containing a pid, the machine might have crashed. pid files in + ## /var/run are always cleaned up at boot time, but this is not the case for the pid file in + ## the chroot jail. Therefore, and old pid file may exist. This is only a problem if it + ## incidentally contains the pid of a running process. If this process is not a 'dhcpd', + ## we remove the pid. (dhcpd itself only checks whether the pid is alive or not.) + if test -s $DAEMON_STATE/$DAEMON_PIDFILE; then + p=$(<$DAEMON_STATE/$DAEMON_PIDFILE) + if test -n "$p" && grep -qsE "^${DAEMON_BIN}" "/proc/$p/cmdline" ; then + echo -n '(already running) ' + else + rm -f $DAEMON_STATE/$DAEMON_PIDFILE + fi + fi + PID_FILE_ARG="$DAEMON_PIDFILE" + else + DHCPD_ARGS="-lf ${DAEMON_STATE}/db/$DAEMON_LEASES" + PID_FILE_ARG="$DAEMON_STATE$DAEMON_PIDFILE" + fi + + if [ -n "$DHCPD_RUN_AS" ]; then + DHCPD_RUN_AS_GROUP="$(getent group $(getent passwd $DHCPD_RUN_AS | cut -d: -f4) | cut -d: -f1)" + DHCPD_ARGS="$DHCPD_ARGS -user $DHCPD_RUN_AS -group $DHCPD_RUN_AS_GROUP" + + chown "${DHCPD_RUN_AS}:${DHCPD_RUN_AS_GROUP}" \ + "$DAEMON_STATE/${DAEMON_PIDFILE%/*}" + fi + + + ## check syntax with -t (output to log file) and start only when the syntax is okay + rm -f $STARTPROC_LOGFILE # start log + error=0 + if ! $DAEMON_BIN $DHCPv_OPT -t -cf $CHROOT_PREFIX/$DAEMON_CONF -pf $PID_FILE_ARG > $STARTPROC_LOGFILE 2>&1 ; then + error=1 + else + ## Start daemon. If this fails the return value is set appropriate. + ## The init script should return 0, even if service is already running, + ## to match the LSB spec. + + test "$2" = "-v" && echo -en \ + "\nexecuting '$DAEMON_BIN $DHCPv_OPT -cf $DAEMON_CONF -pf $PID_FILE_ARG $DHCPD_ARGS $DHCPD_OTHER_ARGS $DHCPD_INTERFACE'" + + $DAEMON_BIN $DHCPv_OPT -cf $DAEMON_CONF -pf $PID_FILE_ARG $DHCPD_ARGS $DHCPD_OTHER_ARGS $DHCPD_INTERFACE &> $STARTPROC_LOGFILE + ret=$? + fi + + if [ $error -gt 0 -o ${ret:-0} -gt 0 ]; then + ## be verbose + echo "" + echo -n " please see $STARTPROC_LOGFILE for details " + ## set status to failed + rc_failed + else + ln -sf "$DAEMON_STATE$DAEMON_PIDFILE" "$DAEMON_PIDFILE" + [ "$DHCPD_RUN_CHROOTED" = "yes" ] && echo -n "[chroot]" || : + fi + + # Remember status and be verbose + rc_status -v + ;; + stop) + echo -n "Shutting down $DAEMON " + + # Catch the case where daemon is running without chroot, + # but sysconfig/dhcp has been changed to use chroot (and + # another way around). + # In this case is there is no $chroot/$pidfile, but there + # should be a /pidfile that we use instead. + # We can not kill without pid file or dhcp4 kills dhcp6. + PID_FILE="$DAEMON_STATE$DAEMON_PIDFILE" + if test "$DHCPD_RUN_CHROOTED" = "yes" ; then + if test ! -s "$DAEMON_STATE$DAEMON_PIDFILE" -a \ + -s "$DAEMON_PIDFILE" ; then + PID_FILE="$DAEMON_PIDFILE" + fi + else + if test ! -s "$DAEMON_PIDFILE" -a \ + -s "$DAEMON_STATE$DAEMON_PIDFILE" ; then + PID_FILE="$DAEMON_STATE$DAEMON_PIDFILE" + fi + fi + + ## Stop daemon with killproc(8) and if this fails + ## set echo the echo return value. + killproc -p "$PID_FILE" $DAEMON_BIN + ret=$? + + # umount proc and remove libraries from the chroot jail, + # so they are not left over if the server is deinstalled + if [ "$DHCPD_RUN_CHROOTED" = yes -a -n "$CHROOT_PREFIX" ]; then + umount ${CHROOT_PREFIX}/proc 2>/dev/null + rm -f $CHROOT_PREFIX/lib*/* + fi + + # Remember status and be verbose + rc_failed $ret + rc_status -v + ;; + try-restart) + ## Do a restart only if the service was active before. + ## Note: try-restart is now part of LSB (as of 1.9). + ## RH has a similar command named condrestart. + $0 $DHCPv_OPT status + if test $? = 0; then + $0 $DHCPv_OPT restart + else + rc_reset # Not running is not a failure. + fi + # Remember status and be quiet + rc_status + ;; + restart) + ## Check syntax and when it is OK, stop the service + ## and regardless of whether it was running or not, + ## start it again. + if ! $0 $DHCPv_OPT check-syntax &>/dev/null ; then + echo -n "Syntax check reports errors, see log messages" + rc_failed + rc_status -v + else + $0 $DHCPv_OPT stop + sleep 3 + $0 $DHCPv_OPT start + # Remember status and be quiet + rc_status + fi + ;; + force-reload) + ## Signal the daemon to reload its config. Most daemons + ## do this on signal 1 (SIGHUP). + ## If it does not support it, restart. + + if [ "$SUPPORTS_HUP" = "yes" ]; then + echo -n "Reload service $DAEMON" + killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN + #touch $DAEMON_STATE/$DAEMON_PIDFILE + rc_status -v + elif ! $0 $DHCPv_OPT check-syntax &>/dev/null ; then + echo -n "Syntax check reports errors, see log messages" + rc_failed + rc_status -v + else + $0 $DHCPv_OPT stop && sleep 3 && $0 $DHCPv_OPT start + rc_status + fi + ;; + reload) + ## Like force-reload, but if daemon does not support + ## signalling, do nothing (!) + + echo -n "Reload service $DAEMON" + if [ "$SUPPORTS_HUP" = "yes" ]; then + # If it supports signalling: + killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN + #touch $DAEMON_STATE/$DAEMON_PIDFILE + rc_status -v + else + ## Otherwise if it does not support reload: + rc_failed 3 + rc_status -v + fi + ;; + status) + echo -n "Checking for $DAEMON: " + ## Check status with checkproc(8), if process is running + ## checkproc will return with exit status 0. + + # Status has a slightly different for the status command: + # 0 - service running + # 1 - service dead, but /var/run/ pid file exists + # 2 - service dead, but /var/lock/ lock file exists + # 3 - service not running + + # NOTE: checkproc returns LSB compliant status values. + checkproc -p $DAEMON_STATE/$DAEMON_PIDFILE $DAEMON_BIN + rc_status -v + ;; + probe) + ## Optional: Probe for the necessity of a reload, + ## give out the argument which is required for a reload. + + rc=0 + for i in /etc/sysconfig/dhcpd $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES; do + test $i -nt $DAEMON_STATE/$DAEMON_PIDFILE && rc=1 + done + test $rc = 1 && echo restart + ;; + check-syntax|syntax-check) + echo -n "Checking syntax of $DAEMON_CONF: " + + ## this nice bit is from Edwin Groothuis: + ## check syntax (quiet) + $DAEMON_BIN $DHCPv_OPT -q -t -cf $DAEMON_CONF + rc_status + if [ $? -ne 0 ]; then + echo "" + ## check syntax (verbose) + $DAEMON_BIN $DHCPv_OPT -t -cf $DAEMON_CONF + echo -ne '\nConfig is NOT okay' + rc_failed + fi + rc_status -v + ;; + check-lease|check-lease-file) + echo -n "Checking lease file $DAEMON_LEASES: " + + if [ -s ${DAEMON_STATE}/db/$DAEMON_LEASES ] ; then + ## check leases file (quiet) + $DAEMON_BIN $DHCPv_OPT -q -T -cf /dev/null -lf ${DAEMON_STATE}/db/$DAEMON_LEASES + rc_status + if [ $? -ne 0 ]; then + echo "" + ## check leases file (verbose) + $DAEMON_BIN $DHCPv_OPT -T -cf $DAEMON_CONF -lf ${DAEMON_STATE}/db/$DAEMON_LEASES + echo -ne '\nLease file is NOT okay' + rc_failed + fi + else + rc_status -u + fi + rc_status -v + ;; + *) + SCRIPT="${SCRIPT:-${0##*/} $DHCPv_OPT}" + echo "Usage: $SCRIPT {start|stop|status|try-restart|restart|force-reload|reload|probe|check-syntax} [-v]" + exit 1 +esac +rc_exit diff --git a/dhcpd.service b/dhcpd.service new file mode 100644 index 0000000..8e0c703 --- /dev/null +++ b/dhcpd.service @@ -0,0 +1,15 @@ +[Unit] +Description=ISC DHCPv4 Server +Before=multi-user.target +After=remote-fs.target network.target nss-lookup.target time-sync.target ldap.service ndsd.service + +[Service] +Type=forking +Restart=on-abort +ExecStart=/usr/lib/dhcp/dhcpd -4 start +ExecStop=/usr/lib/dhcp/dhcpd -4 stop + +[Install] +WantedBy=multi-user.target +Alias=dhcp-server.service + diff --git a/dhcpd6.service b/dhcpd6.service new file mode 100644 index 0000000..87784ae --- /dev/null +++ b/dhcpd6.service @@ -0,0 +1,15 @@ +[Unit] +Description=ISC DHCPv6 Server +Before=multi-user.target +After=remote-fs.target network.target nss-lookup.target time-sync.target ldap.service ndsd.service + +[Service] +Type=forking +Restart=on-abort +ExecStart=/usr/lib/dhcp/dhcpd -6 start +ExecStop=/usr/lib/dhcp/dhcpd -6 stop + +[Install] +WantedBy=multi-user.target +Alias=dhcp6-server.service + diff --git a/dhcrelay.script b/dhcrelay.script new file mode 100644 index 0000000..615cbc8 --- /dev/null +++ b/dhcrelay.script @@ -0,0 +1,249 @@ +#! /bin/sh +# Copyright (c) 1996, 1997, 1998 S.u.S.E. GmbH +# Copyright (c) 1998, 1999, 2000, 2001 SuSE GmbH +# Copyright (c) 2002 SuSE Linux AG +# Copyright (c) 2003-2014 SUSE LINUX Products GmbH +# +# Author: Peter Poeml , 2001 +# Marius Tomaschewski , 2010 +# +# /usr/lib/dhcp/dhcrelay helper, +# fromer /etc/init.d/dhcrelay init script +# +### + +DHCPv_OPT=$1 ; shift +case $DHCPv_OPT in +-4) + DAEMON="ISC DHCPv4 relay agent" + DAEMON_BIN=/usr/sbin/dhcrelay + DAEMON_CONF=/etc/sysconfig/dhcrelay + DAEMON_PIDFILE=/var/run/dhcrelay.pid + STARTPROC_LOGFILE=/var/log/rc.dhcrelay.log + SUPPORTS_HUP="no" +;; +-6) + DAEMON="ISC DHCPv6 relay agent" + DAEMON_BIN=/usr/sbin/dhcrelay6 + DAEMON_CONF=/etc/sysconfig/dhcrelay + DAEMON_PIDFILE=/var/run/dhcrelay6.pid + STARTPROC_LOGFILE=/var/log/rc.dhcrelay6.log +;; +*) + echo >&2 "Usage: $0 <-4|-6> " + exit 2 +;; +esac + +test -s "$DAEMON_CONF" && . "$DAEMON_CONF" +if ! [ -x "$DAEMON_BIN" ]; then + case $1 in + stop) ;; + *) echo -n >&2 "$0: \"$DAEMON_BIN\" is not an executable file. Exiting." + case $1 in + status) rc_failed 4 ;; + *) rc_failed 5 ;; + esac + rc_status -v + ;; + esac + rc_exit +fi + +# Shell functions sourced from /etc/rc.status: +# rc_check check and set local and overall rc status +# rc_status check and set local and overall rc status +# rc_status -v ditto but be verbose in local rc status +# rc_status -v -r ditto and clear the local rc status +# rc_failed set local and overall rc status to failed +# rc_failed set local and overall rc status to +# rc_reset clear local rc status (overall remains) +# rc_exit exit appropriate to overall rc status +. /etc/rc.status + +# First reset status of this service +rc_reset + +# Return values acc. to LSB for all commands but status: +# 0 - success +# 1 - generic or unspecified error +# 2 - invalid or excess argument(s) +# 3 - unimplemented feature (e.g. "reload") +# 4 - insufficient privilege +# 5 - program is not installed +# 6 - program is not configured +# 7 - program is not running +# +# Note that starting an already running service, stopping +# or restarting a not-running service as well as the restart +# with force-reload (in case signalling is not supported) are +# considered a success. + +case "$1" in + start) + echo -n "Starting $DAEMON" + checkproc -p $DAEMON_PIDFILE $DAEMON_BIN && { + echo -n "... already running"; rc_status -v; exit 0; + } + + case $DHCPv_OPT in + -4) + ## If interfaces or servers are not set, skip starting of dhcrelay + ## and return with "program not configured" + if [ -z "$DHCRELAY_INTERFACES" -o -z "$DHCRELAY_SERVERS" ]; then + # Tell the user this has skipped + rc_status -s + # service is not configured + exit 6; + fi + + DHCRELAY_INTERFACES_ARGS='' + for i in $DHCRELAY_INTERFACES ; do + DHCRELAY_INTERFACES_ARGS="$DHCRELAY_INTERFACES_ARGS -i $i" + done + + DHCRELAY_ARGS="$DHCRELAY_INTERFACES_ARGS $DHCRELAY_SERVERS" + ;; + -6) + DHCRELAY6_LOWER_INTERFACES_ARGS='' + for l in $DHCRELAY6_LOWER_INTERFACES ; do + test "x$l" = x -o "x$l" = "x-l" && continue + DHCRELAY6_LOWER_INTERFACES_ARGS="$DHCRELAY6_LOWER_INTERFACES_ARGS -l $l" + done + DHCRELAY6_UPPER_INTERFACES_ARGS='' + for u in $DHCRELAY6_UPPER_INTERFACES ; do + test "x$u" = x -o "x$u" = "x-u" && continue + DHCRELAY6_UPPER_INTERFACES_ARGS="$DHCRELAY6_UPPER_INTERFACES_ARGS -u $u" + done + if [ "x$DHCRELAY6_LOWER_INTERFACES_ARGS" = x -o \ + "x$DHCRELAY6_UPPER_INTERFACES_ARGS" = x ]; then + # Tell the user this has skipped + rc_status -s + # service is not configured + exit 6; + fi + DHCRELAY_ARGS="$DHCRELAY6_LOWER_INTERFACES_ARGS $DHCRELAY6_UPPER_INTERFACES_ARGS" + ;; + esac + ## Start daemon with startproc(8). If this fails + ## the echo return value is set appropriate. + + # startproc should return 0, even if service is + # already running to match LSB spec. + test "$2" = "-v" && echo -en \ + "\nexecuting '$DAEMON_BIN $DHCPv_OPT $DHCRELAY_OPTIONS $DHCRELAY_ARGS'" + startproc -q -l $STARTPROC_LOGFILE -p $DAEMON_PIDFILE $DAEMON_BIN $DHCPv_OPT $DHCRELAY_OPTIONS $DHCRELAY_ARGS &>/dev/null + rc=$? + if ! [ $rc -eq 0 ]; then + ## be verbose + echo "" + echo -n " please see $STARTPROC_LOGFILE for details " + ## set status to failed + rc_failed + fi + + # Remember status and be verbose + rc_status -v + ;; + stop) + echo -n "Shutting down $DAEMON" + ## Stop daemon with killproc(8) and if this fails + ## set echo the echo return value. + + killproc -p $DAEMON_PIDFILE $DAEMON_BIN + + # Remember status and be verbose + rc_status -v + ;; + try-restart) + ## Do a restart only if the service was active before. + ## Note: try-restart is now part of LSB (as of 1.9). + ## RH has a similar command named condrestart. + $0 status + if test $? = 0; then + $0 restart + else + rc_reset # Not running is not a failure. + fi + # Remember status and be quiet + rc_status + ;; + restart) + ## Stop the service and regardless of whether it was + ## running or not, start it again. + $0 stop + sleep 1 + $0 start + + # Remember status and be quiet + rc_status + ;; + force-reload) + ## Signal the daemon to reload its config. Most daemons + ## do this on signal 1 (SIGHUP). + ## If it does not support it, restart. + + $0 stop && sleep 1 && $0 start + rc_status + + echo -n "Reload service $DAEMON" + + if [ "$SUPPORTS_HUP" = "yes" ] ; then + killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN + #touch $DAEMON_PIDFILE + rc_status -v + else + $0 stop && $0 start + rc_status + fi + ;; + reload) + ## Like force-reload, but if daemon does not support + ## signalling, do nothing (!) + + if [ "$SUPPORTS_HUP" = "yes" ] ; then + # If it supports signalling: + echo -n "Reload service $DAEMON" + killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN + #touch $DAEMON_PIDFILE + rc_status -v + else + ## Otherwise if it does not support reload: + rc_failed 3 + rc_status -v + fi + ;; + status) + echo -n "Checking for dhcp relay agent: " + ## Check status with checkproc(8), if process is running + ## checkproc will return with exit status 0. + + # Status has a slightly different for the status command: + # 0 - service running + # 1 - service dead, but /var/run/ pid file exists + # 2 - service dead, but /var/lock/ lock file exists + # 3 - service not running + + # NOTE: checkproc returns LSB compliant status values. + checkproc -p $DAEMON_PIDFILE $DAEMON_BIN + rc_status -v + ;; + probe) + ## Optional: Probe for the necessity of a reload, + ## give out the argument which is required for a reload. + + if [ "$DAEMON_CONF" -nt "$DAEMON_PIDFILE" ]; then + if [ "$SUPPORTS_HUP" = "yes" ]; then + echo reload + else + echo restart + fi + fi + ;; + *) + SCRIPT="${SCRIPT:-${0##*/} $DHCPv_OPT}" + echo "Usage: $SCRIPT {start|stop|status|try-restart|restart|force-reload|reload|probe} [-v]" + exit 1 + ;; +esac +rc_exit diff --git a/dhcrelay.service b/dhcrelay.service new file mode 100644 index 0000000..60477d6 --- /dev/null +++ b/dhcrelay.service @@ -0,0 +1,15 @@ +[Unit] +Description=ISC DHCPv4 Relay Agent +Before=multi-user.target +After=remote-fs.target network.target nss-lookup.target time-sync.target ldap.service ndsd.service + +[Service] +Type=forking +Restart=on-abort +ExecStart=/usr/lib/dhcp/dhcrelay -4 start +ExecStop=/usr/lib/dhcp/dhcrelay -4 stop + +[Install] +WantedBy=multi-user.target +Alias=dhcp-relay.service + diff --git a/dhcrelay6.service b/dhcrelay6.service new file mode 100644 index 0000000..8109eae --- /dev/null +++ b/dhcrelay6.service @@ -0,0 +1,15 @@ +[Unit] +Description=ISC DHCPv6 Relay Agent +Before=multi-user.target +After=remote-fs.target network.target nss-lookup.target time-sync.target ldap.service ndsd.service + +[Service] +Type=forking +Restart=on-abort +ExecStart=/usr/lib/dhcp/dhcrelay -6 start +ExecStop=/usr/lib/dhcp/dhcrelay -6 stop + +[Install] +WantedBy=multi-user.target +Alias=dhcp6-relay.service + diff --git a/if-up.d.dhcpd-restart-hook b/if-up.d.dhcpd-restart-hook index c0ae2a0..8e34d5c 100644 --- a/if-up.d.dhcpd-restart-hook +++ b/if-up.d.dhcpd-restart-hook @@ -16,8 +16,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# along with this program; if not, see # # Please send feedback via http://www.suse.de/feedback # diff --git a/rc.dhcpd b/rc.dhcpd index c5cabb6..8aae2cf 100644 --- a/rc.dhcpd +++ b/rc.dhcpd @@ -2,7 +2,7 @@ # Copyright (c) 1996, 1997, 1998 S.u.S.E. GmbH # Copyright (c) 1998, 1999, 2000, 2001 SuSE GmbH # Copyright (c) 2002, 2003 SuSE Linux AG -# Copyright (c) 2004-2008 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2004-2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software @@ -41,429 +41,11 @@ # needs to rely on time synchronisation.) ### END INIT INFO -test -s /etc/sysconfig/dhcpd && . /etc/sysconfig/dhcpd - -SUPPORTS_CHROOT="yes" -SUPPORTS_RUN_AS="yes" -SUPPORTS_HUP="no" - -DHCPDv_OPT=-4 -test "$SUPPORTS_CHROOT" = no && DHCPD_RUN_CHROOTED=no -test "$SUPPORTS_RUN_AS" = no && DHCPD_RUN_AS="" -test "$DHCPD_BINARY" = "/usr/sbin/dhcpd.lpf" -o \ - "$DHCPD_BINARY" = "/usr/sbin/dhcpd.bsd" && \ -DHCPD_BINARY=/usr/sbin/dhcpd -DHCPD_CONF_INCLUDE_FILES=${DHCPD_CONF_INCLUDE_FILES:-/etc/dhcpd.d} - -DAEMON='ISC DHCPv4 4.x Server' -DAEMON_BIN=${DHCPD_BINARY:=/usr/sbin/dhcpd} -DAEMON_CONF=/etc/dhcpd.conf -DAEMON_STATE=/var/lib/dhcp -DAEMON_LEASES=dhcpd.leases -# note: $DAEMON_PIDFILE is a symlink to the -# $DAEMON_STATE$DAEMON_PIDFILE (also -# while DHCPD_RUN_CHROOTED=no) now, -# as DHCPD_RUN_AS is not allowed to -# create pid files in /var/run. -DAEMON_PIDFILE=/var/run/dhcpd.pid -STARTPROC_LOGFILE=/var/log/rc.dhcpd.log -LDAP_CONF=/etc/openldap/ldap.conf - -test "$DHCPD_RUN_CHROOTED" = "yes" && \ -CHROOT_PREFIX="$DAEMON_STATE" || CHROOT_PREFIX='' - -# Shell functions sourced from /etc/rc.status: -# rc_check check and set local and overall rc status -# rc_status check and set local and overall rc status -# rc_status -v ditto but be verbose in local rc status -# rc_status -v -r ditto and clear the local rc status -# rc_failed set local and overall rc status to failed -# rc_failed set local and overall rc status to -# rc_reset clear local rc status (overall remains) -# rc_exit exit appropriate to overall rc status -. /etc/rc.status - -# First reset status of this service -rc_reset - -# Return values acc. to LSB for all commands but status: -# 0 - success -# 1 - generic or unspecified error -# 2 - invalid or excess argument(s) -# 3 - unimplemented feature (e.g. "reload") -# 4 - insufficient privilege -# 5 - program is not installed -# 6 - program is not configured -# 7 - program is not running -# -# Note that starting an already running service, stopping -# or restarting a not-running service as well as the restart -# with force-reload (in case signalling is not supported) are -# considered a success. - -if ! [ -x "$DAEMON_BIN" ]; then - case $1 in - stop) ;; - *) echo -n >&2 "$0: \"$DAEMON_BIN\" is not an executable file. Exiting." - case $1 in - status) rc_failed 4 ;; - *) rc_failed 5 ;; - esac - rc_status -v - ;; - esac - rc_exit -fi -if ! [ -r "$DAEMON_CONF" ] ; then - case $1 in - stop|status) - if test ! -s /etc/sysconfig/dhcpd ; then - test -e $DAEMON_STATE/$DAEMON_PIDFILE && \ - CHROOT_PREFIX="$DAEMON_STATE" || CHROOT_PREFIX='' - fi - ;; - *) - echo -n >&2 "$0: \"$DAEMON_CONF\" config file missed. Exiting." - rc_failed 6 - rc_status -v - rc_exit - ;; - esac -fi - -# remove empty pid files to avoid disturbing warnings by checkproc/killproc -# (these can occur if dhcpd does not start correctly) -test -e $DAEMON_PIDFILE && ! test -s $DAEMON_PIDFILE && rm $DAEMON_PIDFILE -test -e $DAEMON_STATE/$DAEMON_PIDFILE && ! test -s $DAEMON_STATE/$DAEMON_PIDFILE && rm $DAEMON_STATE/$DAEMON_PIDFILE - -case "$1" in - start) - echo -n "Starting $DAEMON " - - ## If there is no conf file, skip starting of dhcpd - ## and return with "program not configured" - if ! [ -f $DAEMON_CONF ]; then - echo -n "... no configuration file found"; - # Tell the user this has skipped - rc_status -s - # service is not configured - exit 6; - fi - - ## If the interfaces are not set, skip starting of dhcpd - ## and return with "program not configured" - if [ -z "$DHCPD_INTERFACE" ]; then - var="DHCPD_INTERFACE" - case $DHCPDv_OPT in -6) var=DHCPD6_INTERFACE ;; esac - echo -n "... set $var in /etc/sysconfig/dhcpd" - # Tell the user this has skipped - rc_status -s - # service is not configured - exit 6; - fi - - if [ "$DHCPD_INTERFACE" = "ANY" ]; then - DHCPD_INTERFACE="" - fi - - jail=${CHROOT_PREFIX:-${DAEMON_STATE}}; leases=$DAEMON_LEASES - if ! [ -e $jail/db/$leases ]; then - # until 9.0, the lease file was in /var/lib/dhcp and part of the package - if test -e $jail/$leases -a '!' -L $jail/$leases; then - # this is the case where the %post script runs _before_ the old package is - # removed (i.e., dhcpd.leases has not renamed to .rpmsave yet) - mv $jail/$leases $jail/db/$leases && \ - ln -s db/$leases $jail/ - elif test -e $jail/$leases.rpmsave; then - # this is what's left when the package is already gone. - mv $jail/$leases.rpmsave $jail/db/$leases && \ - ln -s db/$leases $jail/ - else - # fresh installation: - # a lease file must be present. the server won't start without - touch $jail/db/$leases - fi - fi - - if test "$DHCPD_RUN_CHROOTED" = "yes" ; then - ## copy the conf file to the chroot jail (dhcpd has to be restarted anyway, - ## when it has changed) and change path to leases file - for i in $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES $LDAP_CONF /etc /dev; do - if test -d "${i}" ; then - test -d "$CHROOT_PREFIX/${i}" || \ - mkdir -p "$CHROOT_PREFIX/${i}" - elif test -e "${i}" ; then - test -d "$CHROOT_PREFIX/${i%/*}" || \ - mkdir -p "$CHROOT_PREFIX/${i%/*}" - fi - done - rm -f $CHROOT_PREFIX/dev/urandom - for i in $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES $LDAP_CONF /etc/{gai.conf,nsswitch.conf,resolv.conf,host.conf,hosts,localtime,bindresvport.blacklist} /dev/urandom; do - if ! test -e "$i"; then continue; fi # neither of them is absolutely necessary - cp -aL "$i" "${CHROOT_PREFIX}/${i%/*}/" &>/dev/null \ - || { echo "...$0:$LINENO: could not copy $i to chroot jail"; rc_failed; rc_status -v1; exit 6; } - done - libdir=$(basename $(echo ${CHROOT_PREFIX}/lib*)) - if test -x /usr/bin/ldd ; then - get_ldd_deps() - { - ldd_wl="\/${libdir}\/lib" - ldd_bl="\/${libdir}\/libc\." - /usr/bin/ldd "$1" | \ - while read -sr a b c d ; do - [ -n "$c" ] || continue - [[ $c =~ $ldd_wl ]] || continue - [[ $c =~ $ldd_bl ]] && continue - echo $c - done - } - else - get_ldd_deps() { :; } - fi - cplibs=`for i in /$libdir/{libresolv.so.*,libnss_*.so.*} \ - /$libdir/{libpthread.so.0,libdl.so.2,libgcc_s.so.*} ; - do - if [ -s "$i" ] ; then - echo "$i" - get_ldd_deps "$i" - fi - done | sort -u` - for i in $cplibs ; do - if [ -s "$i" ]; then - cp -pL "$i" "${CHROOT_PREFIX}/$libdir/" \ - || { echo "...$0:$LINENO: could not copy $i to chroot jail"; rc_failed; rc_status -v1; exit 6; } - fi - done - - # mount /proc into the chroot; the server fails if unable to read /proc/net/{dev,if_inet6} - mkdir -p ${CHROOT_PREFIX}/proc - mount -t proc -o ro proc ${CHROOT_PREFIX}/proc 2>/dev/null - - DHCPD_ARGS="-chroot $CHROOT_PREFIX -lf /db/$DAEMON_LEASES" - - ## If there is a pid file containing a pid, the machine might have crashed. pid files in - ## /var/run are always cleaned up at boot time, but this is not the case for the pid file in - ## the chroot jail. Therefore, and old pid file may exist. This is only a problem if it - ## incidentally contains the pid of a running process. If this process is not a 'dhcpd', - ## we remove the pid. (dhcpd itself only checks whether the pid is alive or not.) - if test -s $DAEMON_STATE/$DAEMON_PIDFILE; then - p=$(<$DAEMON_STATE/$DAEMON_PIDFILE) - if test -n "$p" && grep -qsE "^${DAEMON_BIN}" "/proc/$p/cmdline" ; then - echo -n '(already running) ' - else - rm -f $DAEMON_STATE/$DAEMON_PIDFILE - fi - fi - PID_FILE_ARG="$DAEMON_PIDFILE" - else - DHCPD_ARGS="-lf ${DAEMON_STATE}/db/$DAEMON_LEASES" - PID_FILE_ARG="$DAEMON_STATE$DAEMON_PIDFILE" - fi - - if [ -n "$DHCPD_RUN_AS" ]; then - DHCPD_RUN_AS_GROUP="$(getent group $(getent passwd $DHCPD_RUN_AS | cut -d: -f4) | cut -d: -f1)" - DHCPD_ARGS="$DHCPD_ARGS -user $DHCPD_RUN_AS -group $DHCPD_RUN_AS_GROUP" - - chown "${DHCPD_RUN_AS}:${DHCPD_RUN_AS_GROUP}" \ - "$DAEMON_STATE/${DAEMON_PIDFILE%/*}" - fi - - - ## check syntax with -t (output to log file) and start only when the syntax is okay - rm -f $STARTPROC_LOGFILE # start log - error=0 - if ! $DAEMON_BIN $DHCPDv_OPT -t -cf $CHROOT_PREFIX/$DAEMON_CONF -pf $PID_FILE_ARG > $STARTPROC_LOGFILE 2>&1 ; then - error=1 - else - ## Start daemon. If this fails the return value is set appropriate. - ## The init script should return 0, even if service is already running, - ## to match the LSB spec. - - test "$2" = "-v" && echo -en \ - "\nexecuting '$DAEMON_BIN $DHCPDv_OPT -cf $DAEMON_CONF -pf $PID_FILE_ARG $DHCPD_ARGS $DHCPD_OTHER_ARGS $DHCPD_INTERFACE'" - - $DAEMON_BIN $DHCPDv_OPT -cf $DAEMON_CONF -pf $PID_FILE_ARG $DHCPD_ARGS $DHCPD_OTHER_ARGS $DHCPD_INTERFACE &> $STARTPROC_LOGFILE - ret=$? - fi - - if [ $error -gt 0 -o ${ret:-0} -gt 0 ]; then - ## be verbose - echo "" - echo -n " please see $STARTPROC_LOGFILE for details " - ## set status to failed - rc_failed - else - ln -sf "$DAEMON_STATE$DAEMON_PIDFILE" "$DAEMON_PIDFILE" - [ "$DHCPD_RUN_CHROOTED" = "yes" ] && echo -n "[chroot]" || : - fi - - # Remember status and be verbose - rc_status -v - ;; - stop) - echo -n "Shutting down $DAEMON " - - # Catch the case where daemon is running without chroot, - # but sysconfig/dhcp has been changed to use chroot (and - # another way around). - # In this case is there is no $chroot/$pidfile, but there - # should be a /pidfile that we use instead. - # We can not kill without pid file or dhcp4 kills dhcp6. - PID_FILE="$DAEMON_STATE$DAEMON_PIDFILE" - if test "$DHCPD_RUN_CHROOTED" = "yes" ; then - if test ! -s "$DAEMON_STATE$DAEMON_PIDFILE" -a \ - -s "$DAEMON_PIDFILE" ; then - PID_FILE="$DAEMON_PIDFILE" - fi - else - if test ! -s "$DAEMON_PIDFILE" -a \ - -s "$DAEMON_STATE$DAEMON_PIDFILE" ; then - PID_FILE="$DAEMON_STATE$DAEMON_PIDFILE" - fi - fi - - ## Stop daemon with killproc(8) and if this fails - ## set echo the echo return value. - killproc -p "$PID_FILE" $DAEMON_BIN - ret=$? - - # umount proc and remove libraries from the chroot jail, - # so they are not left over if the server is deinstalled - if [ "$DHCPD_RUN_CHROOTED" = yes -a -n "$CHROOT_PREFIX" ]; then - umount ${CHROOT_PREFIX}/proc 2>/dev/null - rm -f $CHROOT_PREFIX/lib*/* - fi - - # Remember status and be verbose - rc_failed $ret - rc_status -v - ;; - try-restart) - ## Do a restart only if the service was active before. - ## Note: try-restart is now part of LSB (as of 1.9). - ## RH has a similar command named condrestart. - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - # Remember status and be quiet - rc_status - ;; - restart) - ## Check syntax and when it is OK, stop the service - ## and regardless of whether it was running or not, - ## start it again. - if ! $0 check-syntax &>/dev/null ; then - echo -n "Syntax check reports errors, see log messages" - rc_failed - rc_status -v - else - $0 stop - sleep 3 - $0 start - # Remember status and be quiet - rc_status - fi - ;; - force-reload) - ## Signal the daemon to reload its config. Most daemons - ## do this on signal 1 (SIGHUP). - ## If it does not support it, restart. - - if [ "$SUPPORTS_HUP" = "yes" ]; then - echo -n "Reload service $DAEMON" - killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN - #touch $DAEMON_STATE/$DAEMON_PIDFILE - rc_status -v - elif ! $0 check-syntax &>/dev/null ; then - echo -n "Syntax check reports errors, see log messages" - rc_failed - rc_status -v - else - $0 stop && sleep 3 && $0 start - rc_status - fi - ;; - reload) - ## Like force-reload, but if daemon does not support - ## signalling, do nothing (!) - - echo -n "Reload service $DAEMON" - if [ "$SUPPORTS_HUP" = "yes" ]; then - # If it supports signalling: - killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN - #touch $DAEMON_STATE/$DAEMON_PIDFILE - rc_status -v - else - ## Otherwise if it does not support reload: - rc_failed 3 - rc_status -v - fi - ;; - status) - echo -n "Checking for $DAEMON: " - ## Check status with checkproc(8), if process is running - ## checkproc will return with exit status 0. - - # Status has a slightly different for the status command: - # 0 - service running - # 1 - service dead, but /var/run/ pid file exists - # 2 - service dead, but /var/lock/ lock file exists - # 3 - service not running - - # NOTE: checkproc returns LSB compliant status values. - checkproc -p $DAEMON_STATE/$DAEMON_PIDFILE $DAEMON_BIN - rc_status -v - ;; - probe) - ## Optional: Probe for the necessity of a reload, - ## give out the argument which is required for a reload. - - rc=0 - for i in /etc/sysconfig/dhcpd $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES; do - test $i -nt $DAEMON_STATE/$DAEMON_PIDFILE && rc=1 - done - test $rc = 1 && echo restart - ;; - check-syntax|syntax-check) - echo -n "Checking syntax of $DAEMON_CONF: " - - ## this nice bit is from Edwin Groothuis: - ## check syntax (quiet) - $DAEMON_BIN $DHCPDv_OPT -q -t -cf $DAEMON_CONF - rc_status - if [ $? -ne 0 ]; then - echo "" - ## check syntax (verbose) - $DAEMON_BIN $DHCPDv_OPT -t -cf $DAEMON_CONF - echo -ne '\nConfig is NOT okay' - rc_failed - fi - rc_status -v - ;; - check-lease|check-lease-file) - echo -n "Checking lease file $DAEMON_LEASES: " - - if [ -s ${DAEMON_STATE}/db/$DAEMON_LEASES ] ; then - ## check leases file (quiet) - $DAEMON_BIN $DHCPDv_OPT -q -T -cf /dev/null -lf ${DAEMON_STATE}/db/$DAEMON_LEASES - rc_status - if [ $? -ne 0 ]; then - echo "" - ## check leases file (verbose) - $DAEMON_BIN $DHCPDv_OPT -T -cf $DAEMON_CONF -lf ${DAEMON_STATE}/db/$DAEMON_LEASES - echo -ne '\nLease file is NOT okay' - rc_failed - fi - else - rc_status -u - fi - rc_status -v - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe|check-syntax} [-v]" - exit 1 +test -x /usr/lib/dhcp/dhcpd || exit 5 +case $1 in +start|stop|try-restart|restart|force-reload|reload|status|probe|*) + export SCRIPT=${0##*/} + exec /usr/lib/dhcp/dhcpd -4 "$@" || exit 1 +;; esac -rc_exit + diff --git a/rc.dhcpd6 b/rc.dhcpd6 index c93c80a..5398220 100644 --- a/rc.dhcpd6 +++ b/rc.dhcpd6 @@ -41,432 +41,11 @@ # needs to rely on time synchronisation.) ### END INIT INFO -test -s /etc/sysconfig/dhcpd && . /etc/sysconfig/dhcpd - -SUPPORTS_CHROOT="yes" -SUPPORTS_RUN_AS="yes" -SUPPORTS_HUP="no" - -DHCPDv_OPT=-6 -DHCPD_RUN_CHROOTED=$DHCPD6_RUN_CHROOTED -DHCPD_RUN_AS=$DHCPD6_RUN_AS -DHCPD_BINARY=$DHCPD6_BINARY -DHCPD_INTERFACE=$DHCPD6_INTERFACE -DHCPD_CONF_INCLUDE_FILES=${DHCPD6_CONF_INCLUDE_FILES:-/etc/dhcpd6.d} -DHCPD_OTHER_ARGS=$DHCPD6_OTHER_ARGS - -test "$SUPPORTS_CHROOT" = no && DHCPD_RUN_CHROOTED=no -test "$SUPPORTS_RUN_AS" = no && DHCPD_RUN_AS="" - -DAEMON='ISC DHCPv6 4.x Server' -DAEMON_BIN=${DHCPD_BINARY:=/usr/sbin/dhcpd6} -DAEMON_CONF=/etc/dhcpd6.conf -DAEMON_STATE=/var/lib/dhcp6 -DAEMON_LEASES=dhcpd6.leases -# note: $DAEMON_PIDFILE is a symlink to the -# $DAEMON_STATE$DAEMON_PIDFILE (also -# while DHCPD_RUN_CHROOTED=no) now, -# as DHCPD_RUN_AS is not allowed to -# create pid files in /var/run. -DAEMON_PIDFILE=/var/run/dhcpd6.pid -STARTPROC_LOGFILE=/var/log/rc.dhcpd6.log -LDAP_CONF= - -test "$DHCPD_RUN_CHROOTED" = "yes" && \ -CHROOT_PREFIX="$DAEMON_STATE" || CHROOT_PREFIX='' - -# Shell functions sourced from /etc/rc.status: -# rc_check check and set local and overall rc status -# rc_status check and set local and overall rc status -# rc_status -v ditto but be verbose in local rc status -# rc_status -v -r ditto and clear the local rc status -# rc_failed set local and overall rc status to failed -# rc_failed set local and overall rc status to -# rc_reset clear local rc status (overall remains) -# rc_exit exit appropriate to overall rc status -. /etc/rc.status - -# First reset status of this service -rc_reset - -# Return values acc. to LSB for all commands but status: -# 0 - success -# 1 - generic or unspecified error -# 2 - invalid or excess argument(s) -# 3 - unimplemented feature (e.g. "reload") -# 4 - insufficient privilege -# 5 - program is not installed -# 6 - program is not configured -# 7 - program is not running -# -# Note that starting an already running service, stopping -# or restarting a not-running service as well as the restart -# with force-reload (in case signalling is not supported) are -# considered a success. - -if ! [ -x "$DAEMON_BIN" ]; then - case $1 in - stop) ;; - *) echo -n >&2 "$0: \"$DAEMON_BIN\" is not an executable file. Exiting." - case $1 in - status) rc_failed 4 ;; - *) rc_failed 5 ;; - esac - rc_status -v - ;; - esac - rc_exit -fi -if ! [ -r "$DAEMON_CONF" ] ; then - case $1 in - stop|status) - if test ! -s /etc/sysconfig/dhcpd ; then - test -e $DAEMON_STATE/$DAEMON_PIDFILE && \ - CHROOT_PREFIX="$DAEMON_STATE" || CHROOT_PREFIX='' - fi - ;; - *) - echo -n >&2 "$0: \"$DAEMON_CONF\" config file missed. Exiting." - rc_failed 6 - rc_status -v - rc_exit - ;; - esac -fi - -# remove empty pid files to avoid disturbing warnings by checkproc/killproc -# (these can occur if dhcpd does not start correctly) -test -e $DAEMON_PIDFILE && ! test -s $DAEMON_PIDFILE && rm $DAEMON_PIDFILE -test -e $DAEMON_STATE/$DAEMON_PIDFILE && ! test -s $DAEMON_STATE/$DAEMON_PIDFILE && rm $DAEMON_STATE/$DAEMON_PIDFILE - -case "$1" in - start) - echo -n "Starting $DAEMON " - - ## If there is no conf file, skip starting of dhcpd - ## and return with "program not configured" - if ! [ -f $DAEMON_CONF ]; then - echo -n "... no configuration file found"; - # Tell the user this has skipped - rc_status -s - # service is not configured - exit 6; - fi - - ## If the interfaces are not set, skip starting of dhcpd - ## and return with "program not configured" - if [ -z "$DHCPD_INTERFACE" ]; then - var="DHCPD_INTERFACE" - case $DHCPDv_OPT in -6) var=DHCPD6_INTERFACE ;; esac - echo -n "... set $var in /etc/sysconfig/dhcpd" - # Tell the user this has skipped - rc_status -s - # service is not configured - exit 6; - fi - - if [ "$DHCPD_INTERFACE" = "ANY" ]; then - DHCPD_INTERFACE="" - fi - - jail=${CHROOT_PREFIX:-${DAEMON_STATE}}; leases=$DAEMON_LEASES - if ! [ -e $jail/db/$leases ]; then - # until 9.0, the lease file was in /var/lib/dhcp and part of the package - if test -e $jail/$leases -a '!' -L $jail/$leases; then - # this is the case where the %post script runs _before_ the old package is - # removed (i.e., dhcpd.leases has not renamed to .rpmsave yet) - mv $jail/$leases $jail/db/$leases && \ - ln -s db/$leases $jail/ - elif test -e $jail/$leases.rpmsave; then - # this is what's left when the package is already gone. - mv $jail/$leases.rpmsave $jail/db/$leases && \ - ln -s db/$leases $jail/ - else - # fresh installation: - # a lease file must be present. the server won't start without - touch $jail/db/$leases - fi - fi - - if test "$DHCPD_RUN_CHROOTED" = "yes" ; then - ## copy the conf file to the chroot jail (dhcpd has to be restarted anyway, - ## when it has changed) and change path to leases file - for i in $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES $LDAP_CONF /etc /dev; do - if test -d "${i}" ; then - test -d "$CHROOT_PREFIX/${i}" || \ - mkdir -p "$CHROOT_PREFIX/${i}" - elif test -e "${i}" ; then - test -d "$CHROOT_PREFIX/${i%/*}" || \ - mkdir -p "$CHROOT_PREFIX/${i%/*}" - fi - done - rm -f $CHROOT_PREFIX/dev/urandom - for i in $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES $LDAP_CONF /etc/{gai.conf,nsswitch.conf,resolv.conf,host.conf,hosts,localtime,bindresvport.blacklist} /dev/urandom; do - if ! test -e "$i"; then continue; fi # neither of them is absolutely necessary - cp -aL "$i" "${CHROOT_PREFIX}/${i%/*}/" &>/dev/null \ - || { echo "...$0:$LINENO: could not copy $i to chroot jail"; rc_failed; rc_status -v1; exit 6; } - done - libdir=$(basename $(echo ${CHROOT_PREFIX}/lib*)) - if test -x /usr/bin/ldd ; then - get_ldd_deps() - { - ldd_wl="\/${libdir}\/lib" - ldd_bl="\/${libdir}\/libc\." - /usr/bin/ldd "$1" | \ - while read -sr a b c d ; do - [ -n "$c" ] || continue - [[ $c =~ $ldd_wl ]] || continue - [[ $c =~ $ldd_bl ]] && continue - echo $c - done - } - else - get_ldd_deps() { :; } - fi - cplibs=`for i in /$libdir/{libresolv.so.*,libnss_*.so.*} \ - /$libdir/{libpthread.so.0,libdl.so.2,libgcc_s.so.*} ; - do - if [ -s "$i" ] ; then - echo "$i" - get_ldd_deps "$i" - fi - done | sort -u` - for i in $cplibs ; do - if [ -s "$i" ]; then - cp -pL "$i" "${CHROOT_PREFIX}/$libdir/" \ - || { echo "...$0:$LINENO: could not copy $i to chroot jail"; rc_failed; rc_status -v1; exit 6; } - fi - done - - # mount /proc into the chroot; the server fails if unable to read /proc/net/{dev,if_inet6} - mkdir -p ${CHROOT_PREFIX}/proc - mount -t proc -o ro proc ${CHROOT_PREFIX}/proc 2>/dev/null - - DHCPD_ARGS="-chroot $CHROOT_PREFIX -lf /db/$DAEMON_LEASES" - - ## If there is a pid file containing a pid, the machine might have crashed. pid files in - ## /var/run are always cleaned up at boot time, but this is not the case for the pid file in - ## the chroot jail. Therefore, and old pid file may exist. This is only a problem if it - ## incidentally contains the pid of a running process. If this process is not a 'dhcpd', - ## we remove the pid. (dhcpd itself only checks whether the pid is alive or not.) - if test -s $DAEMON_STATE/$DAEMON_PIDFILE; then - p=$(<$DAEMON_STATE/$DAEMON_PIDFILE) - if test -n "$p" && grep -qsE "^${DAEMON_BIN}" "/proc/$p/cmdline" ; then - echo -n '(already running) ' - else - rm -f $DAEMON_STATE/$DAEMON_PIDFILE - fi - fi - PID_FILE_ARG="$DAEMON_PIDFILE" - else - DHCPD_ARGS="-lf ${DAEMON_STATE}/db/$DAEMON_LEASES" - PID_FILE_ARG="$DAEMON_STATE$DAEMON_PIDFILE" - fi - - if [ -n "$DHCPD_RUN_AS" ]; then - DHCPD_RUN_AS_GROUP="$(getent group $(getent passwd $DHCPD_RUN_AS | cut -d: -f4) | cut -d: -f1)" - DHCPD_ARGS="$DHCPD_ARGS -user $DHCPD_RUN_AS -group $DHCPD_RUN_AS_GROUP" - - chown "${DHCPD_RUN_AS}:${DHCPD_RUN_AS_GROUP}" \ - "$DAEMON_STATE/${DAEMON_PIDFILE%/*}" - fi - - - ## check syntax with -t (output to log file) and start only when the syntax is okay - rm -f $STARTPROC_LOGFILE # start log - error=0 - if ! $DAEMON_BIN $DHCPDv_OPT -t -cf $CHROOT_PREFIX/$DAEMON_CONF -pf $PID_FILE_ARG > $STARTPROC_LOGFILE 2>&1 ; then - error=1 - else - ## Start daemon. If this fails the return value is set appropriate. - ## The init script should return 0, even if service is already running, - ## to match the LSB spec. - - test "$2" = "-v" && echo -en \ - "\nexecuting '$DAEMON_BIN $DHCPDv_OPT -cf $DAEMON_CONF -pf $PID_FILE_ARG $DHCPD_ARGS $DHCPD_OTHER_ARGS $DHCPD_INTERFACE'" - - $DAEMON_BIN $DHCPDv_OPT -cf $DAEMON_CONF -pf $PID_FILE_ARG $DHCPD_ARGS $DHCPD_OTHER_ARGS $DHCPD_INTERFACE &> $STARTPROC_LOGFILE - ret=$? - fi - - if [ $error -gt 0 -o ${ret:-0} -gt 0 ]; then - ## be verbose - echo "" - echo -n " please see $STARTPROC_LOGFILE for details " - ## set status to failed - rc_failed - else - ln -sf "$DAEMON_STATE$DAEMON_PIDFILE" "$DAEMON_PIDFILE" - [ "$DHCPD_RUN_CHROOTED" = "yes" ] && echo -n "[chroot]" || : - fi - - # Remember status and be verbose - rc_status -v - ;; - stop) - echo -n "Shutting down $DAEMON " - - # Catch the case where daemon is running without chroot, - # but sysconfig/dhcp has been changed to use chroot (and - # another way around). - # In this case is there is no $chroot/$pidfile, but there - # should be a /pidfile that we use instead. - # We can not kill without pid file or dhcp4 kills dhcp6. - PID_FILE="$DAEMON_STATE$DAEMON_PIDFILE" - if test "$DHCPD_RUN_CHROOTED" = "yes" ; then - if test ! -s "$DAEMON_STATE$DAEMON_PIDFILE" -a \ - -s "$DAEMON_PIDFILE" ; then - PID_FILE="$DAEMON_PIDFILE" - fi - else - if test ! -s "$DAEMON_PIDFILE" -a \ - -s "$DAEMON_STATE$DAEMON_PIDFILE" ; then - PID_FILE="$DAEMON_STATE$DAEMON_PIDFILE" - fi - fi - - ## Stop daemon with killproc(8) and if this fails - ## set echo the echo return value. - killproc -p "$PID_FILE" $DAEMON_BIN - ret=$? - - # umount proc and remove libraries from the chroot jail, - # so they are not left over if the server is deinstalled - if [ "$DHCPD_RUN_CHROOTED" = yes -a -n "$CHROOT_PREFIX" ]; then - umount ${CHROOT_PREFIX}/proc 2>/dev/null - rm -f $CHROOT_PREFIX/lib*/* - fi - - # Remember status and be verbose - rc_failed $ret - rc_status -v - ;; - try-restart) - ## Do a restart only if the service was active before. - ## Note: try-restart is now part of LSB (as of 1.9). - ## RH has a similar command named condrestart. - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - # Remember status and be quiet - rc_status - ;; - restart) - ## Check syntax and when it is OK, stop the service - ## and regardless of whether it was running or not, - ## start it again. - if ! $0 check-syntax &>/dev/null ; then - echo -n "Syntax check reports errors, see log messages" - rc_failed - rc_status -v - else - $0 stop - sleep 3 - $0 start - # Remember status and be quiet - rc_status - fi - ;; - force-reload) - ## Signal the daemon to reload its config. Most daemons - ## do this on signal 1 (SIGHUP). - ## If it does not support it, restart. - - if [ "$SUPPORTS_HUP" = "yes" ]; then - echo -n "Reload service $DAEMON" - killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN - #touch $DAEMON_STATE/$DAEMON_PIDFILE - rc_status -v - elif ! $0 check-syntax &>/dev/null ; then - echo -n "Syntax check reports errors, see log messages" - rc_failed - rc_status -v - else - $0 stop && sleep 3 && $0 start - rc_status - fi - ;; - reload) - ## Like force-reload, but if daemon does not support - ## signalling, do nothing (!) - - echo -n "Reload service $DAEMON" - if [ "$SUPPORTS_HUP" = "yes" ]; then - # If it supports signalling: - killproc -p $DAEMON_STATE/$DAEMON_PIDFILE -HUP $DAEMON_BIN - #touch $DAEMON_STATE/$DAEMON_PIDFILE - rc_status -v - else - ## Otherwise if it does not support reload: - rc_failed 3 - rc_status -v - fi - ;; - status) - echo -n "Checking for $DAEMON: " - ## Check status with checkproc(8), if process is running - ## checkproc will return with exit status 0. - - # Status has a slightly different for the status command: - # 0 - service running - # 1 - service dead, but /var/run/ pid file exists - # 2 - service dead, but /var/lock/ lock file exists - # 3 - service not running - - # NOTE: checkproc returns LSB compliant status values. - checkproc -p $DAEMON_STATE/$DAEMON_PIDFILE $DAEMON_BIN - rc_status -v - ;; - probe) - ## Optional: Probe for the necessity of a reload, - ## give out the argument which is required for a reload. - - rc=0 - for i in /etc/sysconfig/dhcpd $DAEMON_CONF $DHCPD_CONF_INCLUDE_FILES; do - test $i -nt $DAEMON_STATE/$DAEMON_PIDFILE && rc=1 - done - test $rc = 1 && echo restart - ;; - check-syntax|syntax-check) - echo -n "Checking syntax of $DAEMON_CONF: " - - ## this nice bit is from Edwin Groothuis: - ## check syntax (quiet) - $DAEMON_BIN $DHCPDv_OPT -q -t -cf $DAEMON_CONF - rc_status - if [ $? -ne 0 ]; then - echo "" - ## check syntax (verbose) - $DAEMON_BIN $DHCPDv_OPT -t -cf $DAEMON_CONF - echo -ne '\nConfig is NOT okay' - rc_failed - fi - rc_status -v - ;; - check-lease|check-lease-file) - echo -n "Checking lease file $DAEMON_LEASES: " - - if [ -s ${DAEMON_STATE}/db/$DAEMON_LEASES ] ; then - ## check leases file (quiet) - $DAEMON_BIN $DHCPDv_OPT -q -T -cf /dev/null -lf ${DAEMON_STATE}/db/$DAEMON_LEASES - rc_status - if [ $? -ne 0 ]; then - echo "" - ## check leases file (verbose) - $DAEMON_BIN $DHCPDv_OPT -T -cf $DAEMON_CONF -lf ${DAEMON_STATE}/db/$DAEMON_LEASES - echo -ne '\nLease file is NOT okay' - rc_failed - fi - else - rc_status -u - fi - rc_status -v - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe|check-syntax} [-v]" - exit 1 +test -x /usr/lib/dhcp/dhcpd || exit 5 +case $1 in +start|stop|try-restart|restart|force-reload|reload|status|probe|*) + export SCRIPT=${0##*/} + exec /usr/lib/dhcp/dhcpd -6 "$@" || exit 1 +;; esac -rc_exit + diff --git a/rc.dhcrelay b/rc.dhcrelay index 56fea3a..03c906c 100644 --- a/rc.dhcrelay +++ b/rc.dhcrelay @@ -25,197 +25,11 @@ # physical network segment to another. ### END INIT INFO -DHCPv_OPT=-4 -DAEMON="ISC DHCPv4 relay agent" -DAEMON_BIN=/usr/sbin/dhcrelay -DAEMON_CONF=/etc/sysconfig/dhcrelay -DAEMON_PIDFILE=/var/run/dhcrelay.pid -STARTPROC_LOGFILE=/var/log/rc.dhcrelay.log -SUPPORTS_HUP="no" - -test -s "$DAEMON_CONF" && . "$DAEMON_CONF" -if ! [ -x "$DAEMON_BIN" ]; then - case $1 in - stop) ;; - *) echo -n >&2 "$0: \"$DAEMON_BIN\" is not an executable file. Exiting." - case $1 in - status) rc_failed 4 ;; - *) rc_failed 5 ;; - esac - rc_status -v - ;; - esac - rc_exit -fi - -# Shell functions sourced from /etc/rc.status: -# rc_check check and set local and overall rc status -# rc_status check and set local and overall rc status -# rc_status -v ditto but be verbose in local rc status -# rc_status -v -r ditto and clear the local rc status -# rc_failed set local and overall rc status to failed -# rc_failed set local and overall rc status to -# rc_reset clear local rc status (overall remains) -# rc_exit exit appropriate to overall rc status -. /etc/rc.status - -# First reset status of this service -rc_reset - -# Return values acc. to LSB for all commands but status: -# 0 - success -# 1 - generic or unspecified error -# 2 - invalid or excess argument(s) -# 3 - unimplemented feature (e.g. "reload") -# 4 - insufficient privilege -# 5 - program is not installed -# 6 - program is not configured -# 7 - program is not running -# -# Note that starting an already running service, stopping -# or restarting a not-running service as well as the restart -# with force-reload (in case signalling is not supported) are -# considered a success. - -case "$1" in - start) - echo -n "Starting $DAEMON" - checkproc -p $DAEMON_PIDFILE $DAEMON_BIN && { - echo -n "... already running"; rc_status -v; exit 0; - } - - ## If interfaces or servers are not set, skip starting of dhcrelay - ## and return with "program not configured" - if [ -z "$DHCRELAY_INTERFACES" -o -z "$DHCRELAY_SERVERS" ]; then - # Tell the user this has skipped - rc_status -s - # service is not configured - exit 6; - fi - - DHCRELAY_INTERFACES_ARGS='' - for i in $DHCRELAY_INTERFACES ; do - DHCRELAY_INTERFACES_ARGS="$DHCRELAY_INTERFACES_ARGS -i $i" - done - - ## Start daemon with startproc(8). If this fails - ## the echo return value is set appropriate. - - # startproc should return 0, even if service is - # already running to match LSB spec. - test "$2" = "-v" && echo -en \ - "\nexecuting '$DAEMON_BIN $DHCPv_OPT $DHCRELAY_OPTIONS $DHCRELAY_INTERFACES_ARGS $DHCRELAY_SERVERS'" - startproc -q -l $STARTPROC_LOGFILE -p $DAEMON_PIDFILE $DAEMON_BIN $DHCPv_OPT $DHCRELAY_OPTIONS $DHCRELAY_INTERFACES_ARGS $DHCRELAY_SERVERS &>/dev/null - rc=$? - if ! [ $rc -eq 0 ]; then - ## be verbose - echo "" - echo -n " please see $STARTPROC_LOGFILE for details " - ## set status to failed - rc_failed - fi - - # Remember status and be verbose - rc_status -v - ;; - stop) - echo -n "Shutting down $DAEMON" - ## Stop daemon with killproc(8) and if this fails - ## set echo the echo return value. - - killproc -p $DAEMON_PIDFILE $DAEMON_BIN - - # Remember status and be verbose - rc_status -v - ;; - try-restart) - ## Do a restart only if the service was active before. - ## Note: try-restart is now part of LSB (as of 1.9). - ## RH has a similar command named condrestart. - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - # Remember status and be quiet - rc_status - ;; - restart) - ## Stop the service and regardless of whether it was - ## running or not, start it again. - $0 stop - sleep 1 - $0 start - - # Remember status and be quiet - rc_status - ;; - force-reload) - ## Signal the daemon to reload its config. Most daemons - ## do this on signal 1 (SIGHUP). - ## If it does not support it, restart. - - $0 stop && sleep 1 && $0 start - rc_status - - echo -n "Reload service $DAEMON" - - if [ "$SUPPORTS_HUP" = "yes" ] ; then - killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN - #touch $DAEMON_PIDFILE - rc_status -v - else - $0 stop && $0 start - rc_status - fi - ;; - reload) - ## Like force-reload, but if daemon does not support - ## signalling, do nothing (!) - - if [ "$SUPPORTS_HUP" = "yes" ] ; then - # If it supports signalling: - echo -n "Reload service $DAEMON" - killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN - #touch $DAEMON_PIDFILE - rc_status -v - else - ## Otherwise if it does not support reload: - rc_failed 3 - rc_status -v - fi - ;; - status) - echo -n "Checking for dhcp relay agent: " - ## Check status with checkproc(8), if process is running - ## checkproc will return with exit status 0. - - # Status has a slightly different for the status command: - # 0 - service running - # 1 - service dead, but /var/run/ pid file exists - # 2 - service dead, but /var/lock/ lock file exists - # 3 - service not running - - # NOTE: checkproc returns LSB compliant status values. - checkproc -p $DAEMON_PIDFILE $DAEMON_BIN - rc_status -v - ;; - probe) - ## Optional: Probe for the necessity of a reload, - ## give out the argument which is required for a reload. - - if [ "$DAEMON_CONF" -nt "$DAEMON_PIDFILE" ]; then - if [ "$SUPPORTS_HUP" = "yes" ]; then - echo reload - else - echo restart - fi - fi - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe} [-v]" - exit 1 - ;; +test -x /usr/lib/dhcp/dhcrelay || exit 5 +case $1 in +start|stop|try-restart|restart|force-reload|reload|status|probe|*) + export SCRIPT=${0##*/} + exec /usr/lib/dhcp/dhcrelay -4 "$@" || exit 1 +;; esac -rc_exit + diff --git a/rc.dhcrelay6 b/rc.dhcrelay6 index c5701ee..f182a3b 100644 --- a/rc.dhcrelay6 +++ b/rc.dhcrelay6 @@ -25,205 +25,11 @@ # physical network segment to another. ### END INIT INFO -DHCPv_OPT=-6 -DAEMON="ISC DHCPv6 relay agent" -DAEMON_BIN=/usr/sbin/dhcrelay6 -DAEMON_CONF=/etc/sysconfig/dhcrelay -DAEMON_PIDFILE=/var/run/dhcrelay6.pid -STARTPROC_LOGFILE=/var/log/rc.dhcrelay6.log -SUPPORTS_HUP="no" - -test -s "$DAEMON_CONF" && . "$DAEMON_CONF" -if ! [ -x "$DAEMON_BIN" ]; then - case $1 in - stop) ;; - *) echo -n >&2 "$0: \"$DAEMON_BIN\" is not an executable file. Exiting." - case $1 in - status) rc_failed 4 ;; - *) rc_failed 5 ;; - esac - rc_status -v - ;; - esac - rc_exit -fi - -# Shell functions sourced from /etc/rc.status: -# rc_check check and set local and overall rc status -# rc_status check and set local and overall rc status -# rc_status -v ditto but be verbose in local rc status -# rc_status -v -r ditto and clear the local rc status -# rc_failed set local and overall rc status to failed -# rc_failed set local and overall rc status to -# rc_reset clear local rc status (overall remains) -# rc_exit exit appropriate to overall rc status -. /etc/rc.status - -# First reset status of this service -rc_reset - -# Return values acc. to LSB for all commands but status: -# 0 - success -# 1 - generic or unspecified error -# 2 - invalid or excess argument(s) -# 3 - unimplemented feature (e.g. "reload") -# 4 - insufficient privilege -# 5 - program is not installed -# 6 - program is not configured -# 7 - program is not running -# -# Note that starting an already running service, stopping -# or restarting a not-running service as well as the restart -# with force-reload (in case signalling is not supported) are -# considered a success. - -case "$1" in - start) - echo -n "Starting $DAEMON" - checkproc -p $DAEMON_PIDFILE $DAEMON_BIN && { - echo -n "... already running"; rc_status -v; exit 0; - } - - DHCRELAY6_LOWER_INTERFACES_ARGS='' - for l in $DHCRELAY6_LOWER_INTERFACES ; do - test "x$l" = x -o "x$l" = "x-l" && continue - DHCRELAY6_LOWER_INTERFACES_ARGS="$DHCRELAY6_LOWER_INTERFACES_ARGS -l $l" - done - DHCRELAY6_UPPER_INTERFACES_ARGS='' - for u in $DHCRELAY6_UPPER_INTERFACES ; do - test "x$u" = x -o "x$u" = "x-u" && continue - DHCRELAY6_UPPER_INTERFACES_ARGS="$DHCRELAY6_UPPER_INTERFACES_ARGS -u $u" - done - - ## If interfaces or servers are not set, skip starting of dhcrelay - ## and return with "program not configured" - if [ "x$DHCRELAY6_LOWER_INTERFACES_ARGS" = x -o \ - "x$DHCRELAY6_UPPER_INTERFACES_ARGS" = x ]; then - # Tell the user this has skipped - rc_status -s - # service is not configured - exit 6; - fi - - - ## Start daemon with startproc(8). If this fails - ## the echo return value is set appropriate. - - # startproc should return 0, even if service is - # already running to match LSB spec. - test "$2" = "-v" && echo -en \ - "\nexecuting '$DAEMON_BIN $DHCPv_OPT $DHCRELAY6_OPTIONS $DHCRELAY6_LOWER_INTERFACES_ARGS $DHCRELAY6_UPPER_INTERFACES_ARGS'" - startproc -q -l $STARTPROC_LOGFILE -p $DAEMON_PIDFILE $DAEMON_BIN $DHCPv_OPT $DHCRELAY6_OPTIONS $DHCRELAY6_LOWER_INTERFACES_ARGS $DHCRELAY6_UPPER_INTERFACES_ARGS &>/dev/null - rc=$? - if ! [ $rc -eq 0 ]; then - ## be verbose - echo "" - echo -n " please see $STARTPROC_LOGFILE for details "; - ## set status to failed - rc_failed - fi - - # Remember status and be verbose - rc_status -v - ;; - stop) - echo -n "Shutting down $DAEMON" - ## Stop daemon with killproc(8) and if this fails - ## set echo the echo return value. - - killproc -p $DAEMON_PIDFILE $DAEMON_BIN - - # Remember status and be verbose - rc_status -v - ;; - try-restart) - ## Do a restart only if the service was active before. - ## Note: try-restart is now part of LSB (as of 1.9). - ## RH has a similar command named condrestart. - $0 status - if test $? = 0; then - $0 restart - else - rc_reset # Not running is not a failure. - fi - # Remember status and be quiet - rc_status - ;; - restart) - ## Stop the service and regardless of whether it was - ## running or not, start it again. - $0 stop - sleep 1 - $0 start - - # Remember status and be quiet - rc_status - ;; - force-reload) - ## Signal the daemon to reload its config. Most daemons - ## do this on signal 1 (SIGHUP). - ## If it does not support it, restart. - - $0 stop && sleep 1 && $0 start - rc_status - - echo -n "Reload service $DAEMON" - - if [ "$SUPPORTS_HUP" = "yes" ] ; then - killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN - #touch $DAEMON_PIDFILE - rc_status -v - else - $0 stop && $0 start - rc_status - fi - ;; - reload) - ## Like force-reload, but if daemon does not support - ## signalling, do nothing (!) - - if [ "$SUPPORTS_HUP" = "yes" ] ; then - # If it supports signalling: - echo -n "Reload service $DAEMON" - killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN - #touch $DAEMON_PIDFILE - rc_status -v - else - ## Otherwise if it does not support reload: - rc_failed 3 - rc_status -v - fi - ;; - status) - echo -n "Checking for dhcp relay agent: " - ## Check status with checkproc(8), if process is running - ## checkproc will return with exit status 0. - - # Status has a slightly different for the status command: - # 0 - service running - # 1 - service dead, but /var/run/ pid file exists - # 2 - service dead, but /var/lock/ lock file exists - # 3 - service not running - - # NOTE: checkproc returns LSB compliant status values. - checkproc -p $DAEMON_PIDFILE $DAEMON_BIN - rc_status -v - ;; - probe) - ## Optional: Probe for the necessity of a reload, - ## give out the argument which is required for a reload. - - if [ "$DAEMON_CONF" -nt "$DAEMON_PIDFILE" ]; then - if [ "$SUPPORTS_HUP" = "yes" ]; then - echo reload - else - echo restart - fi - fi - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe} [-v]" - exit 1 - ;; +test -x /usr/lib/dhcp/dhcrelay || exit 5 +case $1 in +start|stop|try-restart|restart|force-reload|reload|status|probe|*) + export SCRIPT=${0##*/} + exec /usr/lib/dhcp/dhcrelay -6 "$@" || exit 1 +;; esac -rc_exit + diff --git a/sysconfig.dhcpd b/sysconfig.dhcpd index 87f79da..566b10b 100644 --- a/sysconfig.dhcpd +++ b/sysconfig.dhcpd @@ -182,25 +182,3 @@ DHCPD_OTHER_ARGS="" # DHCPD6_OTHER_ARGS="" -## Type: string -## Default: "" -## ServiceRestart: dhcpd -# -# You may specify another dhcpd binary to be run. -# The full path needs to be specified. -# -# If empty, the default applies. -# -DHCPD_BINARY="" - -## Type: string -## Default: "" -## ServiceRestart: dhcpd6 -# -# You may specify another dhcpd binary to be run. -# The full path needs to be specified. -# -# If empty, the default applies. -# -DHCPD6_BINARY="" -