README.par.old 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. pdnsd maintenance version 1.1.11-par by Paul Rombouts
  2. =======================================================
  3. This file describes the version of pdnsd that I maintain personally and am
  4. making available so other people can enjoy the latest features and fixes.
  5. Thomas Moestl no longer maintains pdnsd himself, so I am effectively the new
  6. maintainer. The current version is 1.1.11-par, which has a rather large number
  7. of small changes. Among the bugs fixed are a race condition in the cache lookup
  8. code, a flaw in the code that caused a busy spin when a remote server answered
  9. with "Not Implemented", and problems with the -4 and -6 command-line options.
  10. Among the improvements are an alternative sorting algorithm which should allow
  11. pdnsd to start up faster when reading a large cache file from disk, automatic
  12. mapping of IPv4 to IPv6 addresses when running in IPv6 mode, somewhat more
  13. efficient memory use, and better compression of the replies. Some of the new
  14. features are described in the second half of this file (look for "new in version
  15. 1.1.11"). For the rest of the changes I will have to refer you to the ChangeLog.
  16. For a short history about recent releases have a look at doc/html/index.html.
  17. Since version 1.1.9 I've added some missing pieces to the documentation (the
  18. manual doc/html/doc.html,doc/txt/manual.txt and the man page doc/pdnsd-ctl.8).
  19. Version 1.1.11 finally has a man page doc/pdnsd.8, thanks to a contribution by
  20. Mahesh T. Pai.
  21. The first part of this file describes how to patch, compile, install and run
  22. pdnsd. The second part describes some of the changes I've made to Thomas
  23. Moestl's code.
  24. Unless you're using the pre-patched source archive pdnsd-1.1.11-par.tar.gz you
  25. must first apply my patch file pdnsd-1.1.11-par.diff.gz before compiling and
  26. installing pdnsd according to Thomas Moestl's instructions described in the the
  27. documentation. Use a freshly untarred copy of Thomas Moestl's original version
  28. 1.1.7a source, cd into the source directory pdnsd-1.1.7a and apply the command:
  29. gzip -cd <path_to_patch>/pdnsd-1.1.11-par.diff.gz | patch -p2 -N -Z
  30. Note: I have used GNU extensions so there may be some portability issues. I have
  31. supplied alternatives for some of the less portable functions. There should be no
  32. problem with most Linux distributions.
  33. That's it! You should now be able to compile, install and run pdnsd. See the
  34. documentation in doc/html/doc.html or doc/txt/manual.txt for more detailed
  35. instructions.
  36. Some people may want change the compiler optimization flag. I use the -O2 flag,
  37. but it might be safer to use a lower level of optimization or no optimization at
  38. all. In that case prefix the configure command with the desired compiler flags
  39. like this (assuming you're using a bash shell):
  40. CFLAGS="-O1 -g -Wall" ./configure ...
  41. I have added a new configuration option "--with-thread-lib=<lib>", which you
  42. should use if you experience problems with signal handling under Linux. The
  43. usual symptom is failure by pdnsd to save the cache to disk, and
  44. /var/cache/pdnsd/pdnsd.cache remaining empty. If you experience this kind of
  45. trouble, try reconfiguring with different values for the --with-thread-lib
  46. option. The allowable values are "linuxthreads" (the default), "linuxthreads2"
  47. (or "lt2" for short), and "nptl". I recommend that you first configure and
  48. compile without the --with-thread-lib option, then if you experience trouble try
  49. again with --with-thread-lib=lt2 and recompile.
  50. If your Linux system has an implementation of the Native POSIX Thread Library,
  51. which is the case with Red Hat 9 for instance, you should use
  52. --with-thread-lib=nptl .
  53. Ideally, I would like to write a configure script which automatically detects
  54. which kind of thread library is being used on a Linux system, but I don't have a
  55. clue yet how to do this. If you can help me with this please write to me at the
  56. email address listed at the end of this file.
  57. The rest of this file describes some of the modifications I've made, but you
  58. don't have to read it if you simply want to run pdnsd as you're used to.
  59. - The main new feature I've added enables you to change the server addresses
  60. that pdnsd uses at run-time using pdnsd-ctl. I've done this because the ISPs I
  61. use do not specify fixed DNS server addresses, but expect their clients to use
  62. dynamic DNS configuration (DHCP in the case of the cable connection, RFC1877
  63. in case of isdn). I've extended the options that can be given with the
  64. "server" command to pdnsd-ctl, to allow IP addresses to be specified as an
  65. additional argument after "up|down|retest". This allows me to put something
  66. like this in my ifup-local script:
  67. pdnsd-ctl server isp-label up "$DNS1 $DNS2"
  68. For more details how to use pdnsd-ctl read the updated documentation in
  69. the doc/html directory. There is also a manpage for pdnsd-ctl.
  70. This was quite tricky to implement because there might be pending queries
  71. while the addresses are being changed. It certainly was an interesting
  72. exercise in writing multi-threaded code for me.
  73. - I've implemented a feature which allowed me to specify multiple IP addresses
  74. per server section in the configuration file. This allowed for a much more
  75. compact configuration file (3 server sections instead of 7 in my case),
  76. because most configuration options are identical for servers belonging to the
  77. same ISP. It also made the output of "pdnsd-ctl status" more compact. And it
  78. was necessary to enable a satisfactory implementation of the previous feature.
  79. Example of the new syntax:
  80. ip = 123.456.789.001, 123.456.789.002, 123.456.789.003;
  81. At the suggestion of Greg Norris server sections no longer have to specify IP
  82. addresses. A server section without IP addresses will remain inactive until it
  83. is assigned one more addresses at run-time with pdnsd-ctl.
  84. - I've changed the implementation of dynamic arrays to make it slightly more
  85. efficient, and improve type safety. I also got rid of several arrays of fixed
  86. size in favor of dynamically allocated arrays. In particular, I got rid of
  87. all occurrences of MAXPATH. I also made several static variables "automatic".
  88. - The output of the "status" command of pdnsd-ctl now gives more meaningful
  89. constant names "ping|none|if|exec" instead of numbers for the "uptest" option.
  90. I've also added some information that was previously missing.
  91. - I've fixed I a problem that caused pdnsd to use up a lot of CPU time and slow
  92. down my system considerably when it received a query that took a long time to
  93. resolve. It turned out that pdnsd can get into a "busy spin" when one of the
  94. DNS servers pdnsd is querying refuses the connection. Apart from fixing this
  95. bug, to speed things up additionally, I thought it would be a good idea to
  96. mark a server down (without retesting it) after detecting errno==ECONNREFUSED.
  97. This gives me very satisfactory performance, with the problematic server being
  98. tried only once during every testing interval.
  99. New in version 1.1.11: An additional busy spin condition, triggered when a
  100. remote server answers with "Not Implemented", has been discovered and fixed.
  101. In case there are remaining bugs in the multiplexing code, I've added a test
  102. that checks if the number of events reported by poll/select matches the number
  103. of events handled by pdnsd. If not, pdnsd will log an error message and give
  104. up. Although the bugs still need to be reported and fixed, at least this
  105. should prevent pdnsd from wasting CPU cycles.
  106. - Due to a bug in Thomas' code, pdnsd tries, but fails, to remove the control
  107. socket "pdnsd.status" before exiting. This has also been fixed. In version
  108. 1.1.8b1-par6 I have cleaned this up some more so that pdnsd will handle
  109. situations where it can't open or bind the control socket more gracefully.
  110. - I've rewritten some of the code that saves the contents of the cache to the
  111. file "pdnsd.cache" just before pdnsd exits. This is because I noticed in my
  112. logfiles that pdnsd occasionally had problems reading this file back at
  113. startup. I eliminated the use of fseek() in Thomas' code. I could not find
  114. anything that was demonstrably incorrect about his use of fseek(), but it
  115. seemed better to me to do without it and write the file in a strictly
  116. sequential order. Anyway, it turned out my hunch paid off: no more error
  117. messages about "pdnsd.cache" in my logfile.
  118. New in version 1.1.11: I've added some new code for sorting the queue used for
  119. purging stale cache entries. This should allow pdnsd to start up faster when
  120. reading large cache files from disk.
  121. - I've extended the configuration options for policies of inclusion/exclusion
  122. lists in server sections. The new policies options are "simple_only" and
  123. "fqdn_only". Setting policy=simple_only will cause the server to used only for
  124. simple hostnames if no other rule matches. On the other hand, setting
  125. policy=fqdn_only will cause the server to be used only for fully qualified
  126. domain names (i.e. the name has at least one dot in-between). I find these
  127. options useful for controlling which name servers (if any) will be used by
  128. pdnsd for simple host names.
  129. - I've added a new "delegation_only" option that can be used to undo the
  130. unwanted effects of DNS "wildcards". It works roughly as the feature by the
  131. same name in BIND. It is turned off by default. To block Verisign's
  132. Sitefinder, add the following line to the global section of the configuration
  133. file:
  134. delegation_only= com, net;
  135. If you find that this feature blocks some legitimate domain names, you will
  136. probably need to add the address of a nameserver that provides good authority
  137. information. More information can be found at
  138. http://www.phys.uu.nl/~rombouts/pdnsd/delegationonly.html
  139. - It is no longer mandatory that domain names in the configuration file end in a
  140. dot.
  141. - The parser for configuration files has been rewritten purely in C, so (f)lex
  142. and yacc/bison are no longer needed to build pdnsd.
  143. It is no longer necessary to place strings between quotes in the configuration
  144. file, unless a string contains a special character such as whitespace, a token
  145. that normally starts a comment, or one of the characters ",;{}". Note that
  146. these special characters are illegal in domain names anyway.
  147. - New in version 1.1.11: Negating whole domains with a neg section in the
  148. config file will result in all the subdomains being negated as well.
  149. For example, adding the lines
  150. neg {name=doubleclick.com; types=domain;}
  151. neg {name=doubleclick.net; types=domain;}
  152. will also negate ad.doubleclick.com, ad.fr.doubleclick.net, etc.
  153. - New in version 1.1.11: When running in IPv6 mode, pdnsd will now automatically
  154. map any IPv4 addresses it reads in the config file to IPv6 addresses.
  155. When pdnsd has been compiled with IPv6 support and runs in IPv4 mode, it will
  156. skip IPv6 addresses with a warning message. This may result in certain server
  157. sections becoming inactive, though.
  158. The -4 and -6 options should now work as advertised.
  159. I've added two new command-line options, "-a" and "-i <prefix>".
  160. With the -a flag pdnsd will try to detect automatically if IPv6 support is
  161. available on a system, and fall back to IPv4 if not. The -a flag can be used
  162. instead of -4 or -6.
  163. The -i option can be used to specify a prefix for mapping IPv4 to IPv6
  164. address. The default is ::ffff.0.0.0.0. There is also a corresponding
  165. ipv4_6_prefix= option for the config file.
  166. - New in version 1.1.11: I've slightly changed the way pdnsd does parallel
  167. queries. Active queries or not canceled until we have received a useful
  168. response from a remote name server, or all the queries have failed or timed
  169. out. Thus the par_queries parameter is no longer the maximum number of
  170. parallel queries, but rather the increment with which the number of parallel
  171. queries is increased when the previous set has timed out. In the worst case
  172. there will be pending queries to all the servers in the list of available
  173. servers simultaneously. We may be wasting more system resources this way, but
  174. the advantage is that we have a greater chance of catching a reply. After all,
  175. if we wait longer anyway, why not for more servers.
  176. I've also introduced a global timeout parameter. This is the minimum period of
  177. time pdnsd will wait after sending the first query to a remote server before
  178. giving up without having received a reply. The timeout options in the
  179. configuration file are now only minimum timeout intervals. Setting the global
  180. timeout option makes it possible to specify quite short timeout intervals in
  181. the server sections. This will have the effect that pdnsd will start querying
  182. additional servers fairly quickly if the first servers are slow to respond
  183. (but will still continue to listen for responses from the first ones). This
  184. may allow pdnsd to get an answer more quickly in certain situations.
  185. After receiving a reply from a remote server the server is marked up and its
  186. time stamp is updated. This will have the effect that pdnsd doesn't bother
  187. testing this server for availability for a period of time, and thus the
  188. overhead caused by testing is reduced. After server timeouts, uptests are
  189. performed by the separate server status thread, not by threads that have to
  190. answer queries. Unresponsive servers with uptest=ping will not be marked down
  191. immediately any more, but only after the ping test has definitely failed.
  192. I've also included a number of bug-fixes contained in a patch file supplied to
  193. me by Thomas Moestl. In addition to the things I had already fixed, the
  194. following issues are addressed: some memory leaks, dropping of root privileges
  195. before calling uptest scripts in case pdnsd was started setuid root (which is a
  196. bad idea anyway), passing on open fd's to uptests, integer overruns in the
  197. status reporting code, fixing string passing from the lexer, more consistent
  198. treatment of underscores in domain names.
  199. In addition to the things I've listed above, I've made various little changes to
  200. fix minor bugs, improve efficiency or elegance, or simply to suit my my own
  201. coding style. These changes are too numerous to list here, but some of them are
  202. listed in the ChangeLog. Of course if you are really interested in the
  203. nitty-gritty you can always compare the source of my version with Thomas'
  204. original code.
  205. If you have any questions about the modifications I've made, you can send these
  206. to <p.a.rombouts@home.nl>. Questions about the original pdnsd version should
  207. be sent to <tmoestl@gmx.net> or <t.moestl@tu-bs.de>.