RFC 7653

DHCPv6 Active Leasequery

๐Ÿ“… published October 2015, from ietf

RFC 7653: DHCPv6 Active Leasequery ๐Ÿฆ‹

okay bestie, let's get into it ๐Ÿ’… this is RFC 7653, called DHCPv6 Active Leasequery, and it comes from the IETF (Internet Engineering Task Force) ๐ŸŒธ it was written by D. Raghuvanshi, K. Kinnear, and D. Kukrety, all at Cisco Systems, Inc. ๐Ÿ’– it's dated October 2015 and it's a Standards Track document, so it's an actual Internet standard and not just a vibe ๐Ÿ˜ญ its ISSN is 2070-1721. the main tea is that it updates RFC 5460 (DHCPv6 Bulk Leasequery) by adding new options ๐ŸŽ€

Status of This Memo ๐Ÿ“œ

this is an Internet Standards Track document ๐Ÿ”ฅ

it's a product of the IETF, which means it reflects the consensus of the IETF community ๐Ÿซถ it got public review and was approved for publication by the Internet Engineering Steering Group (IESG) โœจ if you want more on Internet Standards, check out Section 2 of RFC 5741 ๐Ÿ“š

for the current status, any errata, and how to give feedback, go to http://www.rfc-editor.org/info/rfc7653 ๐Ÿฆ‹

Copyright (c) 2015 IETF Trust and the persons identified as the document authors. All rights reserved ๐Ÿ’œ

this document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) as they stand on the publication date ๐Ÿ“„ please read these carefully, because they spell out your rights and restrictions for this document ๐Ÿ™ˆ any Code Components pulled out of this document must include Simplified BSD License text, as described in Section 4.e of the Trust Legal Provisions, and they come without warranty, as described in the Simplified BSD License ๐Ÿ’€

Table of Contents ๐Ÿ—บ๏ธ

1. Introduction ....................................................4
2. Terminology .....................................................4
3. Protocol Overview ...............................................6
4. Interaction between Active Leasequery and Bulk Leasequery .......8
5. Extension to DHCPv6 Bulk Leasequery .............................8
6. Message and Option Definitions ..................................9
   6.1. Message Framing for TCP ....................................9
   6.2. Messages ...................................................9
        6.2.1. ACTIVELEASEQUERY ....................................9
        6.2.2. STARTTLS ...........................................10
        6.2.3. Response Messages ..................................10
   6.3. Options ...................................................10
        6.3.1. OPTION_LQ_BASE_TIME ................................10
        6.3.2. OPTION_LQ_START_TIME ...............................11
        6.3.3. OPTION_LQ_END_TIME .................................12
   6.4. Connection and Transmission Parameters ....................12
7. Information Communicated by Active Leasequery ..................13
8. Requestor Behavior .............................................14
   8.1. General Processing ........................................14
   8.2. Initiating a Connection ...................................14
   8.3. Forming an Active Leasequery ..............................15
   8.4. Processing Active Replies .................................16
        8.4.1. Processing Replies from a Request Containing an
               OPTION_LQ_START_TIME ...............................18
   8.5. Processing Time Values in Leasequery Messages .............20
   8.6. Examples ..................................................21
        8.6.1. Query Failure ......................................21
        8.6.2. Data Missing on Server .............................21
        8.6.3. Successful Query ...................................21
   8.7. Closing Connections .......................................22
9. Server Behavior ................................................22
   9.1. Accepting Connections .....................................22
   9.2. Rejecting Connections .....................................24
   9.3. Replying to an Active Leasequery ..........................24
   9.4. Multiple or Parallel Queries ..............................26
   9.5. Closing Connections .......................................26
10. Security Considerations .......................................27
11. IANA Considerations ...........................................28
12. References ....................................................28
   12.1. Normative References .....................................28
   12.2. Informative References ...................................29
Acknowledgments ...................................................30
Authors' Addresses ................................................30

1. Introduction โœจ

okay so the DHCPv6 protocol [RFC3315] is the mechanism for handing out IPv6 address and configuration info to IPv6 nodes ๐Ÿงš then IPv6 Prefix Delegation for DHCPv6 [RFC3633] is the mechanism for delegating IPv6 prefixes and related data ๐Ÿ’… DHCPv6 servers keep the authoritative info, including binding info for those delegated prefixes ๐Ÿ“ฆ

there are requirements for external entities to stay up to date on which DHCPv6 clients go with which bindings ๐Ÿ‘€ these entities need to keep up with the server's current binding activity, and that's called "active" leasequery ๐Ÿ”ฅ

DHCPv6 Bulk Leasequery [RFC5460] can pull useful info out of a DHCPv6 server when some external entity starts up ๐ŸŒˆ that entity could be something directly involved in the client-server transactions (like a relay agent), or it could be an external process that needs info from the server's lease state database ๐Ÿซถ

Active Leasequery, the thing this doc is about, is built so an entity that's not directly involved in those client-server transactions can still stay current with the DHCPv6 lease state info in real time โญ

this document updates DHCPv6 Bulk Leasequery [RFC5460] by adding new options, as described in Section 6.2.1 ๐ŸŽ€ for DHCPv6 servers that support Bulk Leasequery but not Active Leasequery, Section 9.2 specifies how to reject incoming Active Leasequery requests ๐Ÿ™…โ€โ™€๏ธ

2. Terminology ๐Ÿ“–

the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119] ๐Ÿซถ

DHCPv6 terminology is defined in [RFC3315] ๐Ÿ’œ the terms specific to DHCPv6 Active Leasequery are below:

  • absolute time ๐Ÿ•ฐ๏ธ A 32-bit unsigned quantity containing the number of seconds since midnight (UTC), January 1, 2000, modulo 2^32.
  • Active Leasequery ๐Ÿฆ‹ Keeping up to date in real time (or near real time) with DHCPv6 binding activity.
  • Bulk Leasequery ๐Ÿ“ฆ Requesting and receiving information about all or some of the existing DHCPv6 binding information in an efficient manner, as defined by [RFC5460].
  • blocked TCP connection ๐Ÿšง A TCP connection is considered blocked if the underlying TCP transport will not accept new messages to be sent without blocking the thread that is attempting to send the message.
  • binding change/update ๐Ÿ”„ Any change in the DHCPv6 binding state. This also includes expiration or deletion of the binding.
  • catch-up information ๐Ÿƒโ€โ™€๏ธ If a DHCPv6 Active Leasequery requestor sends an OPTION_LQ_START_TIME option in an ACTIVELEASEQUERY message, the DHCPv6 server will attempt to send the requestor the information that changed since the time specified in the OPTION_LQ_START_TIME option. The binding information sent to satisfy this request is the catch-up information.
  • catch-up phase โณ The period while catch-up information is being sent is the catch-up phase.
  • clock skew โฑ๏ธ The difference between the absolute time on a DHCPv6 server and the absolute time on the system where a requestor of an Active or Bulk Leasequery is executing is termed the "clock skew" for that Active or Bulk Leasequery connection. It is not absolutely constant but is likely to vary only slowly. While it is easy to think that this can be calculated precisely after one message is received by a requestor from a DHCPv6 server, a more accurate value is derived from continuously examining the instantaneous value developed from each message received from a DHCPv6 server and using it to make small adjustments to the existing value held in the requestor.
  • DHCPv6 binding state ๐Ÿ—‚๏ธ Data stored on the DHCPv6 server related to binding.
  • requestor ๐Ÿ™‹โ€โ™€๏ธ The node that sends LEASEQUERY messages to one or more servers to retrieve information on the bindings for a client.
  • transaction-id ๐Ÿ”– An opaque value used to match responses with queries initiated by an Active Leasequery requestor.

3. Protocol Overview โœจ

