You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

176 lines
4.0 KiB

  1. /*
  2. * This file is part of PowerDNS or dnsdist.
  3. * Copyright -- PowerDNS.COM B.V. and its contributors
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * In addition, for the avoidance of any doubt, permission is granted to
  10. * link this program with OpenSSL and to (re)distribute the binaries
  11. * produced as the result of such linking.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. */
  22. #ifdef HAVE_CONFIG_H
  23. #include "config.h"
  24. #endif
  25. #include "logger.hh"
  26. #include "version.hh"
  27. static ProductType productType;
  28. string compilerVersion()
  29. {
  30. #if defined(__clang__)
  31. return string("clang " __clang_version__ );
  32. #elif defined(__GNUC__)
  33. return string("gcc " __VERSION__ );
  34. #else // add other compilers here
  35. return string("Unknown compiler");
  36. #endif
  37. }
  38. // Human-readable product name
  39. string productName() {
  40. switch (productType) {
  41. case ProductAuthoritative:
  42. return "PowerDNS Authoritative Server";
  43. case ProductRecursor:
  44. return "PowerDNS Recursor";
  45. };
  46. return "Unknown";
  47. }
  48. string getPDNSVersion()
  49. {
  50. return VERSION;
  51. }
  52. // REST API product type
  53. string productTypeApiType() {
  54. switch (productType) {
  55. case ProductAuthoritative:
  56. return "authoritative";
  57. case ProductRecursor:
  58. return "recursor";
  59. };
  60. return "unknown";
  61. }
  62. void showProductVersion()
  63. {
  64. g_log<<Logger::Warning<<productName()<<" "<< VERSION << " (C) 2001-2020 "
  65. "PowerDNS.COM BV" << endl;
  66. g_log<<Logger::Warning<<"Using "<<(sizeof(unsigned long)*8)<<"-bits mode. "
  67. "Built using " << compilerVersion()
  68. #ifndef REPRODUCIBLE
  69. <<" on " __DATE__ " " __TIME__ " by " BUILD_HOST
  70. #endif
  71. <<"."<< endl;
  72. g_log<<Logger::Warning<<"PowerDNS comes with ABSOLUTELY NO WARRANTY. "
  73. "This is free software, and you are welcome to redistribute it "
  74. "according to the terms of the GPL version 2." << endl;
  75. }
  76. void showBuildConfiguration()
  77. {
  78. g_log<<Logger::Warning<<"Features: "<<
  79. #ifdef HAVE_LIBDECAF
  80. "decaf " <<
  81. #endif
  82. #ifdef HAVE_BOOST_CONTEXT
  83. "fcontext " <<
  84. #endif
  85. #ifdef HAVE_LIBCRYPTO_ECDSA
  86. "libcrypto-ecdsa " <<
  87. #endif
  88. #ifdef HAVE_LIBCRYPTO_ED25519
  89. "libcrypto-ed25519 " <<
  90. #endif
  91. #ifdef HAVE_LIBCRYPTO_ED448
  92. "libcrypto-ed448 " <<
  93. #endif
  94. #ifdef HAVE_LIBCRYPTO_EDDSA
  95. "libcrypto-eddsa " <<
  96. #endif
  97. #ifdef HAVE_LIBDL
  98. "libdl " <<
  99. #endif
  100. #ifdef HAVE_GEOIP
  101. "libgeoip " <<
  102. #endif
  103. #ifdef HAVE_MMDB
  104. "libmaxminddb " <<
  105. #endif
  106. #ifdef HAVE_LUA
  107. "lua " <<
  108. #endif
  109. #ifdef HAVE_LUA_RECORDS
  110. "lua-records " <<
  111. #endif
  112. #ifdef NOD_ENABLED
  113. "nod " <<
  114. #endif
  115. #ifdef HAVE_P11KIT1
  116. "PKCS#11 " <<
  117. #endif
  118. #ifdef HAVE_PROTOBUF
  119. "protobuf " <<
  120. #endif
  121. #ifdef HAVE_FSTRM
  122. "dnstap-framestream " <<
  123. #endif
  124. #ifdef REMOTEBACKEND_ZEROMQ
  125. "remotebackend-zeromq " <<
  126. #endif
  127. #ifdef HAVE_NET_SNMP
  128. "snmp " <<
  129. #endif
  130. #ifdef HAVE_LIBSODIUM
  131. "sodium " <<
  132. #endif
  133. #ifdef VERBOSELOG
  134. "verboselog" <<
  135. #endif
  136. endl;
  137. #ifdef PDNS_MODULES
  138. // Auth only
  139. g_log<<Logger::Warning<<"Built-in modules: "<<PDNS_MODULES<<endl;
  140. #endif
  141. #ifdef PDNS_CONFIG_ARGS
  142. #define double_escape(s) #s
  143. #define escape_quotes(s) double_escape(s)
  144. g_log<<Logger::Warning<<"Configured with: "<<escape_quotes(PDNS_CONFIG_ARGS)<<endl;
  145. #undef escape_quotes
  146. #undef double_escape
  147. #endif
  148. }
  149. string fullVersionString()
  150. {
  151. ostringstream s;
  152. s<<productName()<<" " VERSION;
  153. #ifndef REPRODUCIBLE
  154. s<<" (built " __DATE__ " " __TIME__ " by " BUILD_HOST ")";
  155. #endif
  156. return s.str();
  157. }
  158. void versionSetProduct(ProductType pt)
  159. {
  160. productType = pt;
  161. }
  162. ProductType versionGetProduct()
  163. {
  164. return productType;
  165. }