Browse Source

[master] Merged trac3513 (-V extended version)

Francis Dupont 10 years ago
parent
commit
584cf666e1

+ 9 - 0
ChangeLog

@@ -1,3 +1,12 @@
+954.	[func]		fdupont
+	Enhance the versioning information printed by the executables and
+	make it more consistent across all of the executables. "-v" is for
+	basic Kea version information, "-V" provides more detailed
+	versioning and versions for external dynamic libraries, finally
+	"-W" provides the configure report from the configuration step
+	during the build of Kea.
+	(Trac #3513, git xxx)
+
 953.	[bug]		fdupont
 	Corrected the setting of string characters to values above 127
 	in HMAC tests.

+ 6 - 1
configure.ac

@@ -1384,7 +1384,7 @@ AC_CONFIG_FILES([compatcheck/Makefile
                  doc/version.ent
                  ext/asio/asio/Makefile
                  ext/asio/Makefile
-		 ext/gtest/Makefile
+                 ext/gtest/Makefile
                  ext/Makefile
                  m4macros/Makefile
                  Makefile
@@ -1395,6 +1395,7 @@ AC_CONFIG_FILES([compatcheck/Makefile
                  src/bin/d2/tests/Makefile
                  src/bin/d2/tests/d2_process_tests.sh
                  src/bin/d2/tests/test_data_files_config.h
+                 src/bin/cfgrpt/Makefile
                  src/bin/dhcp4/Makefile
                  src/bin/dhcp4/spec_config.h.pre
                  src/bin/dhcp4/tests/Makefile
@@ -1651,6 +1652,10 @@ Developer:
 
 END
 
+# Create config_report.cc with embedded config.report
+chmod +x ${srcdir}/tools/mk_cfgrpt.sh
+${srcdir}/tools/mk_cfgrpt.sh ${srcdir}/src/bin/cfgrpt/config_report.cc
+
 cat config.report
 cat <<EOF
 

+ 31 - 0
doc/guide/ddns.xml

@@ -91,9 +91,40 @@
               additional parameters and exits.
             </simpara>
           </listitem>
+          <listitem>
+            <simpara>
+              <command>-W</command> - prints out Kea configuration report
+              and exits.
+            </simpara>
+          </listitem>
       </itemizedlist>
 
       <para>
+            The <command>-V</command> command returns the versions of the
+            external libraries dynamically linked.
+      </para>
+
+      <para>
+            The <command>-W</command> command describes the environment used
+            to build Kea.  This command displays a copy of the
+            <filename>config.report</filename> file produced by
+            <userinput>./configure</userinput> that is embedded in the
+            executable binary.
+      </para>
+
+      <para>
+            The <filename>config.report</filename> may also be accessed more
+            directly.  The following command may be used to extract this
+            information.  The binary <userinput>path</userinput> may be found
+            in the install directory or in the <filename>.libs</filename>
+            subdirectory in the source treee. For example
+            <filename>kea/src/bin/d2/.libs/kea-dhcp-ddns</filename>.
+<screen>
+strings <userinput>path</userinput>/kea-dhcp-ddns | sed -n 's/;;;; //p'
+</screen>
+      </para>
+
+      <para>
       Upon start up the module will load its configuration and begin listening
       for NCRs based on that configuration.
       </para>

+ 32 - 0
doc/guide/dhcp4-srv.xml

@@ -55,9 +55,41 @@
               additional parameters and exits.
             </simpara>
           </listitem>
+          <listitem>
+            <simpara>
+              <command>-W</command> - prints out Kea configuration report
+              and exits.
+            </simpara>
+          </listitem>
       </itemizedlist>
 
       <para>
+            The <command>-V</command> command returns the versions of the
+            external libraries dynamically linked.
+      </para>
+
+      <para>
+            The <command>-W</command> command describes the environment used
+            to build Kea.  This command displays a copy of the
+            <filename>config.report</filename> file produced by
+            <userinput>./configure</userinput> that is embedded in the
+            executable binary.
+      </para>
+
+      <para>
+            The <filename>config.report</filename> may also be accessed more
+            directly.  The following command may be used to extract this
+            information.  The binary <userinput>path</userinput> may be found
+            in the install directory or in the <filename>.libs</filename>
+            subdirectory in the source treee. For example
+            <filename>kea/src/bin/dhcp4/.libs/kea-dhcp4</filename>.
+
+<screen>
+strings <userinput>path</userinput>/kea-dhcp4 | sed -n 's/;;;; //p'
+</screen>
+      </para>
+
+      <para>
 	    When running in a console, the server can be shut down by
 	    pressing ctrl-c. It detects the key combination and shuts
 	    down gracefully.

+ 32 - 0
doc/guide/dhcp6-srv.xml

@@ -53,9 +53,41 @@
               additional parameters and exits.
             </simpara>
           </listitem>
+          <listitem>
+            <simpara>
+              <command>-W</command> - prints out Kea configuration report
+              and exits.
+            </simpara>
+          </listitem>
       </itemizedlist>
 
       <para>
+            The <command>-V</command> command returns the versions of the
+            external libraries dynamically linked.
+      </para>
+
+      <para>
+            The <command>-W</command> command describes the environment used
+            to build Kea.  This command displays a copy of the
+            <filename>config.report</filename> file produced by
+            <userinput>./configure</userinput> that is embedded in the
+            executable binary.
+      </para>
+
+      <para>
+            The <filename>config.report</filename> may also be accessed more
+            directly.  The following command may be used to extract this
+            information.  The binary <userinput>path</userinput> may be found
+            in the install directory or in the <filename>.libs</filename>
+            subdirectory in the source treee. For example
+            <filename>kea/src/bin/dhcp6/.libs/kea-dhcp6</filename>.
+
+<screen>
+strings <userinput>path</userinput>/kea-dhcp6 | sed -n 's/;;;; //p'
+</screen>
+      </para>
+
+      <para>
 	    When running in a console, the server can be shut down by
 	    pressing ctrl-c. It detects the key combination and shuts
 	    down gracefully.

+ 6 - 0
doc/guide/install.xml

@@ -334,6 +334,12 @@ Debian and Ubuntu:
           dependencies.
         </para>
 
+        <para>
+          <userinput>./configure</userinput> when it succeeds displays a report
+          with the building parameters. This report is saved into 
+          <filename>config.report</filename> and embedded into executable
+          binaries, e.g., <userinput>kea-dhcp4</userinput>.
+        </para>
 
       </section>
 

+ 1 - 1
src/bin/Makefile.am

@@ -1,4 +1,4 @@
 # The following build order must be maintained.
-SUBDIRS = dhcp4 dhcp6 d2 perfdhcp admin lfc keactrl
+SUBDIRS = cfgrpt dhcp4 dhcp6 d2 perfdhcp admin lfc keactrl
 
 check-recursive: all-recursive

+ 1 - 0
src/bin/cfgrpt/.gitignore

@@ -0,0 +1 @@
+/config_report.cc

+ 12 - 0
src/bin/cfgrpt/Makefile.am

@@ -0,0 +1,12 @@
+AM_CPPFLAGS = -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
+
+# Get rid of generated message files on a clean
+CLEANFILES = *.gcno *.gcda
+
+# config_report.cc was generated by configure
+DISTCLEANFILES = config_report.cc
+
+# convenience archive
+noinst_LTLIBRARIES = libcfgrpt.la
+
+libcfgrpt_la_SOURCES = config_report.h config_report.cc cfgrpt.cc

+ 40 - 0
src/bin/cfgrpt/cfgrpt.cc

@@ -0,0 +1,40 @@
+// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or 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.
+
+#include <sstream>
+
+#include <cfgrpt/config_report.h>
+
+namespace isc {
+namespace detail {
+
+// The config_report array ends with an empty line ("")
+// Each line before this final one starts with four semicolons (;;;;)
+// in order to be easy to extract from binaries.
+std::string
+getConfigReport() {
+    std::stringstream tmp;
+
+    size_t linenum = 0;
+    for (;;) {
+        const char* const line = config_report[linenum++];
+        if (line[0] == '\0')
+            break;
+        tmp << line + 4 << std::endl;
+    }
+    return (tmp.str());
+}
+
+}
+}

+ 31 - 0
src/bin/cfgrpt/config_report.h

@@ -0,0 +1,31 @@
+// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or 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.
+
+#ifndef CONFIG_REPORT_H
+#define CONFIG_REPORT_H
+
+namespace isc {
+namespace detail {
+
+extern const char* const config_report[];
+
+// The config_report array ends with an empty line ("")
+// Each line before this final one starts with four semicolons (;;;;)
+// in order to be easy to extract from binaries.
+std::string getConfigReport();
+
+}
+}
+
+#endif // CONFIG_REPORT_H

+ 2 - 0
src/bin/d2/Makefile.am

@@ -91,6 +91,8 @@ kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
+kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
+kea_dhcp_ddns_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
 
 kea_dhcp_ddnsdir = $(pkgdatadir)
 kea_dhcp_ddns_DATA = dhcp-ddns.spec

+ 33 - 10
src/bin/d2/d_controller.cc

@@ -19,6 +19,9 @@
 #include <exceptions/exceptions.h>
 #include <log/logger_support.h>
 #include <dhcpsrv/cfgmgr.h>
+#include <cryptolink/cryptolink.h>
+#include <log/logger.h>
+#include <cfgrpt/config_report.h>
 
 #include <sstream>
 #include <unistd.h>
@@ -130,7 +133,7 @@ DControllerBase::parseArgs(int argc, char* argv[])
     int ch;
     opterr = 0;
     optind = 1;
-    std::string opts("dvVc:" + getCustomOpts());
+    std::string opts("dvVWc:" + getCustomOpts());
     while ((ch = getopt(argc, argv, opts.c_str())) != -1) {
         switch (ch) {
         case 'd':
@@ -150,6 +153,12 @@ DControllerBase::parseArgs(int argc, char* argv[])
             isc_throw(VersionMessage, getVersion(true));
             break;
             
+        case 'W':
+            // gather Kea config report and throw so main() can catch and
+            // return rather than calling exit() here which disrupts gtest.
+            isc_throw(VersionMessage, isc::detail::getConfigReport());
+            break;
+
         case 'c':
             // config file name
             if (optarg == NULL) {
@@ -426,12 +435,14 @@ DControllerBase::usage(const std::string & text)
     }
 
     std::cerr << "Usage: " << bin_name_ <<  std::endl
-              << "  -c <config file name> : mandatory,"
-              <<   " specifies name of configuration file " << std::endl
-              << "  -d: optional, verbose output " << std::endl
               << "  -v: print version number and exit" << std::endl
               << "  -V: print extended version information and exit"
-              << std::endl;
+              << std::endl
+              << "  -W: display the configuration report and exit"
+              << std::endl
+              << "  -d: optional, verbose output " << std::endl
+              << "  -c <config file name> : mandatory,"
+              <<   " specifies name of configuration file " << std::endl;
 
     // add any derivation specific usage
     std::cerr << getUsageText() << std::endl;
@@ -440,6 +451,9 @@ DControllerBase::usage(const std::string & text)
 DControllerBase::~DControllerBase() {
 }
 
+// Refer to config_report so it will be embedded in the binary
+const char* const* d2_config_report = isc::detail::config_report;
+
 }; // namespace isc::d2
 
 }; // namespace isc
@@ -450,11 +464,20 @@ isc::dhcp::Daemon::getVersion(bool extended) {
 
     tmp << VERSION;
     if (extended) {
-        tmp << std::endl << EXTENDED_VERSION;
-
-        // @todo print more details (is it Botan or OpenSSL build,
-        // with or without MySQL/Postgres? What compilation options were
-        // used? etc)
+        tmp << std::endl << EXTENDED_VERSION << std::endl;
+        tmp << "linked with:" << std::endl;
+        tmp << isc::log::Logger::getVersion() << std::endl;
+        tmp << isc::cryptolink::CryptoLink::getVersion() << std::endl;
+#ifdef HAVE_MYSQL
+        tmp << "database: MySQL";
+#else
+#ifdef HAVE_PGSQL
+        tmp << "database: PostgreSQL";
+#else
+        tmp << "no database";
+#endif
+#endif
+        // @todo: more details about database runtime
     }
 
     return (tmp.str());

+ 28 - 10
src/bin/d2/kea-dhcp-ddns.xml

@@ -1,8 +1,8 @@
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
                "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
-	       [<!ENTITY mdash "&#8212;">]>
+               [<!ENTITY mdash "&#8212;">]>
 <!--
- - Copyright (C) 2013, 2014  Internet Systems Consortium, Inc. ("ISC")
+ - Copyright (C) 2013, 2014, 2015  Internet Systems Consortium, Inc. ("ISC")
  -
  - Permission to use, copy, modify, and/or distribute this software for any
  - purpose with or without fee is hereby granted, provided that the above
@@ -20,7 +20,7 @@
 <refentry>
 
   <refentryinfo>
-    <date>July 1, 2014</date>
+    <date>June 10, 2015</date>
   </refentryinfo>
 
   <refmeta>
@@ -36,7 +36,7 @@
 
   <docinfo>
     <copyright>
-      <year>2014</year>
+      <year>2014-2015</year>
       <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
     </copyright>
   </docinfo>
@@ -45,12 +45,9 @@
     <cmdsynopsis>
       <command>kea-dhcp-ddns</command>
       <arg><option>-v</option></arg>
-    </cmdsynopsis>
-  </refsynopsisdiv>
-
-  <refsynopsisdiv>
-    <cmdsynopsis>
-      <command>kea-dhcp-ddns</command>
+      <arg><option>-V</option></arg>
+      <arg><option>-W</option></arg>
+      <arg><option>-d</option></arg>
       <arg><option>-s</option></arg>
     </cmdsynopsis>
   </refsynopsisdiv>
@@ -79,6 +76,27 @@
       <varlistentry>
         <term><option>-v</option></term>
         <listitem><para>
+          Display the version.
+        </para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-V</option></term>
+        <listitem><para>
+          Display the extended version.
+        </para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-W</option></term>
+        <listitem><para>
+          Display the configuration report.
+        </para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-d</option></term>
+        <listitem><para>
           Verbose mode sets the logging level to debug. This is primarily
           for development purposes in stand-alone mode.
         </para></listitem>

+ 1 - 0
src/bin/d2/tests/Makefile.am

@@ -86,6 +86,7 @@ d2_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.l
 d2_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
 d2_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 d2_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
+d2_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
 
 endif
 

+ 2 - 0
src/bin/dhcp4/Makefile.am

@@ -77,6 +77,8 @@ kea_dhcp4_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
 kea_dhcp4_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
 kea_dhcp4_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 kea_dhcp4_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
+kea_dhcp4_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
+kea_dhcp4_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
 
 kea_dhcp4dir = $(pkgdatadir)
 kea_dhcp4_DATA = dhcp4.spec

+ 21 - 5
src/bin/dhcp4/dhcp4_srv.cc

@@ -42,6 +42,9 @@
 #include <hooks/hooks_manager.h>
 #include <util/strutil.h>
 #include <stats/stats_mgr.h>
+#include <log/logger.h>
+#include <cryptolink/cryptolink.h>
+#include <cfgrpt/config_report.h>
 
 #include <asio.hpp>
 #include <boost/bind.hpp>
@@ -52,6 +55,7 @@
 
 using namespace isc;
 using namespace isc::asiolink;
+using namespace isc::cryptolink;
 using namespace isc::dhcp;
 using namespace isc::dhcp_ddns;
 using namespace isc::hooks;
@@ -2247,17 +2251,29 @@ Dhcpv4Srv::d2ClientErrorHandler(const
     CfgMgr::instance().getD2ClientMgr().suspendUpdates();
 }
 
+// Refer to config_report so it will be embedded in the binary
+const char* const* dhcp4_config_report = isc::detail::config_report;
+
 std::string
 Daemon::getVersion(bool extended) {
     std::stringstream tmp;
 
     tmp << VERSION;
     if (extended) {
-        tmp << endl << EXTENDED_VERSION;
-
-        // @todo print more details (is it Botan or OpenSSL build,
-        // with or without MySQL/Postgres? What compilation options were
-        // used? etc)
+        tmp << endl << EXTENDED_VERSION << endl;
+        tmp << "linked with:" << endl;
+        tmp << Logger::getVersion() << endl;
+        tmp << CryptoLink::getVersion() << endl;
+#ifdef HAVE_MYSQL
+        tmp << "database: MySQL";
+#else
+#ifdef HAVE_PGSQL
+        tmp << "database: PostgreSQL";
+#else
+        tmp << "no database";
+#endif
+#endif
+        // @todo: more details about database runtime
     }
 
     return (tmp.str());

+ 29 - 5
src/bin/dhcp4/kea-dhcp4.xml

@@ -1,8 +1,8 @@
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
                "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
-	       [<!ENTITY mdash "&#8212;">]>
+               [<!ENTITY mdash "&#8212;">]>
 <!--
- - Copyright (C) 2011, 2014  Internet Systems Consortium, Inc. ("ISC")
+ - Copyright (C) 2011, 2014, 2015  Internet Systems Consortium, Inc. ("ISC")
  -
  - Permission to use, copy, modify, and/or distribute this software for any
  - purpose with or without fee is hereby granted, provided that the above
@@ -20,7 +20,7 @@
 <refentry>
 
   <refentryinfo>
-    <date>July 1, 2014</date>
+    <date>June 10, 2015</date>
   </refentryinfo>
 
   <refmeta>
@@ -36,7 +36,7 @@
 
   <docinfo>
     <copyright>
-      <year>2014</year>
+      <year>2014-2015</year>
       <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
     </copyright>
   </docinfo>
@@ -45,6 +45,9 @@
     <cmdsynopsis>
       <command>kea-dhcp4</command>
       <arg><option>-v</option></arg>
+      <arg><option>-V</option></arg>
+      <arg><option>-W</option></arg>
+      <arg><option>-d</option></arg>
       <arg><option>-c<replaceable class="parameter">config-file</replaceable></option></arg>
       <arg><option>-p<replaceable class="parameter">port-number</replaceable></option></arg>
     </cmdsynopsis>
@@ -69,7 +72,28 @@
       <varlistentry>
         <term><option>-v</option></term>
         <listitem><para>
-          Enable verbose mode.
+          Display the version.
+        </para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-V</option></term>
+        <listitem><para>
+          Display the extended version.
+        </para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-W</option></term>
+        <listitem><para>
+          Display the configuration report.
+        </para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-d</option></term>
+        <listitem><para>
+          Enable the debug mode with extra verbosity.
         </para></listitem>
       </varlistentry>
 

+ 15 - 9
src/bin/dhcp4/main.cc

@@ -19,6 +19,7 @@
 #include <dhcpsrv/cfgmgr.h>
 #include <log/logger_support.h>
 #include <log/logger_manager.h>
+#include <cfgrpt/config_report.h>
 
 #include <boost/lexical_cast.hpp>
 
@@ -48,13 +49,14 @@ usage() {
     cerr << "Kea DHCPv4 server, version " << VERSION << endl;
     cerr << endl;
     cerr << "Usage: " << DHCP4_NAME
-         << " [-v] [-V] [-d] [-p number] [-c file]" << endl;
-    cerr << "  -c file: specify configuration file" << endl;
+         << " -[v|V|W] [-d] [-c cfgfile] [-p number]" << endl;
+    cerr << "  -v: print version number and exit" << endl;
+    cerr << "  -V: print extended version and exit" << endl;
+    cerr << "  -W: display the configuration report and exit" << endl;
     cerr << "  -d: debug mode with extra verbosity (former -v)" << endl;
+    cerr << "  -c file: specify configuration file" << endl;
     cerr << "  -p number: specify non-standard port number 1-65535 "
          << "(useful for testing only)" << endl;
-    cerr << "  -v: print version number and exit" << endl;
-    cerr << "  -V: print extended version and exit" << endl;
     exit(EXIT_FAILURE);
 }
 } // end of anonymous namespace
@@ -69,7 +71,7 @@ main(int argc, char* argv[]) {
     // The standard config file
     std::string config_file("");
 
-    while ((ch = getopt(argc, argv, "dvVp:c:")) != -1) {
+    while ((ch = getopt(argc, argv, "dvVWc:p:")) != -1) {
         switch (ch) {
         case 'd':
             verbose_mode = true;
@@ -83,6 +85,14 @@ main(int argc, char* argv[]) {
             cout << Daemon::getVersion(true) << endl;
             return (EXIT_SUCCESS);
 
+        case 'W':
+            cout << isc::detail::getConfigReport() << endl;
+            return (EXIT_SUCCESS);
+
+        case 'c': // config file
+            config_file = optarg;
+            break;
+
         case 'p':
             try {
                 port_number = boost::lexical_cast<int>(optarg);
@@ -98,10 +108,6 @@ main(int argc, char* argv[]) {
             }
             break;
 
-        case 'c': // config file
-            config_file = optarg;
-            break;
-
         default:
             usage();
         }

+ 1 - 0
src/bin/dhcp4/tests/Makefile.am

@@ -108,6 +108,7 @@ dhcp4_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
 dhcp4_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
 dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la
 dhcp4_unittests_LDADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la
+dhcp4_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
 endif
 
 noinst_EXTRA_DIST = configs-list.txt

+ 2 - 0
src/bin/dhcp6/Makefile.am

@@ -78,6 +78,8 @@ kea_dhcp6_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
 kea_dhcp6_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
 kea_dhcp6_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 kea_dhcp6_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
+kea_dhcp6_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
+kea_dhcp6_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
 
 kea_dhcp6dir = $(pkgdatadir)
 kea_dhcp6_DATA = dhcp6.spec

+ 23 - 6
src/bin/dhcp6/dhcp6_srv.cc

@@ -49,6 +49,9 @@
 #include <util/encode/hex.h>
 #include <util/io_utilities.h>
 #include <util/range_utilities.h>
+#include <log/logger.h>
+#include <cryptolink/cryptolink.h>
+#include <cfgrpt/config_report.h>
 
 #include <asio.hpp>
 
@@ -65,9 +68,11 @@
 
 using namespace isc;
 using namespace isc::asiolink;
-using namespace isc::dhcp_ddns;
+using namespace isc::cryptolink;
 using namespace isc::dhcp;
+using namespace isc::dhcp_ddns;
 using namespace isc::hooks;
+using namespace isc::log;
 using namespace isc::util;
 using namespace std;
 
@@ -2828,17 +2833,29 @@ Dhcpv6Srv::d2ClientErrorHandler(const
     CfgMgr::instance().getD2ClientMgr().suspendUpdates();
 }
 
+// Refer to config_report so it will be embedded in the binary
+const char* const* dhcp6_config_report = isc::detail::config_report;
+
 std::string
 Daemon::getVersion(bool extended) {
     std::stringstream tmp;
 
     tmp << VERSION;
     if (extended) {
-        tmp << endl << EXTENDED_VERSION;
-
-        // @todo print more details (is it Botan or OpenSSL build,
-        // with or without MySQL/Postgres? What compilation options were
-        // used? etc)
+        tmp << endl << EXTENDED_VERSION << endl;
+        tmp << "linked with:" << endl;
+        tmp << Logger::getVersion() << endl;
+        tmp << CryptoLink::getVersion() << endl;
+#ifdef HAVE_MYSQL
+        tmp << "database: MySQL";
+#else
+#ifdef HAVE_PGSQL
+        tmp << "database: PostgreSQL";
+#else
+        tmp << "no database";
+#endif
+#endif
+        // @todo: more details about database runtime
     }
 
     return (tmp.str());

+ 29 - 5
src/bin/dhcp6/kea-dhcp6.xml

@@ -1,8 +1,8 @@
 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
                "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
-	       [<!ENTITY mdash "&#8212;">]>
+               [<!ENTITY mdash "&#8212;">]>
 <!--
- - Copyright (C) 2011, 2014 Internet Systems Consortium, Inc. ("ISC")
+ - Copyright (C) 2011, 2014, 2015 Internet Systems Consortium, Inc. ("ISC")
  -
  - Permission to use, copy, modify, and/or distribute this software for any
  - purpose with or without fee is hereby granted, provided that the above
@@ -20,7 +20,7 @@
 <refentry>
 
   <refentryinfo>
-    <date>July 1, 2014</date>
+    <date>June 10, 2015</date>
   </refentryinfo>
 
   <refmeta>
@@ -36,7 +36,7 @@
 
   <docinfo>
     <copyright>
-      <year>2014</year>
+      <year>2014-2015</year>
       <holder>Internet Systems Consortium, Inc. ("ISC")</holder>
     </copyright>
   </docinfo>
@@ -45,6 +45,9 @@
     <cmdsynopsis>
       <command>kea-dhcp6</command>
       <arg><option>-v</option></arg>
+      <arg><option>-V</option></arg>
+      <arg><option>-W</option></arg>
+      <arg><option>-d</option></arg>
       <arg><option>-c<replaceable class="parameter">config-file</replaceable></option></arg>
       <arg><option>-p<replaceable class="parameter">port-number</replaceable></option></arg>
     </cmdsynopsis>
@@ -69,7 +72,28 @@
       <varlistentry>
         <term><option>-v</option></term>
         <listitem><para>
-          Enable verbose mode.
+          Display the version.
+        </para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-V</option></term>
+        <listitem><para>
+          Display the extended version.
+        </para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-W</option></term>
+        <listitem><para>
+          Display the configuration report.
+        </para></listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><option>-d</option></term>
+        <listitem><para>
+          Enable the debug mode with extra verbosity.
 <!-- TODO: what does this do? -->
         </para></listitem>
       </varlistentry>

+ 13 - 7
src/bin/dhcp6/main.cc

@@ -20,6 +20,7 @@
 #include <log/logger_support.h>
 #include <log/logger_manager.h>
 #include <exceptions/exceptions.h>
+#include <cfgrpt/config_report.h>
 
 #include <boost/lexical_cast.hpp>
 
@@ -50,11 +51,12 @@ usage() {
     cerr << "Kea DHCPv6 server, version " << VERSION << endl;
     cerr << endl;
     cerr << "Usage: " << DHCP6_NAME
-         << " [-c cfgfile] [-v] [-V] [-d] [-p port_number]" << endl;
-    cerr << "  -c file: specify configuration file" << endl;
+         << " -[v|V|W] [-d] [-c cfgfile] [-p port_number]" << endl;
     cerr << "  -v: print version number and exit." << endl;
     cerr << "  -V: print extended version and exit" << endl;
+    cerr << "  -W: display the configuration report and exit" << endl;
     cerr << "  -d: debug mode with extra verbosity (former -v)" << endl;
+    cerr << "  -c file: specify configuration file" << endl;
     cerr << "  -p number: specify non-standard port number 1-65535 "
          << "(useful for testing only)" << endl;
     exit(EXIT_FAILURE);
@@ -71,7 +73,7 @@ main(int argc, char* argv[]) {
     // The standard config file
     std::string config_file("");
 
-    while ((ch = getopt(argc, argv, "dvVp:c:")) != -1) {
+    while ((ch = getopt(argc, argv, "dvVWc:p:")) != -1) {
         switch (ch) {
         case 'd':
             verbose_mode = true;
@@ -85,6 +87,14 @@ main(int argc, char* argv[]) {
             cout << Daemon::getVersion(true) << endl;
             return (EXIT_SUCCESS);
 
+        case 'W':
+            cout << isc::detail::getConfigReport() << endl;
+            return (EXIT_SUCCESS);
+
+        case 'c': // config file
+            config_file = optarg;
+            break;
+
         case 'p': // port number
             try {
                 port_number = boost::lexical_cast<int>(optarg);
@@ -100,10 +110,6 @@ main(int argc, char* argv[]) {
             }
             break;
 
-        case 'c': // config file
-            config_file = optarg;
-            break;
-
         default:
             usage();
         }

+ 1 - 0
src/bin/dhcp6/tests/Makefile.am

@@ -108,6 +108,7 @@ dhcp6_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
 dhcp6_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
 dhcp6_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
 dhcp6_unittests_LDADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la
+dhcp6_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
 endif
 
 noinst_PROGRAMS = $(TESTS)

+ 1 - 0
src/bin/lfc/Makefile.am

@@ -64,5 +64,6 @@ kea_lfc_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
 kea_lfc_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 kea_lfc_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
 kea_lfc_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
+kea_lfc_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
 
 kea_lfcdir = $(pkgdatadir)

+ 4 - 0
src/bin/lfc/lfc_controller.cc

@@ -25,6 +25,7 @@
 #include <dhcpsrv/lease_file_loader.h>
 #include <log/logger_manager.h>
 #include <log/logger_name.h>
+#include <cfgrpt/config_report.h>
 
 #include <iostream>
 #include <sstream>
@@ -45,6 +46,9 @@ const uint32_t MAX_LEASE_ERRORS = 100;
 namespace isc {
 namespace lfc {
 
+// Refer to config_report so it will be embedded in the binary
+const char* const* lfc_config_report = isc::detail::config_report;
+
 /// @brief Defines the application name, it may be used to locate
 /// configuration data and appears in log statements.
 const char* LFCController::lfc_app_name_ = "DhcpLFC";

+ 1 - 0
src/bin/lfc/tests/Makefile.am

@@ -57,6 +57,7 @@ lfc_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
 lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
 lfc_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
+lfc_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
 
 endif
 

+ 2 - 1
src/bin/perfdhcp/Makefile.am

@@ -1,6 +1,7 @@
 SUBDIRS = . tests
 
 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
+AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
 AM_CPPFLAGS += -I$(top_srcdir)/src/lib/log -I$(top_builddir)/src/lib/log
 AM_CPPFLAGS += $(BOOST_INCLUDES)
 
@@ -47,7 +48,7 @@ perfdhcp_LDADD = libperfdhcp.la
 perfdhcp_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
 perfdhcp_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 perfdhcp_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
-
+perfdhcp_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
 
 # ... and the documentation
 EXTRA_DIST = perfdhcp_internals.dox

+ 4 - 0
src/bin/perfdhcp/command_options.cc

@@ -18,6 +18,7 @@
 #include <exceptions/exceptions.h>
 #include <dhcp/iface_mgr.h>
 #include <dhcp/duid.h>
+#include <cfgrpt/config_report.h>
 
 #include <boost/lexical_cast.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
@@ -35,6 +36,9 @@ using namespace isc;
 namespace isc {
 namespace perfdhcp {
 
+// Refer to config_report so it will be embedded in the binary
+const char* const* perfdhcp_config_report = isc::detail::config_report;
+
 CommandOptions::LeaseType::LeaseType()
     : type_(ADDRESS) {
 }

+ 1 - 0
src/bin/perfdhcp/tests/Makefile.am

@@ -47,6 +47,7 @@ run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
 run_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
 run_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
 run_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
+run_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la
 run_unittests_LDADD += $(GTEST_LDADD)
 endif
 

+ 6 - 1
src/lib/cryptolink/botan_link.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2011, 2014  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011, 2014, 2015  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -43,6 +43,11 @@ CryptoLink::initialize() {
     }
 }
 
+std::string
+CryptoLink::getVersion() {
+    return (Botan::version_string());
+}
+
 } // namespace cryptolink
 } // namespace isc
 

+ 4 - 1
src/lib/cryptolink/cryptolink.h

@@ -1,4 +1,4 @@
-// Copyright (C) 2011, 2014  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011, 2014, 2015  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -161,6 +161,9 @@ public:
     ///
     static void initialize();
 
+    /// \brief Get version string
+    static std::string getVersion();
+
     /// \brief Factory function for Hash objects
     ///
     /// CryptoLink objects cannot be constructed directly. This

+ 8 - 1
src/lib/cryptolink/openssl_link.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2014  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014, 2015  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -16,6 +16,8 @@
 #include <cryptolink/crypto_hash.h>
 #include <cryptolink/crypto_hmac.h>
 
+#include <openssl/crypto.h>
+
 namespace isc {
 namespace cryptolink {
 
@@ -46,6 +48,11 @@ CryptoLink::initialize() {
     }
 }
 
+std::string
+CryptoLink::getVersion() {
+    return (SSLeay_version(SSLEAY_VERSION));
+}
+
 } // namespace cryptolink
 } // namespace isc
 

+ 6 - 1
src/lib/cryptolink/tests/crypto_unittests.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2011, 2014  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011, 2014, 2015  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -22,6 +22,11 @@
 
 using namespace isc::cryptolink;
 
+// Test get version
+TEST(CryptoLinkTest, Version) {
+    EXPECT_NO_THROW(CryptoLink::getVersion());
+}
+
 // Tests whether getCryptoLink() returns a singleton instance
 TEST(CryptoLinkTest, Singleton) {
     const CryptoLink& c1 = CryptoLink::getCryptoLink();

+ 7 - 1
src/lib/log/logger.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011, 2015  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -50,6 +50,12 @@ Logger::~Logger() {
     loggerptr_ = 0;
 }
 
+// Get Version
+std::string
+Logger::getVersion() {
+    return (LoggerImpl::getVersion());
+}
+
 // Get Name of Logger
 
 std::string

+ 4 - 1
src/lib/log/logger.h

@@ -1,4 +1,4 @@
-// Copyright (C) 2011, 2014  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011, 2014, 2015  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -200,6 +200,9 @@ public:
     /// \brief Destructor
     virtual ~Logger();
 
+    /// \brief Version
+    static std::string getVersion();
+
     /// \brief The formatter used to replace placeholders
     typedef isc::log::Formatter<Logger> Formatter;
 

+ 12 - 1
src/lib/log/logger_impl.cc

@@ -1,4 +1,4 @@
-// Copyright (C) 2011,2014-2015  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011, 2014-2015  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -19,10 +19,12 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <cstring>
+#include <sstream>
 #include <boost/lexical_cast.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/algorithm/string.hpp>
 
+#include <log4cplus/version.h>
 #include <log4cplus/configurator.h>
 #include <log4cplus/loggingmacros.h>
 
@@ -84,6 +86,15 @@ LoggerImpl::~LoggerImpl() {
     delete sync_;
 }
 
+/// \brief Version
+std::string
+LoggerImpl::getVersion() {
+    std::ostringstream ver;
+    ver << "log4plus ";
+    ver << log4cplus::versionStr;
+    return (ver.str());
+}
+
 // Set the severity for logging.
 void
 LoggerImpl::setSeverity(isc::log::Severity severity, int dbglevel) {

+ 5 - 1
src/lib/log/logger_impl.h

@@ -1,4 +1,4 @@
-// Copyright (C) 2011  Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2011, 2015  Internet Systems Consortium, Inc. ("ISC")
 //
 // Permission to use, copy, modify, and/or distribute this software for any
 // purpose with or without fee is hereby granted, provided that the above
@@ -77,6 +77,10 @@ public:
     virtual ~LoggerImpl();
 
 
+    /// \brief Version
+    static std::string getVersion();
+
+
     /// \brief Get the full name of the logger (including the root name)
     virtual std::string getName() {
         return (name_);

+ 5 - 0
src/lib/log/tests/logger_unittest.cc

@@ -48,6 +48,11 @@ public:
     }
 };
 
+// Check version
+
+TEST_F(LoggerTest, Version) {
+    EXPECT_NO_THROW(Logger::getVersion());
+}
 
 // Checks that the logger is named correctly.
 

+ 46 - 0
tools/mk_cfgrpt.sh

@@ -0,0 +1,46 @@
+#!/bin/sh
+# Copyright (C) 2015  Internet Systems Consortium, Inc. ("ISC")
+#
+# Permission to use, copy, modify, and/or 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.
+#
+# This script embeds config.report into src/bin/cfgrpt/config_report.cc
+# Called by configure
+#
+
+dest=$1
+
+# Initializes
+cat > $dest
+
+# Header
+cat >> $dest << END
+// config_report.cc. Generated from config.report by tools/mk_cfgrpt_header.sh
+
+namespace isc {
+namespace detail {
+
+extern const char* const config_report[] = {
+END
+
+# Body: escape '\'s and '"'s, preprend '    ";;;; ' and append '",'
+sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/    ";;;; /' -e 's/$/",/' \
+    < config.report >> $dest
+
+# Trailer
+cat >> $dest <<END
+    ""
+};
+
+}
+}
+END