okay so Active Leasequery is basically built on top of the DHCPv6 Bulk Leasequery [RFC5460] ๐Ÿ’… most of the differences come from the fact that the TCP [RFC7414] connection stays open for a long time ๐Ÿฆ‹ A DHCPv6 server that supports Active Leasequery MUST support Bulk Leasequery [RFC5460] as well ๐Ÿซถ

The requestor opens a TCP connection to a DHCPv6 server on port 547, the DHCPv6 port ๐ŸŒธ That means the Leasequery requestor needs the server's IP address(es) from configuration or some other means, and it needs unicast IP reachability to the DHCPv6 server. No relaying for Active Leasequery is specified, so don't go looking for it ๐Ÿ™ˆ

Once the connection is up, the requestor sends an ACTIVELEASEQUERY message over it. The server responds by sending updates back using LEASEQUERY-REPLY and LEASEQUERY-DATA messages. This is similar to the response procedure in [RFC5460], except the server sends updates whenever some activity changes a binding's state, which is exactly why the connection has to be long-lived โญ Also, the Active Leasequery server SHOULD provide a mechanism to control which data is allowed to be included in the OPTION_CLIENT_DATA messages sent to the requestor. See Section 9.3 for the details ๐ŸŽ€

Active Leasequery has features that let this external entity lose its connection, reconnect, and get the latest information about any IPv6 bindings that changed while it was disconnected. Iconic behavior, honestly ๐Ÿ‘‘

These features exist so the Active Leasequery requestor can get current with the lease state database quickly after it restarts or after the machine it runs on gets reinitialized ๐Ÿ”ฅ Sure, it's easy to define a protocol that works when the requestor is always connected to the DHCPv6 server. But that's not robust enough for real life, so a lot of this document is about handling the situations where the requestor gets disconnected from the DHCPv6 server it's receiving updates from and then reconnects to that same server ๐Ÿ’œ

The central idea here: if the Active Leasequery requestor loses service, it can specify the time of its most recent update in a later Active Leasequery request. The DHCPv6 server then figures out whether any data was missed while the requestor was disconnected ๐Ÿงš

The DHCPv6 server processing the Active Leasequery request MAY limit the amount of data it saves. There are methods the server can use to tell the Active Leasequery requestor that data was missed, meaning not all of the data could be saved. In that case, the Active Leasequery requestor should issue a Bulk Leasequery [RFC5460] to recover the information that isn't available through an Active Leasequery ๐Ÿ˜ญ

DHCPv6 servers are not required to keep any data for changes missed on an Active Leasequery connection. They will typically choose to keep data about some recent activity available for later queries from a DHCPv6 Active Leasequery requestor whose connection was temporarily interrupted. In other words, DHCPv6 servers that support catch-up are required to have some mechanism to keep or save historic information about bindings ๐Ÿ“

An Active Leasequery requestor would typically use Bulk Leasequery to initialize its database with all current data when that database has no binding information. It would also use Bulk Leasequery to recover missed information if its connection with the DHCPv6 server was lost for longer than the DHCPv6 server keeps track of the specific changes to the IPv6 binding information ๐ŸŒˆ

The messages the server sends in response to an Active Leasequery request should be identical to the messages it sends to a Bulk Leasequery request, in terms of how the data is encoded into the Active Leasequery responses. Likewise, the actions the requestor takes to interpret Active Leasequery responses should be identical to how it interprets Bulk Leasequery responses. So the handling of OPTION_CLIENT_DATA and the additional options discussed in the Bulk Leasequery specification [RFC5460] is followed when implementing Active Leasequery, with one exception: a server responding to an Active Leasequery request SHOULD be able to be configured to prevent specific data items from being included in the OPTION_CLIENT_DATA option, even if they were requested through the OPTION_ORO option ๐Ÿ’–

4. Interaction between Active Leasequery and Bulk Leasequery ๐Ÿงšโ€โ™€๏ธ

Active Leasequery is an extension of the Bulk Leasequery protocol [RFC5460], so the format of the messages returned to an Active Leasequery requestor is identical to what's defined for Bulk Leasequery [RFC5460] ๐Ÿซถ

Applications that use Active Leasequery to keep a database up to date with the DHCPv6 server's lease state database should first use an initial Bulk Leasequery to bring their database into equivalence with the server's. After that, they use Active Leasequery to keep that database current with the server's lease state database ๐Ÿ”ฅ

The two protocols do differ in a few ways. Active Leasequery defines a new message, ACTIVELEASEQUERY, for sending Active Leasequery requests to the DHCPv6 server. An Active Leasequery connection sends all available updates to the requestor, based on the OPTION_LQ_QUERY option (see Section 6.2.1) ๐Ÿ’…

An Active Leasequery connection never really "completes" ๐Ÿ™ˆ The DHCPv6 server can still close the connection, though, for a variety of reasons tied to some sort of exception condition ๐Ÿ’€

5. Extension to DHCPv6 Bulk Leasequery ๐ŸŒธ

This document extends the DHCPv6 Bulk Leasequery protocol [RFC5460] by defining new options: OPTION_LQ_BASE_TIME, OPTION_LQ_START_TIME, and OPTION_LQ_END_TIME ๐ŸŽ€ The DHCPv6 server sends the OPTION_LQ_BASE_TIME option in a Bulk Leasequery response if the requestor asked for it in the Bulk Leasequery request. OPTION_LQ_START_TIME and OPTION_LQ_END_TIME can be used in a Bulk Leasequery request sent to the DHCPv6 server. You can find more details about these options in Section 6.3 โœจ

6. Message and Option Definitions ๐Ÿ‘‘

6.1. Message Framing for TCP

Since TCP lets one or more DHCPv6 messages be sent in response to a single Active Leasequery request, the receiver needs to be able to tell how large each message is ๐Ÿฆ‹ The same message framing technique used for DHCPv6 Bulk Leasequery [RFC5460] is used for Active Leasequery too.

The whole point of using the same format is that code which already knows how to handle a message returned from DHCPv6 Bulk Leasequery [RFC5460] will also be able to handle the message held inside the TCP framing ๐Ÿซถ

When using Transport Layer Security (TLS), once TLS negotiation completes, the connection is encrypted and protected from eavesdropping. Normal Active Leasequery messages are then sent and received using the TLS application data protocol services (see Section 10 of [RFC5246]) ๐Ÿ”๐Ÿ’–

6.2. Messages

6.2.1. ACTIVELEASEQUERY

The new ACTIVELEASEQUERY message type is designed to keep the requestor up to date in real time, or near real time, with DHCPv6 bindings ๐Ÿ”ฅ It asks the server to return DHCPv6 binding activity that occurs after the Active Leasequery request is received.

An ACTIVELEASEQUERY request MUST contain a transaction-id, and that transaction-id MUST be locally unique on the TCP connection on which it is sent to the DHCPv6 server ๐Ÿ’…

When sending an ACTIVELEASEQUERY request, the requestor MAY include the OPTION_LQ_START_TIME option. If it does, the DHCPv6 server returns all the bindings changed on or after the OPTION_LQ_START_TIME ๐Ÿงš

If the requestor wants every binding update from the DHCPv6 server, it MUST NOT include the OPTION_LQ_QUERY option in the ACTIVELEASEQUERY message. But if the requestor only cares about specific binding updates, it MAY include an OPTION_LQ_QUERY option along with a query-type defined in [RFC5007] and [RFC5460] ๐ŸŒˆ

Other DHCPv6 options used in the LEASEQUERY message (as specified in [RFC5460]) can also be used in the ACTIVELEASEQUERY message โœจ

6.2.2. STARTTLS

The new STARTTLS message type is designed for establishing a TLS connection between a requestor and a DHCPv6 server ๐Ÿ” The STARTTLS message SHOULD be sent without any options. Any options received in a STARTTLS message SHOULD be ignored ๐Ÿ™ˆ

