dhcp6.dox 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. // Copyright (C) 2012-2013 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. /**
  15. @page dhcp6 DHCPv6 Server Component
  16. BIND10 offers DHCPv6 server implementation. It is implemented as
  17. b10-dhcp6 component. Its primary code is located in
  18. isc::dhcp::Dhcpv6Srv class. It uses \ref libdhcp extensively,
  19. especially lib::dhcp::Pkt6, isc::dhcp::Option and
  20. isc::dhcp::IfaceMgr classes. Currently this code offers skeleton
  21. functionality, i.e. it is able to receive and process incoming
  22. requests and trasmit responses. However, it does not have database
  23. management, so it returns only one, hardcoded lease to whoever asks
  24. for it.
  25. DHCPv6 server component does not support relayed traffic yet, as
  26. support for relay decapsulation is not implemented yet.
  27. DHCPv6 server component does not use BIND10 logging yet.
  28. @section dhcpv6Session BIND10 message queue integration
  29. DHCPv4 server component is now integrated with BIND10 message queue.
  30. It follows the same principle as DHCPv4. See \ref dhcpv4Session for
  31. details.
  32. @section dhcpv6ConfigParser Configuration Parser in DHCPv6
  33. b10-dhcp6 component uses BIND10 cfgmgr for commands and configuration. During
  34. initial configuration (See \ref
  35. isc::dhcp::ControlledDhcpv6Srv::establishSession()), the configuration handler
  36. callback is installed (see isc::dhcp::ControlledDhcpv6Srv::dhcp6ConfigHandler().
  37. It is called every time there is a new configuration. In particular, it is
  38. called every time during daemon start process. It contains a
  39. isc::data::ConstElementPtr to a new configuration. This simple handler calls
  40. \ref isc::dhcp::configureDhcp6Server() method that processes received configuration.
  41. This method iterates over list of received configuration elements and creates a
  42. list of parsers for each received entry. Parser is an object that is derived
  43. from a DhcpConfigParser class. Once a parser is created
  44. (constructor), its value is set (using build() method). Once all parsers are
  45. build, the configuration is then applied ("committed") and commit() method is
  46. called.
  47. All parsers are defined in src/bin/dhcp6/config_parser.cc file. Some of them
  48. are generic (e.g. Uint32Parser that is able to handle any
  49. unsigned 32 bit integer), but some are very specialized (e.g.
  50. Subnets6ListConfigParser parses definitions of Subnet6 lists). In some cases,
  51. e.g. subnet6 definitions, the configuration entry is not a simple value, but
  52. a map or a list itself. In such case, the parser iterates over all elements
  53. and creates parsers for a given scope. This process may be repeated (sort of)
  54. recursively.
  55. @section dhcpv6ConfigInherit DHCPv6 Configuration Inheritance
  56. One notable useful feature of DHCP configuration is its parameter inheritance.
  57. For example, renew-timer value may be specified at a global scope and it then
  58. applies to all subnets. However, some subnets may have it overwritten with more
  59. specific values that takes precedence over global values that are considered
  60. defaults. Some parsers (e.g. Uint32Parser and StringParser) implement that
  61. inheritance. By default, they store values in global uint32_defaults and
  62. string_defaults storages. However, it is possible to instruct them to store
  63. parsed values in more specific storages. That capability is used, e.g. in
  64. Subnet6ConfigParser that has its own storage that is unique for each subnet.
  65. Finally, during commit phase (commit() method), appropriate parsers can use
  66. apply parameter inheritance.
  67. Debugging configuration parser may be confusing. Therefore there is a special
  68. class called DebugParser. It does not configure anything, but just
  69. accepts any parameter of any type. If requested to commit configuration, it will
  70. print out received parameter name and its value. This class is not currently used,
  71. but it is convenient to have it every time a new parameter is added to DHCP
  72. configuration. For that purpose it should be left in the code.
  73. Parameter inheritance is done during reconfiguration phase, as reconfigurations
  74. are rare, so extra logic here is not a problem. On the other hand, values of
  75. those parameters may be used thousands times per second, so its use must be as
  76. simple as possible. In fact, currently the code has to call Subnet6->getT1() and
  77. do not implement any fancy inheritance logic.
  78. @section dhcpv6DDNSIntegration DHCPv6 Server Support for the Dynamic DNS Updates
  79. The DHCPv6 server supports processing of the DHCPv6 Client FQDN Option described in
  80. the RFC4704. This Option is sent by the DHCPv6 client to instruct the server to
  81. update the DNS mappings for the acquired lease. A client may send its fully
  82. qualified domain name, a partial name or it may choose that server will generate
  83. the name. In the last case, the client sends an empty domain-name field in the
  84. DHCPv6 Client FQDN Option.
  85. As described in RFC4704, client may choose that the server delegates the forward
  86. DNS update to the client and that the server performs the reverse update only. Current
  87. version of the DHCPv6 server does not support delegation of the forward update
  88. to the client. The implementation of this feature is planned for the future releases.
  89. The b10-dhcp-ddns process is responsible for the actual communication with the DNS
  90. server, i.e. to send DNS Update messages. The b10-dhcp6 module is responsible
  91. for generating so called @ref isc::dhcp_ddns::NameChangeRequest and sending it to the
  92. b10-dhcp-ddns module. The @ref isc::dhcp_ddns::NameChangeRequest object represents changes to the
  93. DNS bindings, related to acquisition, renewal or release of the lease. The bind10-dhcp6
  94. module implements the simple FIFO queue of the NameChangeRequest objects. The module
  95. logic, which processes the incoming DHCPv6 Client FQDN Options puts these requests
  96. into the FIFO queue.
  97. @todo Currently the FIFO queue is not processed after the NameChangeRequests are
  98. generated and added to it. In the future implementation steps it is planned to create
  99. a code which will check if there are any outstanding requests in the queue and
  100. send them to the bind10-dhcp-ddns module when server is idle waiting for DHCP messages.
  101. In the simplest case, when client gets one address from the server, a DHCPv6 server
  102. may generate 0, 1 or 2 NameChangeRequests during single message processing.
  103. Server generates no NameChangeRequests if it is not configured to update DNS
  104. or it rejects the DNS update for any other reason.
  105. Server may generate 1 NameChangeRequests in a situation when a client acquires a
  106. new lease or it releases an existing lease. In the former case, the NameChangeRequest
  107. type is CHG_ADD, which indicates that the bind10-dhcp-ddns module should add a new DNS
  108. binding for the client, and it is assumed that there is no DNS binding for this
  109. client already. In the latter case, the NameChangeRequest type is CHG_REMOVE to
  110. indicate to the bind10-dhcp-ddns module that the existing DNS binding should be removed
  111. from the DNS. The binding consists of the forward and reverse mapping.
  112. A server may only remove the mapping which it had added. Therefore, the lease database
  113. holds an information which updates (no update, reverse only update, forward only update,
  114. both reverse and forward update) have been performed when the lease was acquired.
  115. Server checks this information to make a decision which mapping it is supposed to
  116. remove when a lease is released.
  117. Server may generate 2 NameChangeRequests in case the client is renewing a lease and
  118. it already has a DNS binding for that lease. Note, that renewal may be triggered
  119. as a result of sending a RENEW message as well as the REQUEST message. In both cases
  120. DHCPv6 server will check if there is an existing lease for the client which has sent
  121. a message, and if there is it will check in the lease database if the DNS Updates had
  122. been performed for this client. If the notion of client's FQDN changes comparing to
  123. the information stored in the lease database, the DHCPv6 has to remove an existing
  124. binding from the DNS and then add a new binding according to the new FQDN information
  125. received from the client. If the FQDN sent in the message which triggered a renewal
  126. doesn't change (comparing to the information in the lease database) the NameChangeRequest
  127. is not generated.
  128. In the more complex scenarios, when server sends multiple IA_NA options, each holding
  129. multiple IAADDR options, server will generate more NameChangeRequests for a single
  130. message being processed. That is 0, 1, 2 for the individual IA_NA. Generation of
  131. the distinct NameChangeRequests for each IADDR is not supported yet.
  132. The DHCPv6 Client FQDN Option comprises "NOS" flags which communicate to the
  133. server what updates (if any), client expects the server to perform. Server
  134. may be configured to obey client's preference or do FQDN processing in a
  135. different way. If the server overrides client's preference it will communicate it
  136. by sending the DHCPv6 Client FQDN Option in its responses to a client, with
  137. appropriate flags set.
  138. @todo Note, that current implementation doesn't allow configuration of the server's behaviour
  139. with respect to DNS Updates. This is planned for the future. The default behaviour is
  140. constituted by the set of constants defined in the (upper part of) dhcp6_srv.cc file.
  141. Once the configuration is implemented, these constants will be removed.
  142. @todo Add section about setting up options and their definitions with bindctl.
  143. @section dhcpv6OptionsParse Custom functions to parse message options
  144. The DHCPv6 server implementation provides a generic support to define option
  145. formats and set option values. A number of options formats have been defined
  146. for standard options in libdhcp++. However, the formats for vendor specific
  147. options are dynamically configured by the server's administrator and thus can't
  148. be stored in libdhcp++. Such option formats are stored in the
  149. @c isc::dhcp::CfgMgr. The libdhcp++ provides functions for recursive parsing
  150. of options which may be encapsulated by other options up to the any level of
  151. encapsulation but these functions are unaware of the option formats defined
  152. in the @c isc::dhcp::CfgMgr because they belong to a different library.
  153. Therefore, the generic functions @c isc::dhcp::LibDHCP::unpackOptions4 and
  154. @c isc::dhcp::LibDHCP::unpackOptions6 are only useful to parse standard
  155. options which definitions are provided in the libdhcp++. In order to overcome
  156. this problem a callback mechanism has been implemented in @c Option and @c Pkt6
  157. classes. By installing a callback function on the instance of the @c Pkt6 the
  158. server may provide a custom implementation of the options parsing algorithm.
  159. This callback function will take precedence over the @c LibDHCP::unpackOptions6
  160. and @c LibDHCP::unpackOptions4 functions. With this approach, the callback is
  161. implemented within the context of the server and it has access to all objects
  162. which define its configuration (including dynamically created option
  163. definitions).
  164. @section dhcpv6Other Other DHCPv6 topics
  165. For hooks API support in DHCPv6, see @ref dhcpv6Hooks.
  166. */