More details about this message are in Section 8.2 ๐ŸŽ€

6.2.3. Response Messages

The LEASEQUERY-REPLY message is defined in [RFC5007]. The LEASEQUERY-DATA and LEASEQUERY-DONE messages are defined in [RFC5460] ๐Ÿ“

In an Active Leasequery exchange, a single LEASEQUERY-REPLY message indicates whether a query succeeded or failed. It also carries data that doesn't change within the context of a single query and answer, like the Server-ID and Client-ID options ๐Ÿ’œ If a query is successful, the DHCPv6 server MUST respond to it with exactly one LEASEQUERY-REPLY message. If the server is returning binding data, that LEASEQUERY-REPLY also contains the first client's binding data in an OPTION_CLIENT_DATA option. Additional binding data is returned in LEASEQUERY-DATA messages, as explained in DHCPv6 Bulk Leasequery [RFC5460] ๐Ÿฆ‹ If a query fails, a single LEASEQUERY-REPLY message is returned without any binding data ๐Ÿ˜ญ

6.3. Options

The new options (OPTION_LQ_BASE_TIME, OPTION_LQ_START_TIME, and OPTION_LQ_END_TIME) are defined as an extension to DHCPv6 Bulk Leasequery [RFC5460]. The reply messages for Active Leasequery use these options along with the options defined in [RFC3315], [RFC5007], and [RFC5460] ๐Ÿ’–

6.3.1. OPTION_LQ_BASE_TIME

The OPTION_LQ_BASE_TIME option is the current time at which the message was created to be sent by the DHCPv6 server to the requestor of the Active or Bulk Leasequery, if the requestor asked for it in an Active or Bulk Leasequery request. This MUST be an absolute time, meaning seconds since midnight January 1, 2000 UTC ๐Ÿ•ฐ๏ธโœจ All of the other time-based options in the reply message are relative to this time, including OPTION_CLT_TIME [RFC5007]. This time is in the context of the DHCPv6 server that placed this option in a message ๐ŸŒธ

This is an unsigned integer in network byte order ๐Ÿ”ข

The code for this option is 100 ๐ŸŽ€

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      OPTION_LQ_BASE_TIME      |          option-len           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                           base-time                           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

     option-code       OPTION_LQ_BASE_TIME (100)
     option-len        4
     base-time         DHCPv6 Server Base Time

6.3.2. OPTION_LQ_START_TIME โœจ

okay so OPTION_LQ_START_TIME is how you tell the DHCPv6 server "hey, only send me the bindings that changed on or after this moment" ๐Ÿ•ฐ๏ธโœจ it's giving catch-up energy. This option MAY be used in Active or Bulk Leasequery requests made to a DHCPv6 server ๐Ÿ’–

the requestor MUST figure out the OPTION_LQ_START_TIME using lease information it has already received from the DHCPv6 server ๐Ÿง  and it MUST be an absolute time in the DHCPv6 server's context (see Section 8.5). no relative times, bestie ๐Ÿ™…โ€โ™€๏ธ

typically (though this is not a requirement) the OPTION_LQ_START_TIME will hold the value most recently received in an OPTION_LQ_BASE_TIME option by the requestor ๐ŸŽ€ because that value shows the last successful communication with the DHCPv6 server. so it's basically the receipt for your last good chat ๐Ÿ’…

this is an unsigned integer in network byte order ๐Ÿ”ข

the code for this option is 101 ๐Ÿฆ‹

       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |      OPTION_LQ_START_TIME     |          option-len           |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                       query-start-time                        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

        option-code       OPTION_LQ_START_TIME (101)
        option-len        4
        query-start-time  DHCPv6 Server Query Start Time

6.3.3. OPTION_LQ_END_TIME ๐ŸŒ™

the OPTION_LQ_END_TIME option is the flip side ๐Ÿ’œ it tells the DHCPv6 server "and only send me bindings that changed on or before this time." it MAY be used in a Bulk Leasequery request, but it MUST NOT be used in an Active Leasequery request ๐Ÿ™…โ€โ™€๏ธ so keep it out of your live Active chats, okay?

the requestor MUST determine the OPTION_LQ_END_TIME based on lease information it has received from the DHCPv6 server ๐Ÿ“‹ and this MUST be an absolute time in the context of the DHCPv6 server โฐ

in the absence of information to the contrary, the requestor SHOULD assume that the time context of the DHCPv6 server is identical to the time context of the requestor (see Section 8.5) ๐Ÿ• so unless you've been told otherwise, assume you're both on the same clock ๐Ÿซถ

this is an unsigned integer in network byte order ๐Ÿ”ข

the code for this option is 102 ๐ŸŒธ

       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |      OPTION_LQ_END_TIME       |          option-len           |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                        query-end-time                         |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

        option-code       OPTION_LQ_END_TIME (102)
        option-len        4
        query-end-time    DHCPv6 Server Query End Time

6.4. Connection and Transmission Parameters ๐Ÿ”Œ

Active Leasequery uses the same port configuration as DHCPv6 Bulk Leasequery [RFC5460] ๐ŸŽ€ it also uses the other transmission parameters (BULK_LQ_DATA_TIMEOUT and BULK_LQ_MAX_CONNS) as defined in [RFC5460]. so the setup is shared, bestie ๐Ÿซถ

this section has a table of values that control Active Leasequery behavior, including recommended defaults ๐Ÿ“Š implementations MAY make these values configurable ๐Ÿ› ๏ธ but heads up: configuring timeout values that are too small may lead to harmful behavior, both to this application and to other traffic on the network ๐Ÿ˜ฌ so timeout values smaller than the default values SHOULD NOT be used ๐Ÿ™…โ€โ™€๏ธ

   +------------------------+----------+-------------------------------+
   | Parameter              | Default  | Description                   |
   +------------------------+----------+-------------------------------+
   | ACTIVE_LQ_RCV_TIMEOUT  | 120 secs | Active Leasequery receive     |
   |                        |          | timeout                       |
   | ACTIVE_LQ_SEND_TIMEOUT | 120 secs | Active Leasequery send        |
   |                        |          | timeout                       |
   | ACTIVE_LQ_IDLE_TIMEOUT | 60 secs  | Active Leasequery idle        |
   |                        |          | timeout                       |
   +------------------------+----------+-------------------------------+

7. Information Communicated by Active Leasequery ๐Ÿ“ก

while Bulk Leasequery [RFC5460] info comes straight from the DHCPv6 server's lease state database ๐Ÿ—„๏ธ the info from an Active Leasequery is real-time ๐Ÿ”ด it's whatever is currently associated with a particular binding in that database right now โœจ

this matters a LOT ๐Ÿ˜ญ if your Active Leasequery requestor runs slowly, or it disconnects and then reconnects with an OPTION_LQ_START_TIME option (signaling a catch-up operation), you only get the most current info from the lease state database. the old stuff is gone, periodt ๐Ÿ’€

the requestor of an Active Leasequery MUST NOT assume that every lease state change is communicated across an Active Leasequery connection ๐Ÿšซ even if the requestor stays connected, the DHCPv6 server is only required to transmit information about a binding that is current when the message is created and handed off to the TCP stack to send to the requestor ๐Ÿ“ฎ

if the TCP connection blocks and the DHCPv6 server is waiting to send information down the connection, then when the connection becomes available to be written, the DHCPv6 server MAY create the message to send at this time ๐Ÿงƒ the current state of the binding gets sent, and any transition in state or other info that happened while the TCP connection was blocked will be lost ๐Ÿ˜ญ

so the Active Leasequery protocol does NOT let the requestor build a complete history of every activity on every lease ๐Ÿ“š but you can make an effective history of the important state changes if the DHCPv6 server's parameters are tuned for the needs of an Active Leasequery requestor ๐Ÿ› ๏ธ for instance, the period after the expiration or release of a binding could be configured long enough (say several minutes, well more than the receive timeout) so that an Active Leasequery requestor is less likely to miss any changes in the binding ๐ŸŒˆ main character energy for the server config, honestly ๐Ÿ‘‘


8. Requestor Behavior ๐Ÿง‘โ€๐Ÿ’ป

8.1. General Processing ๐Ÿšฆ

a requestor attempts to establish a TCP connection to a DHCPv6 server to start an Active Leasequery exchange ๐Ÿ”— if the attempt fails, the requestor MAY retry. retries should not be more frequent than one every ACTIVE_LQ_IDLE_TIMEOUT ๐Ÿ’œ see Section 6.4.

if an Active Leasequery gets terminated early by a LEASEQUERY-DONE with a DHCPv6 status code (carried in an OPTION_STATUS_CODE option) of QueryTerminated, or because the connection it was submitted over fails, the requestor MAY retry the request after creating a new connection ๐Ÿ”„ retries should not be more frequent than one every ACTIVE_LQ_IDLE_TIMEOUT โณ see Section 6.4.

messages from the DHCPv6 server come as multiple responses to a single ACTIVELEASEQUERY message ๐Ÿ“จ so each ACTIVELEASEQUERY request MUST have a transaction-id that's unique on the connection it's sent on ๐Ÿ†” and all the messages that come back as a response to it contain the same transaction-id as the request ๐Ÿซถ

8.2. Initiating a Connection ๐Ÿค

a requestor SHOULD be able to operate in either insecure or secure mode ๐Ÿ” this MAY be a feature that's administratively controlled ๐ŸŽ›๏ธ

when operating in insecure mode, the requestor SHOULD proceed to send an ACTIVELEASEQUERY message after the TCP connection is established ๐Ÿš€

when operating in secure mode, the requestor MUST attempt to negotiate a TLS [RFC5246] connection over the TCP connection ๐Ÿ”’ if that negotiation fails, the requestor MUST close the TCP connection โŒ the recommendations in [RFC7525] SHOULD be followed when negotiating this connection ๐Ÿ“

a requestor asks for a TLS connection by sending the STARTTLS message to the DHCPv6 server as the first message over the TCP connection ๐Ÿ™‹โ€โ™€๏ธ this tells the DHCPv6 server that a TLS connection over this TCP connection is wanted. there are four possibilities after the requestor sends the STARTTLS message:

  1. no response from the DHCPv6 server ๐Ÿฆ—
  2. the DHCPv6 server closes the TCP connection after it receives the STARTTLS message ๐Ÿ’จ
  3. the DHCPv6 server responds with a REPLY [RFC3315] message with a DHCPv6 status code of TLSConnectionRefused ๐Ÿšซ
  4. the DHCPv6 server responds with a REPLY [RFC3315] message without a DHCPv6 status code, indicating success ๐ŸŽ‰

in any of the first three possibilities, the DHCPv6 server can be assumed to not support TLS ๐Ÿฅฒ in this case, the requestor MUST close the TCP connection ๐Ÿ‘‹

in the final possibility, where the DHCPv6 server has responded with a REPLY message without a DHCPv6 status code to the requestor's STARTTLS message, the requestor SHOULD initiate the exchange of messages involved in a TLS handshake [RFC5246] ๐Ÿค during the TLS handshake, the requestor MUST validate the DHCPv6 server's digital certificate ๐Ÿชช no skipping this step, bestie ๐Ÿ™…โ€โ™€๏ธ

if the handshake exchange yields a functioning TLS connection, then the requestor SHOULD transmit an ACTIVELEASEQUERY request over that TLS connection, and use that TLS connection for all further interactions it has with the DHCPv6 server over this TCP connection ๐Ÿ”๐Ÿ’–

if the handshake exchange does NOT yield a functioning TLS connection, then the requestor MUST close the TCP connection ๐Ÿ’”

8.3. Forming an Active Leasequery โœจ

okay so Active Leasequery is basically designed to set up a long-lived connection between the requestor and the DHCPv6 server handling the query ๐Ÿฆ‹ and the server SHOULD send binding info back over that connection with minimal delay once it learns about it ๐Ÿ’…. it can learn about bindings either because it made them itself or because another server told it about one. the way that's giving "stay updated in real time" ๐Ÿ˜ญ

the part that's lowkey iconic is that the requestor can ask for some recent data to be sent right away, at the same time as the ongoing binding info is streaming in more or less in real time ๐Ÿ”ฅ. this is how an Active Leasequery requestor catches up on anything it missed if it temporarily loses connectivity with the DHCPv6 server that handled its previous Active Leasequery. main character recovery arc ๐ŸŒธ

this works because each Leasequery reply sent as the result of a previous Active Leasequery comes with an OPTION_LQ_BASE_TIME option ๐Ÿงš. the requestor SHOULD keep track of the highest base-time it got from a particular DHCPv6 server over an Active Leasequery connection ๐Ÿ’œ. then, if it ever needs to reestablish an Active Leasequery connection to that server (for whatever reason ๐Ÿ™ˆ), it SHOULD put that highest base-time value into an OPTION_LQ_START_TIME option in the new Active Leasequery request โœจ.

Heads up, bestie: until ALL of the recent data (the catch-up data) has been received, the requestor MUST NOT keep track of the base-time (OPTION_LQ_BASE_TIME) from Leasequery reply messages to use later in a subsequent Active Leasequery request. no shortcuts, periodt ๐Ÿ’€

if the requestor doesn't want to ask for the stuff it missed while it wasn't connected, then it SHOULD NOT include the OPTION_LQ_START_TIME option in the Active Leasequery request ๐Ÿ“. totally valid choice, no judgment ๐Ÿซถ.

and if the TCP connection gets blocked or stops being writable while the requestor is sending its query, the requestor SHOULD terminate the connection after BULK_LQ_DATA_TIMEOUT ๐Ÿ˜ญ. the reason this is recommended is so requestors can control how long they're willing to wait before giving up on a connection, no matter what notifications the TCP implementation they're using is sending them ๐Ÿ’…๐ŸŒˆ.


8.4. Processing Active Replies ๐ŸŽ€

the requestor tries to read a LEASEQUERY-REPLY message from the TCP connection ๐Ÿฆ‹. if the stream of replies gets blocked, the requestor SHOULD terminate the connection after ACTIVE_LQ_RCV_TIMEOUT, and it MAY begin retry processing if it's set up to do that ๐Ÿ”ฅ.

the requestor looks at the LEASEQUERY-REPLY message and figures out what to do next ๐Ÿ’…. the message validation rules live in DHCPv6 Leasequery [RFC5007] and DHCPv6 Bulk Leasequery [RFC5460] ๐Ÿ“š. if the reply has a DHCPv6 status code (carried in an OPTION_STATUS_CODE option), the requestor should follow the recommendations in [RFC5007] ๐Ÿงš.

okay, real talk: a connection from accepting an Active Leasequery request can be long-lived and might not have data flowing the whole time ๐ŸŒธ. so the DHCPv6 server SHOULD send a LEASEQUERY-DATA message without binding data (OPTION_CLIENT_DATA) every ACTIVE_LQ_IDLE_TIMEOUT seconds (default 60) ๐Ÿ’–. this lets the requestor know the connection is still alive ๐Ÿซถ. it only does this when the connection is idle, meaning the server has no binding data to send โœจ. during a normal exchange of binding data, getting a LEASEQUERY-DATA message already tells the requestor the connection is active ๐ŸŽ€.

the default for ACTIVE_LQ_RCV_TIMEOUT is 120 seconds, which is twice the default of 60 seconds for ACTIVE_LQ_IDLE_TIMEOUT, the value that drives the DHCPv6 server to send messages ๐Ÿ‘‘. so ACTIVE_LQ_RCV_TIMEOUT controls how sensitive the requestor is to delays from the DHCPv6 server when it's sending updates or LEASEQUERY-DATA messages ๐Ÿฅน. the vibe is "how patient am I being" ๐Ÿ™ˆ.

one ACTIVELEASEQUERY can, and usually will, result in a whole bunch of replies ๐Ÿ’…. the requestor MUST be prepared to receive more than one reply with transaction-ids matching a single ACTIVELEASEQUERY message from a single DHCPv6 server ๐ŸŒˆ. be ready for the flood, bestie ๐Ÿซถ.

an Active Leasequery has two regimes: the catch-up phase (if there is one) and everything after it ๐Ÿฆ‹. if the Active Leasequery was requested with an OPTION_LQ_START_TIME option, it starts out in the catch-up phase โœจ. check out Section 8.4.1 for how to process things during catch-up and how to tell when it's done ๐Ÿ“š.

here's the tea โ˜•: the updates the DHCPv6 server sends during the catch-up phase are NOT in the order the lease state data was updated ๐Ÿ˜ญ. so the OPTION_LQ_BASE_TIME option from messages during this phase MUST NOT be saved and used to compute the next ACTIVELEASEQUERY message's OPTION_LQ_START_TIME option ๐Ÿ’€.

after the catch-up phase, or during the whole series of messages from an Active Leasequery request with no OPTION_LQ_START_TIME (so no catch-up phase at all), the OPTION_LQ_BASE_TIME option of the most recent message SHOULD be saved ๐Ÿ’œ. it works as a record of the most recent time data was received ๐Ÿงš. that base-time (in the context of the DHCPv6 server) can then go into a later Active Leasequery message's OPTION_LQ_START_TIME after the Active Leasequery connection drops ๐Ÿ”ฅ.

the LEASEQUERY-DONE message MAY unilaterally end a successful Active Leasequery request that's still in progress, in case the DHCPv6 server decides it can't keep processing the request ๐Ÿ™ˆ. for example, when a server is asked to shut down, it SHOULD send a LEASEQUERY-DONE message with a DHCPv6 status code of QueryTerminated and include the OPTION_LQ_BASE_TIME option in it ๐Ÿ“. this MUST be the last message on that connection, and once it's been sent, the server MUST close the connection ๐Ÿ˜ญ๐Ÿ’….

after getting LEASEQUERY-DONE with a QueryTerminated status from a server, the requestor MAY close the TCP connection to that server ๐ŸŒธโœจ

8.4.1. Processing Replies from a Request Containing an OPTION_LQ_START_TIME โœจ

okay so if the Active Leasequery came with an OPTION_LQ_START_TIME option, the DHCPv6 server is going to try to send info about every binding that changed since that time ๐Ÿ•ฐ๏ธ this is the catch-up phase, and it's giving "let me get you up to speed bestie" ๐Ÿ’– The server MAY also slip real-time binding updates into that same connection ๐Ÿฆ‹ so the catch-up phase can run in parallel with the normal updates the Active Leasequery request makes. multitasking ๐Ÿ’…

A DHCPv6 server MAY only keep a limited amount of time-ordered info around to answer an Active Leasequery request with an OPTION_LQ_START_TIME option ๐Ÿ™ˆ so the time in that option could be a time the server has no time-ordered info for. when there isn't enough saved data to satisfy the OPTION_LQ_START_TIME request, the server replies right away with a LEASEQUERY-REPLY message that has a DHCPv6 status code of DataMissing and a base-time option set to the server's current time ๐Ÿ’€ that's the end of the catch-up phase, and the only updates you'll get on this connection from here on are the real-time ones from the Active Leasequery request. the end of an era ๐Ÿ˜ญ

if there IS enough saved data, then LEASEQUERY-REPLY (with an OPTION_STATUS_CODE of Success, or a reply without the OPTION_STATUS_CODE option at all) and LEASEQUERY-DATA messages start rolling in ๐ŸŒธ some of those are part of the OPTION_LQ_START_TIME catch-up, and some are real-time updates of binding changes happening on the server. the tea is that in general there's no way to tell which is which ๐Ÿต

the catch-up updates do NOT come in the order the binding data was updated ๐Ÿ™ƒ so until the catch-up phase is done, the requestor can't reset its latest base-time value from the incoming messages (to use in a later Active Leasequery's query-start-time option) ๐Ÿšซ why? because doing that would wreck the ability to recover lost info if the Active Leasequery ended before catch-up finished. super important, don't skip this ๐Ÿซถ

the requestor will know catch-up is complete when the server sends a LEASEQUERY-DATA message with the DHCPv6 status code of CatchUpComplete (or a LEASEQUERY-REPLY message with a status code of DataMissing, like we talked about above) ๐ŸŽ‰ once that's sent, every additional LEASEQUERY-DATA message is about real-time ("new") binding changes on the server. we're in the new era now ๐Ÿ‘‘

Heads up: the requestor SHOULD keep track of the latest base-time option value it received over a particular connection, so it can use it in a later Active Leasequery request, but only once the catch-up phase is complete. ๐Ÿ”ฅ

Before catch-up is complete, if the connection goes away, or the requestor gets a LEASEQUERY-DONE message, then when it reconnects it MUST use the base-time value from the previous connection, NOT any base-time value from the connection that just closed ๐Ÿ™…โ€โ™€๏ธ no cap, this is a big deal. don't let the new connection's base-time sneak in early ๐Ÿ’…

there's also a case where the server had enough data to START satisfying the OPTION_LQ_START_TIME request, but then partway through it realized it couldn't keep going (the aging algorithm kicks in during transmission and makes [some of] the saved data unavailable) ๐Ÿ˜ฑ so the server ends the catch-up phase right then by sending a LEASEQUERY-DATA message with a DHCPv6 status code of DataMissing and a base-time option set to the current time. plot twist, but it's still a clean ending ๐ŸŽฌ

now the vibes check ๐Ÿชž the requestor MUST NOT assume that every single state change of every binding between the OPTION_LQ_START_TIME time and now is replicated in an Active Leasequery reply message. the requestor MAY assume that at least one Active Leasequery reply message exists for every binding that had one or more state changes during the period from OPTION_LQ_START_TIME to the current time. the LAST message for each binding has the state as of right now, and there can be one or more messages about a single binding during catch-up. so it's like, you get the latest outfit, not every single outfit change ๐Ÿ‘—โœจ

bindings can change multiple times while the requestor isn't connected (aka from the OPTION_LQ_START_TIME time until now) ๐Ÿ”„ the requestor will only get info about the binding's CURRENT state, not every state change that happened in that window. we stan a summary, but it's not the full diary ๐Ÿ“–

if the requestor gets a LEASEQUERY-REPLY or LEASEQUERY-DATA message with a DataMissing status code AND it wants its database to stay up to date with the bindings on the server, then it SHOULD issue a Bulk Leasequery request to recover the info that's missing ๐Ÿงฉ that Bulk Leasequery request SHOULD include an OPTION_LQ_START_TIME option with the SAME value as the OPTION_LQ_START_TIME option from the earlier Active Leasequery responses, and an OPTION_LQ_END_TIME option equal to the OPTION_LQ_BASE_TIME option the server returned in that DataMissing message ๐Ÿ“… basically you fill in the gap with a Bulk query, bestie ๐Ÿงš

typically, the requestor has one connection open to the DHCPv6 server for the Active Leasequery request, and maybe one more connection open for a Bulk Leasequery request to the same server to fill in whatever data might have been missed before the Active Leasequery started ๐ŸŒˆ the Bulk Leasequery connection usually runs to completion and then closes, leaving ONE Active Leasequery connection open to a single DHCPv6 server. team Active Leasequery forever ๐Ÿ’œ


8.5. Processing Time Values in Leasequery Messages ๐Ÿ•ฐ๏ธ

okay time zones but make it networking ๐ŸŒ Active or Bulk Leasequery requests can go to a DHCPv6 server whose absolute time isn't synced with the requestor's local time. so even the simplest Active or Bulk Leasequery response has at least TWO time contexts ๐Ÿ‘ฏโ€โ™€๏ธ

if the requestor is saving the returned data in some form, it has to store a bunch of time values ๐Ÿ’พ some are in the context of the requestor, and some are in the context of the DHCPv6 server. keeping them straight is a whole vibe ๐ŸŽ€

when the requestor gets an Active or Bulk Leasequery reply message from the DHCPv6 server, that message will contain an OPTION_LQ_BASE_TIME option ๐Ÿ“ the time in that option is in the context of the DHCPv6 server. so it's the perfect time to save and reuse as input in the OPTION_LQ_START_TIME or OPTION_LQ_END_TIME options, if the requestor ever needs to send an Active or Bulk Leasequery later with those options. these options need a time in the server's context, so yes, that's why it's perfect ๐Ÿ’…

on top of saving OPTION_LQ_BASE_TIME for future use in OPTION_LQ_START_TIME or OPTION_LQ_END_TIME, the OPTION_LQ_BASE_TIME option is also used to convert the other times in the Leasequery message into values that make sense in the requestor's context ๐Ÿ” it's the bridge between the two clocks, iykyk ๐ŸŒ‰

in systems whose clocks are synchronized (maybe using the Network Time Protocol (NTP)), the clock skew will usually be zero ๐Ÿฅฐ which is not only acceptable, it's DESIRED. the dream is zero skew, babe โœจ


8.6. Examples ๐Ÿง

these examples show what a series of queries and responses might look like ๐Ÿ“ธ they're only examples, though, so there's no requirement that these sequences must be followed ๐Ÿ™ƒ you do you, within the spec ๐Ÿ’–

8.6.1. Query Failure ๐Ÿšซ

this example shows the message flow when the DHCPv6 server figures out it can't accept and/or process an Active Leasequery request from the requestor ๐Ÿ˜ฌ that could happen for a bunch of reasons (aka UnknownQueryType, MalformedQuery, NotConfigured, NotAllowed, and NotSupported).

      Client                          Server
      ------                          ------
      ACTIVELEASEQUERY xid 1  ----->
                              <-----  LEASEQUERY-REPLY xid 1 (w/error)

8.6.2. Data Missing on Server ๐Ÿซฅ

this example shows the message flow when the DHCPv6 server realizes it doesn't have enough saved data to satisfy the request specified by the OPTION_LQ_START_TIME option ๐Ÿ•ณ๏ธ

here, the server replies right away with a LEASEQUERY-REPLY message with a DHCPv6 status code of DataMissing and a base-time option set to the server's current time. this signals the end of the catch-up phase, and the only updates you'll get on this connection are the real-time updates from the Active Leasequery request ๐Ÿ”š

      Client                          Server
      ------                          ------
      ACTIVELEASEQUERY xid 2  ----->
                              <-----  LEASEQUERY-REPLY xid 2 (w/error)
                              <-----  LEASEQUERY-DATA xid 2
                              <-----  LEASEQUERY-DATA xid 2
                              <-----  LEASEQUERY-DATA xid 2

8.6.3. Successful Query ๐ŸŽ‰

this example shows the message flow when the DHCPv6 server processes the query successfully ๐Ÿฅณ

here, the server replies immediately with a LEASEQUERY-REPLY message (with an OPTION_STATUS_CODE of Success, or a reply without the OPTION_STATUS_CODE option), followed by binding data in LEASEQUERY-DATA messages. if the server wants to abort an in-process request and close the connection for some reason, it sends LEASEQUERY-DONE with an error code in the OPTION_STATUS_CODE option ๐Ÿ›‘

      Client                          Server
      ------                          ------
      ACTIVELEASEQUERY xid 3  ----->
                              <-----  LEASEQUERY-REPLY xid 3
                              <-----  LEASEQUERY-DATA xid 3
                              <-----  LEASEQUERY-DATA xid 3
                              <-----  LEASEQUERY-DATA xid 3
                              <-----  LEASEQUERY-DATA xid 3
                              <-----  LEASEQUERY-DONE xid 3 (w/error)

8.7. Closing Connections ๐Ÿ‘‹

the requestor or DHCPv6 Leasequery server MAY close its end of the TCP connection at any time ๐Ÿ”Œ the requestor MAY choose to keep the connection open if it plans to issue more queries. BUT (and this is important) keeping it open does NOT guarantee the connection will still be available for more queries, because the server might decide to close it based on its own configuration ๐Ÿซ  so don't get too attached to the connection, babe ๐Ÿ’”


9. Server Behavior ๐Ÿ–ฅ๏ธ

a DHCPv6 server that supports Active Leasequery MUST support DHCPv6 Bulk Leasequery [RFC5460] along with the updates mentioned in this document ๐Ÿฆ‹ the server's got homework, and it's giving full support energy ๐Ÿ‘‘

9.1. Accepting Connections โœจ

okay so DHCPv6 servers that do Active Leasequery ๐ŸŽ€ are listening for incoming TCP connections ๐Ÿฆ‹. Accepting the requestor's connection works the same way as in DHCPv6 Bulk Leasequery [RFC5460], with one big twist: Active Leasequery MUST NOT be enabled by default ๐Ÿ™…โ€โ™€๏ธ, and it MUST need an explicit configuration step before it will work at all ๐Ÿ’….

DHCPv6 servers SHOULD be able to run in either insecure or secure mode ๐Ÿ”. This MAY be a mode the admin controls, where the server will require a TLS connection to work, or will only work without one ๐ŸŒธ. Either way, insecure mode MUST NOT be the default, even if secure mode isn't supported ๐Ÿ˜ญ. And insecure mode MUST always need its own explicit configuration step, separate from the one that turns on Active Leasequery support ๐Ÿซถ.

When the server is in insecure mode, it just waits for the requestor to send the Active Leasequery request once the TCP connection is up ๐Ÿงš. If it gets a STARTTLS message, it MUST respond with a REPLY [RFC3315] message carrying a DHCPv6 status code of TLSConnectionRefused ๐Ÿ’€.

When the server is in secure mode, DHCPv6 servers MUST support TLS [RFC5246] to protect the integrity and privacy of the data sent over the TCP connection ๐Ÿ”’. In secure mode, DHCPv6 servers MUST also be configurable about which requestors they'll talk to ๐Ÿ‘‘. The certificate a requestor shows when starting the TLS connection is how the server tells acceptable requestors from unacceptable ones ๐Ÿชช.

In secure mode, the DHCPv6 server MUST begin negotiating a TLS connection with any requestor who asks for one ๐Ÿค, and MUST close the TCP connections that aren't secured with TLS, or where the requestor's certificate is deemed unacceptable ๐Ÿšซ. When negotiating the TLS connection, the recommendations in [RFC7525] SHOULD be followed ๐Ÿ“.

A requestor asks for a TLS connection by sending a STARTTLS as the very first message over a brand-new TCP connection ๐ŸŒˆ. If the DHCPv6 server supports TLS connections and hasn't been configured to refuse them on this link, it MUST answer that STARTTLS by sending a REPLY [RFC3315] message with no DHCPv6 status code back to the requestor โœจ. That's the server's way of saying "yep, I'll do TLS over this same TCP connection" ๐Ÿ’–.

If for some reason the DHCPv6 server can't support a TLS connection, or it's been configured not to, then it SHOULD send a REPLY message with a DHCPv6 status code of TLSConnectionRefused back to the requestor ๐Ÿ™ˆ.

If the DHCPv6 server sends a REPLY message with no DHCPv6 status code option included (which means success ๐ŸŽ‰), the requestor is supposed to start a TLS handshake [RFC5246] (see Section 8.2) ๐Ÿค. During the TLS handshake, the DHCPv6 server MUST validate the requestor's digital certificate ๐Ÿ”. On top of that, the requestor's certificate is what decides whether this requestor is allowed to do an Active Leasequery ๐Ÿ›‚. If that certificate is deemed unacceptable, the server MUST abort creating the TLS connection ๐Ÿ›‘.

All TLS connections set up between a requestor and a DHCPv6 server for Active Leasequery purposes MUST be mutually authenticated ๐Ÿซ‚.

If the TLS handshake doesn't succeed in creating a TLS connection, the server MUST close the TCP connection ๐Ÿšช.


9.2. Rejecting Connections ๐Ÿ™…โ€โ™€๏ธ

Servers that don't implement DHCPv6 Active or Bulk Leasequery SHOULD NOT listen for incoming TCP connections for these requests ๐Ÿซ .

If a DHCPv6 server supports Bulk Leasequery but not Active Leasequery and gets an Active Leasequery request, it SHOULD send a LEASEQUERY-REPLY with a DHCPv6 status code of NotSupported ๐Ÿ˜ค. It SHOULD close the TCP connection after signaling this error ๐Ÿ‘‹.


9.3. Replying to an Active Leasequery ๐Ÿ’Œ

The DHCPv6 Leasequery [RFC5007] specification describes how to initially build LEASEQUERY-REPLY messages ๐Ÿ“–. Using LEASEQUERY-REPLY and LEASEQUERY-DATA messages to carry multiple bindings is described in DHCPv6 Bulk Leasequery [RFC5460] ๐Ÿงฉ. Message transmission and framing for TCP is described in Section 6.1 ๐Ÿ›ค๏ธ.

If the connection gets blocked while the server is trying to send reply messages, the server SHOULD terminate the TCP connection after ACTIVE_LQ_SEND_TIMEOUT โฐ. This timeout is how long the DHCPv6 server is willing to wait for the requestor to read and process enough information to unblock the TCP connection ๐Ÿฅฑ. The default is two minutes ๐Ÿ•‘, which means that if more than two minutes go by without the requestor reading enough to unblock the TCP connection, the DHCPv6 server SHOULD close the TCP connection ๐Ÿ”š.

If the DHCPv6 server hits an error during the initial processing of the ACTIVELEASEQUERY message, it SHOULD send a LEASEQUERY-REPLY message containing some kind of error code in a DHCPv6 status code option ๐Ÿšจ. It SHOULD close the connection after signaling this error ๐Ÿซก.

If the DHCPv6 server hits an error during later processing of the ACTIVELEASEQUERY message, it SHOULD send a LEASEQUERY-DONE containing some kind of error code in a DHCPv6 status code option ๐Ÿ˜ฌ. It SHOULD close the connection after signaling this error ๐Ÿ’….

If the server finds any bindings that satisfy a query, it SHOULD send each binding's data in a reply message ๐Ÿ“ฆ. The first reply message is a LEASEQUERY-REPLY ๐Ÿฅ‡. The binding data is carried in an OPTION_CLIENT_DATA option, as specified in [RFC5007] ๐ŸŽ. The server SHOULD send subsequent bindings in LEASEQUERY-DATA messages, which can avoid redundant data (like the requestor's Client-ID) ๐Ÿง .

Every reply to an Active Leasequery request MUST contain the information specified in replies to a DHCPv6 Bulk Leasequery request [RFC5460] ๐Ÿ“‹. The exception is that a server implementing Active Leasequery SHOULD be able to be configured to stop specific data items from being sent to the requestor, even if those data items were asked for in the OPTION_ORO option ๐Ÿ™ˆ๐Ÿ”’.

Some servers can be set up to respond to a DHCPv6 Leasequery [RFC5007] and a DHCPv6 Bulk Leasequery [RFC5460] for an IPv6 binding that's reserved in such a way that it looks like the IPv6 binding is leased to the DHCP client it's reserved for ๐Ÿ‘€. These servers SHOULD also respond to an Active Leasequery request with the same information they'd give for a Bulk Leasequery request once they first figure out that the IPv6 binding is reserved to a DHCP client ๐Ÿงƒ.

If an Active Leasequery or Bulk Leasequery request includes the OPTION_LQ_BASE_TIME option code in OPTION_ORO, the DHCPv6 server MUST include the OPTION_LQ_BASE_TIME option in every reply to that request โฑ๏ธ. The value for the base-time option is the current absolute time in the DHCPv6 server's context ๐Ÿ•ฐ๏ธ.

If an Active Leasequery request contains an OPTION_LQ_START_TIME option, it means the requestor wants the DHCPv6 server to send it not only the messages about DHCPv6 binding activity that happens after the Active Leasequery request is received, but also the messages about DHCPv6 binding activity that happened before the Active Leasequery request ๐Ÿ•ฐ๏ธโœจ.

If the OPTION_LQ_END_TIME option shows up in an Active Leasequery request, the DHCPv6 server SHOULD send a LEASEQUERY-REPLY message with a DHCPv6 status code of MalformedQuery and terminate the connection ๐Ÿ™…โ€โ™€๏ธ๐Ÿ’ฅ.

To make a meaningful response to this query ๐Ÿง, the DHCPv6 server MAY keep track of binding activity and link changes to particular base-time values from the messages ๐Ÿ“š. Then, when an Active Leasequery request containing an OPTION_LQ_START_TIME option asks for it, the DHCPv6 server can reply with everything about binding activity happening at that OPTION_LQ_START_TIME or later ๐Ÿ—‚๏ธ.

These replies based on OPTION_LQ_START_TIME MAY be interleaved with the messages generated by current binding activity ๐ŸŒ€.

Once the DHCPv6 Leasequery messages tied to the OPTION_LQ_START_TIME option are all sent, a LEASEQUERY-DATA message MUST be sent with a DHCPv6 status code value of CatchUpComplete ๐ŸŽ‰๐Ÿ.

The DHCPv6 server SHOULD, but doesn't have to, keep track of a limited amount of previous binding activity ๐Ÿ—ƒ๏ธ. The DHCPv6 server MAY choose to only do this if it has received at least one Active Leasequery request in the past ๐Ÿ•ต๏ธโ€โ™€๏ธ, since doing it will almost certainly use up some resources that would be wasted if there are no Active Leasequery requestors for this server ๐Ÿ’ธ. The DHCPv6 server SHOULD make the amount of previous binding activity it keeps configurable โš™๏ธ. The server isn't required to keep this info across a server restart (or even to keep it at all) ๐Ÿซฃ.

Unless there's an error, or some reason to stop processing an Active Leasequery request and send a LEASEQUERY-DONE message (like a server shutdown) ๐Ÿ›‘, there won't be a LEASEQUERY-DONE message at the end of Active Leasequery processing ๐Ÿ™ƒ. That's because the processing doesn't really end ๐Ÿ”. It keeps going until either the requestor or the server closes the connection ๐Ÿซถ.


9.4. Multiple or Parallel Queries ๐Ÿ‘ฏโ€โ™€๏ธ

Every Active Leasequery request MUST be made on a single TCP connection where no other request is active at the time the request is made ๐Ÿงต.

Usually, a requestor of an Active Leasequery wouldn't need to send a second Active Leasequery while the first is still active ๐Ÿ™…โ€โ™€๏ธ. However, sending an Active Leasequery and a Bulk Leasequery in parallel would be possible and reasonable ๐Ÿ’œ. For parallel Active and Bulk Leasequeries, the requestor MUST use different TCP connections ๐Ÿ›ฃ๏ธ๐Ÿ›ฃ๏ธ.

This MAY be a feature that the admin controls ๐ŸŽ›๏ธ. Servers that can process queries in parallel SHOULD offer configuration that limits how many simultaneous queries are allowed from any one requestor ๐Ÿšฆ, so resource use stays under control if there are multiple requestors asking for service ๐Ÿ“.


9.5. Closing Connections ๐Ÿ‘‹

The server MUST close its end of the TCP connection if it runs into an error sending data on the connection ๐Ÿ’ฅ. The server MUST close its end of the TCP connection if it finds that it has to abort an in-process request ๐Ÿ›‘. A server aborting an in-process request SHOULD try to tell its requestors about it by using the QueryTerminated status code in the DHCPv6 status code option in a LEASEQUERY-DONE message ๐Ÿ“ฃ. If the server detects that the requestor's end has been closed, the server MUST close its end of the connection ๐Ÿซ—.

The server SHOULD limit the number of connections it maintains, and SHOULD close idle connections to enforce that limit ๐Ÿงนโœจ.

10. Security Considerations ๐Ÿ”โœจ

Okay bestie, this is the dramatic part ๐Ÿ’€. The Security Considerations section of [RFC3315] covers the general threats to DHCPv6, so go read that one too ๐Ÿ“–. The DHCPv6 Leasequery spec [RFC5007] gives recommendations for the Leasequery protocol, especially for relayed Leasequery messages, packet-flooding denial-of-service (DoS) attacks, keeping things restricted to trusted requestors, and using IPsec [RFC4301] ๐Ÿ›ก๏ธ.

Using TCP adds some extra drama ๐Ÿ˜ญ. Attacks that try to drain the DHCPv6 server's TCP connection resources can stop legit requestors from getting service. Malicious requestors can also be sneaky: they open connections and then send invalid queries, partial queries, or no queries at all, which can eat up the server's whole pool of available connections ๐Ÿซ .

When the server runs in secure mode, TLS [RFC5246] is what keeps the connection secure ๐Ÿ”’. The recommendations in [RFC7525] SHOULD be followed when negotiating a TLS connection, so don't skip them ๐Ÿ’….

Servers SHOULD offer configuration parameters that limit where incoming connections can come from, by checking and using the digital certificates presented to set up a TLS connection ๐Ÿชช. They SHOULD also cap how many connections they accept, and cap how long an idle connection is allowed to stay open โณ.

Data you get from an Active Leasequery is open to the same potential abuse as the data on the DHCPv6 server it came from ๐Ÿ‘€. So it SHOULD be secured with mechanisms as strong as the ones protecting that server's data ๐Ÿ”‘. Once you've used it for its purpose, it SHOULD be deleted as soon as possible ๐Ÿ—‘๏ธโœจ.

๐Ÿšซ Heads up: authentication for DHCP messages [RFC3315] MUST NOT be used to try to secure transmission of the messages described in this document. Don't do it, periodt ๐Ÿ’€.

11. IANA Considerations ๐Ÿงš

IANA has assigned new DHCPv6 option codes in the "Option Codes" registry, which lives at <http://www.iana.org/assignments/dhcpv6-parameters>:

  • OPTION_LQ_BASE_TIME (100)
  • OPTION_LQ_START_TIME (101)
  • OPTION_LQ_END_TIME (102)

IANA has also added new values to the DHCPv6 "Status Codes" registry, at the same <http://www.iana.org/assignments/dhcpv6-parameters> address ๐ŸŒธ:

  • DataMissing (12)
  • CatchUpComplete (13)
  • NotSupported (14)
  • TLSConnectionRefused (15)

And finally, IANA assigned values for two new DHCPv6 message types in the "Message Types" registry, same link ๐Ÿฆ‹:

  • ACTIVELEASEQUERY (22)
  • STARTTLS (23)

12. References ๐Ÿ“š

12.1. Normative References

[RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
           Requirement Levels", BCP 14, RFC 2119,
           DOI 10.17487/RFC2119, March 1997,
           <http://www.rfc-editor.org/info/rfc2119>.

[RFC3315]  Droms, R., Ed., Bound, J., Volz, B., Lemon, T., Perkins,
           C., and M. Carney, "Dynamic Host Configuration Protocol
           for IPv6 (DHCPv6)", RFC 3315, DOI 10.17487/RFC3315, July
           2003, <http://www.rfc-editor.org/info/rfc3315>.

[RFC3633]  Troan, O. and R. Droms, "IPv6 Prefix Options for Dynamic
           Host Configuration Protocol (DHCP) version 6", RFC 3633,
           DOI 10.17487/RFC3633, December 2003,
           <http://www.rfc-editor.org/info/rfc3633>.

[RFC5007]  Brzozowski, J., Kinnear, K., Volz, B., and S. Zeng,
           "DHCPv6 Leasequery", RFC 5007, DOI 10.17487/RFC5007,
           September 2007, <http://www.rfc-editor.org/info/rfc5007>.

[RFC5246]  Dierks, T. and E. Rescorla, "The Transport Layer Security
           (TLS) Protocol Version 1.2", RFC 5246,
           DOI 10.17487/RFC5246, August 2008,
           <http://www.rfc-editor.org/info/rfc5246>.

[RFC5460]  Stapp, M., "DHCPv6 Bulk Leasequery", RFC 5460,
           DOI 10.17487/RFC5460, February 2009,
           <http://www.rfc-editor.org/info/rfc5460>.

[RFC7525]  Sheffer, Y., Holz, R., and P. Saint-Andre,
           "Recommendations for Secure Use of Transport Layer
           Security (TLS) and Datagram Transport Layer Security
           (DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525, May
           2015, <http://www.rfc-editor.org/info/rfc7525>.

12.2. Informative References

[RFC4301]  Kent, S. and K. Seo, "Security Architecture for the
           Internet Protocol", RFC 4301, DOI 10.17487/RFC4301,
           December 2005, <http://www.rfc-editor.org/info/rfc4301>.

[RFC7414]  Duke, M., Braden, R., Eddy, W., Blanton, E., and A.
           Zimmermann, "A Roadmap for Transmission Control Protocol
           (TCP) Specification Documents", RFC 7414,
           DOI 10.17487/RFC7414, February 2015,
           <http://www.rfc-editor.org/info/rfc7414>.

Acknowledgments ๐Ÿซถ

Some of the concepts and content in this document are based on DHCPv4 Active Leasequery, which was originally proposed by Kim Kinnear, Bernie Volz, Mark Stapp, and Neil Russell ๐Ÿ’œ.

Useful review comments came from Scott Bradner, Francis Dupont, and Stephen Farrell ๐Ÿ™Œ. The privacy protections got a serious upgrade because of these comments and discussions, so huge thanks to them โœจ.

Authors' Addresses ๐ŸŒˆ

Dushyant Raghuvanshi
Cisco Systems, Inc.
Cessna Business Park
Varthur Hobli, Outer Ring Road
Bangalore, Karnataka  560037
India

Phone: +91 80 4426-7372
Email: draghuva@cisco.com


Kim Kinnear
Cisco Systems, Inc.
1414 Massachusetts Avenue
Boxborough, Massachusetts  01719
United States

Phone: +1 978 936-0000
Email: kkinnear@cisco.com


Deepak Kukrety
Cisco Systems, Inc.
Cessna Business Park
Varthur Hobli, Outer Ring Road
Bangalore, Karnataka  560037
India

Phone: +91 80 4426-7346
Email: dkukrety@cisco.com

That's the whole thing, bestie! ๐ŸŽ€๐Ÿ’– You made it through the entire RFC ๐ŸŒธ๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from