README.md 45.8 KB
Newer Older
zorun's avatar
zorun committed
1
[![CI status](https://code.ffdn.org/zorun/kea-hook-runscript/badges/master/pipeline.svg)](https://code.ffdn.org/zorun/kea-hook-runscript/-/pipelines)
2

3
# About kea-hook-runscript
Baptiste Jonglez's avatar
Baptiste Jonglez committed
4

5
6
This a hook for the Kea DHCP server that allows to run an external script
at various points in the processing of DHCP requests and responses.
Baptiste Jonglez's avatar
Baptiste Jonglez committed
7

8
9
10
11
The goal is to simplify integration with Kea: for many simple use-cases,
it is overkill to have to write a full-blown Kea hook, where a simple shell script
can do the job.

Baptiste Jonglez's avatar
Baptiste Jonglez committed
12
13
This hook is licensed under the Mozilla Public License version 2 (MPL2).

14
15
16
17
18
19
20
21
22
23
## What it can and can't do

Integration is mostly done one-way: thanks to this hook, Kea passes information
to the external script, but the script cannot easily modify Kea's behaviour.

The **external script** can be any kind of executable program, but often it will
be a simple script (shell, Perl, Python...).  Information about what Kea is doing
is provided to the external script through environment variables: MAC address of
the requesting DHCP client, IP address being handed out, etc.

24
25
Each time Kea encounters a hook point, it will (by default) call the script
**synchronously**.
26
27
28
29
30
31
32
That is, Kea will do absolutely nothing else while the script is running.
Thus, it is a good idea to perform only lightweight processing in the script,
and absolutely avoid blocking operations.  Also, scripting languages that need
to initialise a huge interpreter (such as Python or Ruby) will cause a large
amount of CPU usage and a massive slowdown of Kea, because the script is run
multiple times for each DHCP transaction.

33
34
35
If you know what you are doing, you can optionally call the script **asynchronously**
by setting `wait` to `false` (see below).

36
This hook works for both DHCPv4 and DHCPv6, on Kea 1.1 and above.
37
38
39
40
41

In the future, the hook will possibly feed the return code of the external script
back into Kea.  This would allow the external script to cancel part of Kea's normal processing
(for instance, it could be possible to easily implement a flexible host blacklist this way).

Baptiste Jonglez's avatar
Baptiste Jonglez committed
42
43
44
45
46
47
48
49
50
51
52
53
54
## Alternative

Since Kea 1.9.5, a similar hook is provided by ISC: <https://kea.readthedocs.io/en/latest/arm/hooks.html#run-script-support>

It has similar functionalities: information is passed to the script through environment
variables.  However, only **asynchronous** execution is supported in ISC's hook, at
least as of Kea 1.9.5.

Which hook to use is up to you: the ISC one will probably be better maintained when
new versions of Kea come out, while this one supports synchronous execution which is safer.
Also, environment variables are different between the two hooks, which can be an important
factor if you need to process specific sub-options in your script.

55
56
57
58
59
60
61
## Use-cases

Given the limitations exposed above, here are some example use-cases for which
this hook is well-suited:

- add/remove routing entries when DHCP clients arrive or leave.  This can be useful
  when handing out IPv4 addressing in /32 subnets, or IPv6 Prefix Delegation
Baptiste Jonglez's avatar
Baptiste Jonglez committed
62
  with DHCPv6-PD.  An example is included in `examples/slash32_leases/`;
63
64
65
66
67
68
- update firewall rules to allow/refuse access to new DHCP clients;
- log information about successful leases.

For more complex use-cases, including non-trivial changes to Kea's behaviour,
it may be easier to just write a Kea hook yourself.

Baptiste Jonglez's avatar
Baptiste Jonglez committed
69
70
71
72
73
## Examples

If you have more examples of usage, feel free to contribute your Kea
config and your scripts!

74
75
76
77
78
79
80
81
82
83
84
85
### Managing routes for IPv6 delegated prefixes

When delegating IPv6 prefixes with DHCPv6-PD, it is necessary to add the corresponding routes
in the kernel.

This example script adds/removes static IPv6 routes whenever Kea delegates an IPv6 prefix
through DHCPv6-PD or when the lease expires.

See the included [README](examples/ipv6_prefix_delegation/README.md) for more
explanations and the [source](examples/ipv6_prefix_delegation) with the script and
an example Kea configuration.

Baptiste Jonglez's avatar
Baptiste Jonglez committed
86
87
88
89
90
91
92
### Handing out IPv4 addresses in /32 subnets

This example allows to lease IPv4 addresses individually (/32 subnets), by
inserting routes in the kernel each time a DHCP client connects, and
sending custom routes to clients using DHCP option 121.  This is mostly
useful to hand out public IPv4 addresses to customers.

Baptiste Jonglez's avatar
Baptiste Jonglez committed
93
94
95
See the included [README](examples/slash32_leases/README.md) for more
explanations and the [source](examples/slash32_leases) with the script and
an example Kea configuration.
Baptiste Jonglez's avatar
Baptiste Jonglez committed
96
97
98
99
100
101
102
103
104
105
106
107

### Debug script

To experiment, a simple debug script is provided: `examples/debug.sh`.  It
simply prints the name of the hook point and all environment variables
passed to it.

The output of the script is at `/tmp/kea-hook-runscript-debug.log`.  A nice way to debug
is to continously display the content of this file:

    tail -F /tmp/kea-hook-runscript-debug.log

108
109
110
111
112
113
114
115
116
## Pre-built binaries

Since version 1.4.0, we have a CI system to build the hook on various OS and for various
versions of Kea. It's new, so there might be bugs.

The binaries are available from the [release page](https://github.com/zorun/kea-hook-runscript/releases)
or you can directly
[browse through the pipeline results](https://code.ffdn.org/zorun/kea-hook-runscript/-/pipelines).

117
## How to build
118

119
120
If you want to build the hook yourself, you need the Kea libraries as well
as the Kea and Boost development headers.
121

122
123
### Using a packaged version of Kea

124
If you use a Kea package, you need the appropriate development packages:
125

126
127
- boost development files: `libboost-dev` or equivalent
- kea development files: `isc-kea-dev` from cloudsmith (official Kea package)
128

129
130
If you prefer using the Kea package from Debian, install `kea-dev` instead.
However, it is currently unsupported and is only available in sid.
131

132
Then, to build the hook, simply run:
133

134
    $ make -j4
135

136
### Using Kea source
137
138

To build against a local Kea source tree, assumed to be in `~/kea`:
139

140
141
142
- build Kea (`cd ~/kea && make -j`)
- install Kea to a local directory (`cd ~/kea && make install DESTDIR=/tmp/kea`)

Baptiste Jonglez's avatar
Baptiste Jonglez committed
143
144
Then build this hook with:

145
    $ export KEA_INCLUDE=$HOME/kea/src/lib
Baptiste Jonglez's avatar
Baptiste Jonglez committed
146
    $ export KEA_LIB=/tmp/kea/usr/local/lib
147
    $ make
148

149
150
151
152
153
154
155
156
157
### Supported Kea versions

Some notes on Kea versions:

- Kea 1.1 does not install all required headers (most notably `dhcpsrv/`),
  so you may need to build against Kea's source tree.
- Kea 1.2 is missing a header file by mistake, so depending on your
  distribution, you may need to manually copy `option6_pdexclude.h` from
  the Kea git repository to `/usr/include/kea/dhcp/`.
158
159
160
- Kea 1.3 to 1.7 should work out-of-the-box.
- Kea 1.8 needs to run without [multi-threading](https://kea.readthedocs.io/en/kea-1.8.0/arm/dhcp4-srv.html#multi-threading-settings).
  Open a ticket if you need multi-threading support.
161

162
## How to use this hook
163
164
165

If all goes well, you should obtain a `kea-hook-runscript.so` file.
Then, here is how to tell Kea to use this hook, for DHCPv4:
166
167
168
169
170
171
172
173

    {
    "Dhcp4":
    {
      "hooks-libraries": [
        {
          "library": "/path/to/hea-hook-runscript/kea-hook-runscript.so",
          "parameters": {
174
175
            "script": "/path/to/myscript.sh",
            "wait": true
176
177
178
179
180
181
182
          }
        }
      ],
      ...
    }
    }

183
184
185
186
187
The `wait` parameter indicates whether Kea waits for the script to exit.  That is,
if set to `true`, Kea will block while the script is running.
If you need high-performance DHCP, you can set it to `false`, but you must be prepared
to handle several instances of the script running in parallel.

188
189
190
191
You can use the same script for both DHCPv4 and DHCPv6, or use two different scripts.

The script will receive the name of the hook point as first argument, and all
relevant information available at the current hook point will be passed as
Baptiste Jonglez's avatar
Baptiste Jonglez committed
192
environment variables, documented below.
193

Baptiste Jonglez's avatar
Baptiste Jonglez committed
194
195
To debug, see the `examples/debug.sh` script described above.

196
197
198
199
200
Refer to the Kea documentation for more information about each hook point:

- DHCPv4 hooks reference: <https://jenkins.isc.org/job/Kea_doc/doxygen/de/df3/dhcpv4Hooks.html>
- DHCPv6 hooks reference: <https://jenkins.isc.org/job/Kea_doc/doxygen/d1/d02/dhcpv6Hooks.html>

Baptiste Jonglez's avatar
Baptiste Jonglez committed
201
202
203
204
205
206
207
208
209
210
# Frequently Asked Questions

## I get "Operation not permitted" when trying to add route in my script

The script is run with the same user as Kea: if this is not root, then the script will
not have permission to change the routing table.

Either run Kea as root, or use a passwordless sudo configuration, see
[issue 24](https://github.com/zorun/kea-hook-runscript/issues/24).

211
# Reference of variables passed to the external script
212

213
## DHCPv4 variables
214

215
216
217
Here are all possible variables for DHCPv4, with their type, description
and reference of the possible values.  Booleans are simply expressed with
`0` and `1`.
218

219
220
221
222
| Variable name                         | Type     | Description                                                 | Reference                                                                                                                                                       |
|---------------------------------------|----------|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `KEA_QUERY4_TYPE`                     | `string` | Type of DHCP message                                        | [dhcp/dhcp4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/d5/d8c/namespaceisc_1_1dhcp.html#aa5bfdcc4861aa3dab5328dba89362016)                                  |
| `KEA_QUERY4_INTERFACE`                | `string` | Interface on which query was received                       |                                                                                                                                                                 |
223
| `KEA_QUERY4_IFINDEX`                  | `int`    | Index of the interface on which query was received          |                                                                                                                                                                 |
224
225
226
227
228
| `KEA_QUERY4_HWADDR`                   | `string` | Hardware address of the client (its MAC address)            |                                                                                                                                                                 |
| `KEA_QUERY4_HWADDR_TYPE`              | `int`    | Type of hardware address                                    | [dhcp/dhcp4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/d5/d8c/namespaceisc_1_1dhcp.html#addcff933049489d800f9869196c8e46fa96a62c59182d6e06780b0e1ef40da059) |
| `KEA_QUERY4_HWADDR_SOURCE`            | `int`    | How this MAC address was obtained                           | [dhcp/hwaddr.h](https://jenkins.isc.org/job/Kea_doc/doxygen/da/dae/group__hw__sources.html)                                                                     |
| `KEA_QUERY4_RELAYED`                  | `bool`   | Whether query was relayed                                   | [dhcp/pkt4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d13/classisc_1_1dhcp_1_1Pkt4.html#a8468401827b9bacdd3796bb4e20d8e5e)                               |
| `KEA_QUERY4_RELAY_HOPS`               | `int`    | Number of relay agents traversed                            |                                                                                                                                                                 |
Jeff Groom's avatar
Jeff Groom committed
229
| `KEA_QUERY4_OPTION60`                 | `string` | Option 60 - vendor id                                       |                                                                                                                                                                 |
230
231
232
233
| `KEA_QUERY4_CIADDR`                   | `string` | Client IP address                                           | [dhcp/pkt4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d13/classisc_1_1dhcp_1_1Pkt4.html)                                                                 |
| `KEA_QUERY4_SIADDR`                   | `string` | Server IP address                                           | [dhcp/pkt4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d13/classisc_1_1dhcp_1_1Pkt4.html)                                                                 |
| `KEA_QUERY4_YIADDR`                   | `string` | Your IP address                                             | [dhcp/pkt4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d13/classisc_1_1dhcp_1_1Pkt4.html)                                                                 |
| `KEA_QUERY4_GIADDR`                   | `string` | Gateway IP address (inserted by DHCP relay)                 | [dhcp/pkt4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d13/classisc_1_1dhcp_1_1Pkt4.html)                                                                 |
234
235
236
| `KEA_QUERY4_RAI`                      | `string` | Relay Agent Information (RFC 3046) as hex string            |                                                                                                                                                                 |
| `KEA_QUERY4_RAI_CIRCUIT_ID`           | `string` | RAI sub-option 1 Circuit id (RFC 3046) as hex string        |                                                                                                                                                                 |
| `KEA_QUERY4_RAI_REMOTE_ID`            | `string` | RAI sub-option 2 Remote id (RFC 3046) as hex string         |                                                                                                                                                                 |
237
238
| `KEA_RESPONSE4_TYPE`                  | `string` | Type of DHCP message                                        | [dhcp/dhcp4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/d5/d8c/namespaceisc_1_1dhcp.html#aa5bfdcc4861aa3dab5328dba89362016)                                  |
| `KEA_RESPONSE4_INTERFACE`             | `string` | Interface on which response is being sent                   |                                                                                                                                                                 |
239
| `KEA_RESPONSE4_IFINDEX`               | `int`    | Index of the interface on which response is being sent      |                                                                                                                                                                 |
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
| `KEA_RESPONSE4_HWADDR`                | `string` | Hardware address of the client (its MAC address)            |                                                                                                                                                                 |
| `KEA_RESPONSE4_HWADDR_TYPE`           | `int`    | Type of hardware address                                    | [dhcp/dhcp4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/d5/d8c/namespaceisc_1_1dhcp.html#addcff933049489d800f9869196c8e46fa96a62c59182d6e06780b0e1ef40da059) |
| `KEA_RESPONSE4_HWADDR_SOURCE`         | `int`    | How this MAC address was obtained                           | [dhcp/hwaddr.h](https://jenkins.isc.org/job/Kea_doc/doxygen/da/dae/group__hw__sources.html)                                                                     |
| `KEA_RESPONSE4_RELAYED`               | `bool`   | Whether response is relayed                                 | [dhcp/pkt4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d13/classisc_1_1dhcp_1_1Pkt4.html#a8468401827b9bacdd3796bb4e20d8e5e)                               |
| `KEA_RESPONSE4_RELAY_HOPS`            | `int`    | Number of relay agents traversed                            |                                                                                                                                                                 |
| `KEA_RESPONSE4_CIADDR`                | `string` | Client IP address                                           | [dhcp/pkt4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d13/classisc_1_1dhcp_1_1Pkt4.html)                                                                 |
| `KEA_RESPONSE4_SIADDR`                | `string` | Server IP address                                           | [dhcp/pkt4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d13/classisc_1_1dhcp_1_1Pkt4.html)                                                                 |
| `KEA_RESPONSE4_YIADDR`                | `string` | Your IP address                                             | [dhcp/pkt4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d13/classisc_1_1dhcp_1_1Pkt4.html)                                                                 |
| `KEA_RESPONSE4_GIADDR`                | `string` | Gateway IP address                                          | [dhcp/pkt4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d13/classisc_1_1dhcp_1_1Pkt4.html)                                                                 |
| `KEA_SUBNET4_PREFIX`                  | `IPv4`   | IP prefix of the subnet (without prefix length)             |                                                                                                                                                                 |
| `KEA_SUBNET4_PREFIXLEN`               | `int`    | Prefix length of the subnet (`0` to `32`)                   |                                                                                                                                                                 |
| `KEA_SUBNET4`                         | `string` | `KEA_SUBNET4_PREFIX`/`KEA_SUBNET4_PREFIXLEN`                |                                                                                                                                                                 |
| `KEA_LEASE4_ADDRESS`                  | `IPv4`   | IPv4 address leased to client                               |                                                                                                                                                                 |
| `KEA_LEASE4_TYPE`                     | `string` | Type of lease, always equal to "V4"                         |                                                                                                                                                                 |
| `KEA_LEASE4_HWADDR`                   | `string` | Hardware address of the client                              |                                                                                                                                                                 |
| `KEA_LEASE4_HOSTNAME`                 | `string` | Hostname associated to the client                           |                                                                                                                                                                 |
| `KEA_LEASE4_STATE`                    | `string` | Current state of the lease                                  | [dhcpsrv/lease.h](https://jenkins.isc.org/job/Kea_doc/doxygen/d0/dee/structisc_1_1dhcp_1_1Lease.html#a7075e6229e9eadedf27fc9ff49ece3c1)                         |
| `KEA_LEASE4_IS_EXPIRED`               | `bool`   | Whether the lease is expired                                |                                                                                                                                                                 |
| `KEA_LEASE4_CLIENT_LAST_TRANSMISSION` | `int`    | Unix timestamp of the last message received from the client | [dhcpsrv/lease.h](https://jenkins.isc.org/job/Kea_doc/doxygen/d0/dee/structisc_1_1dhcp_1_1Lease.html#ac71dc7f97dd753096a0f448c6649cdcf)                         |
| `KEA_LEASE4_VALID_LIFETIME`           | `int`    | Valid lifetime of the lease, in seconds                     | [dhcpsrv/lease.h](https://jenkins.isc.org/job/Kea_doc/doxygen/d0/dee/structisc_1_1dhcp_1_1Lease.html#a615302a9140991942225b9809ddd50fb)                         |
| `KEA_REMOVE_LEASE`                    | `bool`   | Whether the lease should be removed from the lease database | [DHCPv4 hook API](https://jenkins.isc.org/job/Kea_doc/doxygen/de/df3/dhcpv4Hooks.html#dhcpv4HooksLease4Expire)                                                  |
| `KEA_FAKE_ALLOCATION`                 | `bool`   | Whether the query is a DISCOVER or a REQUEST                | [DHCPv4 hook API](https://jenkins.isc.org/job/Kea_doc/doxygen/de/df3/dhcpv4Hooks.html#dhcpv4HooksLeaseSelect)                                                   |
262
263
264
265
266
267

## DHCPv4 hook points

For each Kea hook point, here are all variables usable in the external
script.

Baptiste Jonglez's avatar
Baptiste Jonglez committed
268
### [`pkt4_receive`](https://jenkins.isc.org/job/Kea_doc/doxygen/de/df3/dhcpv4Hooks.html#dhcpv4HooksPkt4Receive)
269

270
271
- `KEA_QUERY4_TYPE`
- `KEA_QUERY4_INTERFACE`
272
- `KEA_QUERY4_IFINDEX`
273
274
275
276
- `KEA_QUERY4_HWADDR`
- `KEA_QUERY4_HWADDR_SOURCE`
- `KEA_QUERY4_HWADDR_TYPE`
- `KEA_QUERY4_RELAYED`
277
- `KEA_QUERY4_RELAY_HOPS`
Jeff Groom's avatar
Jeff Groom committed
278
- `KEA_QUERY4_OPTION60`
279
280
281
282
- `KEA_QUERY4_CIADDR`
- `KEA_QUERY4_SIADDR`
- `KEA_QUERY4_YIADDR`
- `KEA_QUERY4_GIADDR`
Joost Bekkers's avatar
Joost Bekkers committed
283
284
285
- `KEA_QUERY4_RAI`
- `KEA_QUERY4_RAI_CIRCUIT_ID`
- `KEA_QUERY4_RAI_REMOTE_ID`
286

287
### [`pkt4_send`](https://jenkins.isc.org/job/Kea_doc/doxygen/de/df3/dhcpv4Hooks.html#dhcpv4HooksPkt4Send)
Baptiste Jonglez's avatar
Baptiste Jonglez committed
288

289
290
- `KEA_QUERY4_TYPE`
- `KEA_QUERY4_INTERFACE`
291
- `KEA_QUERY4_IFINDEX`
292
293
294
295
- `KEA_QUERY4_HWADDR`
- `KEA_QUERY4_HWADDR_SOURCE`
- `KEA_QUERY4_HWADDR_TYPE`
- `KEA_QUERY4_RELAYED`
296
- `KEA_QUERY4_RELAY_HOPS`
Jeff Groom's avatar
Jeff Groom committed
297
- `KEA_QUERY4_OPTION60`
298
299
300
301
- `KEA_QUERY4_CIADDR`
- `KEA_QUERY4_SIADDR`
- `KEA_QUERY4_YIADDR`
- `KEA_QUERY4_GIADDR`
Joost Bekkers's avatar
Joost Bekkers committed
302
303
304
- `KEA_QUERY4_RAI`
- `KEA_QUERY4_RAI_CIRCUIT_ID`
- `KEA_QUERY4_RAI_REMOTE_ID`
305
306
- `KEA_RESPONSE4_TYPE`
- `KEA_RESPONSE4_INTERFACE`
307
- `KEA_RESPONSE4_IFINDEX`
308
309
310
311
312
313
314
315
316
- `KEA_RESPONSE4_HWADDR`
- `KEA_RESPONSE4_HWADDR_SOURCE`
- `KEA_RESPONSE4_HWADDR_TYPE`
- `KEA_RESPONSE4_RELAYED`
- `KEA_RESPONSE4_RELAY_HOPS`
- `KEA_RESPONSE4_CIADDR`
- `KEA_RESPONSE4_SIADDR`
- `KEA_RESPONSE4_YIADDR`
- `KEA_RESPONSE4_GIADDR`
Baptiste Jonglez's avatar
Baptiste Jonglez committed
317

318
### [`subnet4_select`](https://jenkins.isc.org/job/Kea_doc/doxygen/de/df3/dhcpv4Hooks.html#dhcpv4HooksSubnet4Select)
Baptiste Jonglez's avatar
Baptiste Jonglez committed
319

320
321
- `KEA_QUERY4_TYPE`
- `KEA_QUERY4_INTERFACE`
322
- `KEA_QUERY4_IFINDEX`
323
324
325
326
- `KEA_QUERY4_HWADDR`
- `KEA_QUERY4_HWADDR_SOURCE`
- `KEA_QUERY4_HWADDR_TYPE`
- `KEA_QUERY4_RELAYED`
327
328
329
330
331
- `KEA_QUERY4_RELAY_HOPS`
- `KEA_QUERY4_CIADDR`
- `KEA_QUERY4_SIADDR`
- `KEA_QUERY4_YIADDR`
- `KEA_QUERY4_GIADDR`
Joost Bekkers's avatar
Joost Bekkers committed
332
333
334
- `KEA_QUERY4_RAI`
- `KEA_QUERY4_RAI_CIRCUIT_ID`
- `KEA_QUERY4_RAI_REMOTE_ID`
335
336
337
- `KEA_SUBNET4_PREFIX`
- `KEA_SUBNET4_PREFIXLEN`
- `KEA_SUBNET4`
Baptiste Jonglez's avatar
Baptiste Jonglez committed
338

339
### [`lease4_select`](https://jenkins.isc.org/job/Kea_doc/doxygen/de/df3/dhcpv4Hooks.html#dhcpv4HooksLease4Select)
Baptiste Jonglez's avatar
Baptiste Jonglez committed
340

341
342
- `KEA_QUERY4_TYPE`
- `KEA_QUERY4_INTERFACE`
343
- `KEA_QUERY4_IFINDEX`
344
345
346
347
- `KEA_QUERY4_HWADDR`
- `KEA_QUERY4_HWADDR_SOURCE`
- `KEA_QUERY4_HWADDR_TYPE`
- `KEA_QUERY4_RELAYED`
348
349
350
351
352
- `KEA_QUERY4_RELAY_HOPS`
- `KEA_QUERY4_CIADDR`
- `KEA_QUERY4_SIADDR`
- `KEA_QUERY4_YIADDR`
- `KEA_QUERY4_GIADDR`
Joost Bekkers's avatar
Joost Bekkers committed
353
354
355
- `KEA_QUERY4_RAI`
- `KEA_QUERY4_RAI_CIRCUIT_ID`
- `KEA_QUERY4_RAI_REMOTE_ID`
356
357
358
359
360
- `KEA_SUBNET4_PREFIX`
- `KEA_SUBNET4_PREFIXLEN`
- `KEA_SUBNET4`
- `KEA_FAKE_ALLOCATION`
- `KEA_LEASE4_ADDRESS`
361
362
363
364
365
366
367
- `KEA_LEASE4_TYPE`
- `KEA_LEASE4_STATE`
- `KEA_LEASE4_IS_EXPIRED`
- `KEA_LEASE4_HWADDR`
- `KEA_LEASE4_HOSTNAME`
- `KEA_LEASE4_CLIENT_LAST_TRANSMISSION`
- `KEA_LEASE4_VALID_LIFETIME`
Baptiste Jonglez's avatar
Baptiste Jonglez committed
368

369
### [`lease4_renew`](https://jenkins.isc.org/job/Kea_doc/doxygen/de/df3/dhcpv4Hooks.html#dhcpv4HooksLease4Renew)
Baptiste Jonglez's avatar
Baptiste Jonglez committed
370

371
372
- `KEA_QUERY4_TYPE`
- `KEA_QUERY4_INTERFACE`
373
- `KEA_QUERY4_IFINDEX`
374
375
376
377
- `KEA_QUERY4_HWADDR`
- `KEA_QUERY4_HWADDR_SOURCE`
- `KEA_QUERY4_HWADDR_TYPE`
- `KEA_QUERY4_RELAYED`
378
379
380
381
382
- `KEA_QUERY4_RELAY_HOPS`
- `KEA_QUERY4_CIADDR`
- `KEA_QUERY4_SIADDR`
- `KEA_QUERY4_YIADDR`
- `KEA_QUERY4_GIADDR`
Joost Bekkers's avatar
Joost Bekkers committed
383
384
385
- `KEA_QUERY4_RAI`
- `KEA_QUERY4_RAI_CIRCUIT_ID`
- `KEA_QUERY4_RAI_REMOTE_ID`
386
387
388
389
- `KEA_SUBNET4_PREFIX`
- `KEA_SUBNET4_PREFIXLEN`
- `KEA_SUBNET4`
- `KEA_LEASE4_ADDRESS`
390
391
392
393
394
395
396
- `KEA_LEASE4_TYPE`
- `KEA_LEASE4_STATE`
- `KEA_LEASE4_IS_EXPIRED`
- `KEA_LEASE4_HWADDR`
- `KEA_LEASE4_HOSTNAME`
- `KEA_LEASE4_CLIENT_LAST_TRANSMISSION`
- `KEA_LEASE4_VALID_LIFETIME`
Baptiste Jonglez's avatar
Baptiste Jonglez committed
397

398
### [`lease4_release`](https://jenkins.isc.org/job/Kea_doc/doxygen/de/df3/dhcpv4Hooks.html#dhcpv4HooksLease4Release)
Baptiste Jonglez's avatar
Baptiste Jonglez committed
399

400
401
- `KEA_QUERY4_TYPE`
- `KEA_QUERY4_INTERFACE`
402
- `KEA_QUERY4_IFINDEX`
403
404
405
406
- `KEA_QUERY4_HWADDR`
- `KEA_QUERY4_HWADDR_SOURCE`
- `KEA_QUERY4_HWADDR_TYPE`
- `KEA_QUERY4_RELAYED`
407
408
409
410
411
- `KEA_QUERY4_RELAY_HOPS`
- `KEA_QUERY4_CIADDR`
- `KEA_QUERY4_SIADDR`
- `KEA_QUERY4_YIADDR`
- `KEA_QUERY4_GIADDR`
Joost Bekkers's avatar
Joost Bekkers committed
412
413
414
- `KEA_QUERY4_RAI`
- `KEA_QUERY4_RAI_CIRCUIT_ID`
- `KEA_QUERY4_RAI_REMOTE_ID`
415
- `KEA_LEASE4_ADDRESS`
416
417
418
419
420
421
422
- `KEA_LEASE4_TYPE`
- `KEA_LEASE4_STATE`
- `KEA_LEASE4_IS_EXPIRED`
- `KEA_LEASE4_HWADDR`
- `KEA_LEASE4_HOSTNAME`
- `KEA_LEASE4_CLIENT_LAST_TRANSMISSION`
- `KEA_LEASE4_VALID_LIFETIME`
Baptiste Jonglez's avatar
Baptiste Jonglez committed
423

424
### [`lease4_decline`](https://jenkins.isc.org/job/Kea_doc/doxygen/de/df3/dhcpv4Hooks.html#dhcpv4HooksLease4Decline)
Baptiste Jonglez's avatar
Baptiste Jonglez committed
425

426
427
- `KEA_QUERY4_TYPE`
- `KEA_QUERY4_INTERFACE`
428
- `KEA_QUERY4_IFINDEX`
429
430
431
432
- `KEA_QUERY4_HWADDR`
- `KEA_QUERY4_HWADDR_SOURCE`
- `KEA_QUERY4_HWADDR_TYPE`
- `KEA_QUERY4_RELAYED`
433
434
435
436
437
- `KEA_QUERY4_RELAY_HOPS`
- `KEA_QUERY4_CIADDR`
- `KEA_QUERY4_SIADDR`
- `KEA_QUERY4_YIADDR`
- `KEA_QUERY4_GIADDR`
Joost Bekkers's avatar
Joost Bekkers committed
438
439
440
- `KEA_QUERY4_RAI`
- `KEA_QUERY4_RAI_CIRCUIT_ID`
- `KEA_QUERY4_RAI_REMOTE_ID`
441
- `KEA_LEASE4_ADDRESS`
442
443
444
445
446
447
448
- `KEA_LEASE4_TYPE`
- `KEA_LEASE4_STATE`
- `KEA_LEASE4_IS_EXPIRED`
- `KEA_LEASE4_HWADDR`
- `KEA_LEASE4_HOSTNAME`
- `KEA_LEASE4_CLIENT_LAST_TRANSMISSION`
- `KEA_LEASE4_VALID_LIFETIME`
Baptiste Jonglez's avatar
Baptiste Jonglez committed
449

450
### [`lease4_expire`](https://jenkins.isc.org/job/Kea_doc/doxygen/de/df3/dhcpv4Hooks.html#dhcpv4HooksLease4Expire)
Baptiste Jonglez's avatar
Baptiste Jonglez committed
451

452
- `KEA_LEASE4_ADDRESS`
453
454
455
456
457
458
459
- `KEA_LEASE4_TYPE`
- `KEA_LEASE4_STATE`
- `KEA_LEASE4_IS_EXPIRED`
- `KEA_LEASE4_HWADDR`
- `KEA_LEASE4_HOSTNAME`
- `KEA_LEASE4_CLIENT_LAST_TRANSMISSION`
- `KEA_LEASE4_VALID_LIFETIME`
460
- `KEA_REMOVE_LEASE`
Baptiste Jonglez's avatar
Baptiste Jonglez committed
461

462
### [`lease4_recover`](https://jenkins.isc.org/job/Kea_doc/doxygen/de/df3/dhcpv4Hooks.html#dhcpv4HooksLease4Recover)
Baptiste Jonglez's avatar
Baptiste Jonglez committed
463

464
- `KEA_LEASE4_ADDRESS`
465
466
467
468
469
470
471
- `KEA_LEASE4_TYPE`
- `KEA_LEASE4_STATE`
- `KEA_LEASE4_IS_EXPIRED`
- `KEA_LEASE4_HWADDR`
- `KEA_LEASE4_HOSTNAME`
- `KEA_LEASE4_CLIENT_LAST_TRANSMISSION`
- `KEA_LEASE4_VALID_LIFETIME`
Baptiste Jonglez's avatar
Baptiste Jonglez committed
472
473


474
475
476
477
478
479
## DHCPv6 variables

Here are all possible variables for DHCPv6, with their type, description
and reference of the possible values.  Booleans are simply expressed with
`0` and `1`.

480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
| Variable name                         | Type     | Description                                                                         | Reference                                                                                                                                |
|---------------------------------------|----------|-------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
| `KEA_QUERY6_TYPE`                     | `string` | Type of DHCPv6 message                                                              | [dhcp/dhcp6.h](https://jenkins.isc.org/job/Kea_doc/doxygen/db/d87/dhcp6_8h_source.html)                                                  |
| `KEA_QUERY6_INTERFACE`                | `string` | Interface on which query was received                                               |                                                                                                                                          |
| `KEA_QUERY6_IFINDEX`                  | `int`    | Index of the interface on which query was received                                  |                                                                                                                                          |
| `KEA_QUERY6_DUID`                     | `string` | TODO                                                                                |                                                                                                                                          |
| `KEA_QUERY6_HWADDR`                   | `string` | Hardware address of the client (its MAC address)                                    |                                                                                                                                          |
| `KEA_QUERY6_HWADDR_TYPE`              | `int`    | Type of hardware address                                                            | [dhcp/dhcp4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/d5/d8c/namespaceisc_1_1dhcp.html#addcff933049489d800f9869196c8e46f)           |
| `KEA_QUERY6_HWADDR_SOURCE`            | `int`    | How this MAC address was obtained                                                   | [dhcp/hwaddr.h](https://jenkins.isc.org/job/Kea_doc/doxygen/da/dae/group__hw__sources.html)                                              |
| `KEA_QUERY6_LOCAL_ADDRESS`            | `string` | Local IPv6 address on which the query was received (link-local or multicast)        | [dhcp/pkt.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d71/classisc_1_1dhcp_1_1Pkt.html#a55b5c3f4cbab0f60968b0498d8543c65)          |
| `KEA_QUERY6_LOCAL_PORT`               | `int`    | Local UDP or TCP port                                                               |                                                                                                                                          |
| `KEA_QUERY6_REMOTE_ADDRESS`           | `string` | Remote IPv6 address, from which the query was received (link-local)                 | [dhcp/pkt.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d71/classisc_1_1dhcp_1_1Pkt.html#a1e20bcdc69d5f97ed8cc48290017b8d9)          |
| `KEA_QUERY6_REMOTE_PORT`              | `int`    | Remote UDP or TCP port                                                              |                                                                                                                                          |
| `KEA_QUERY6_LABEL`                    | `string` | Unique identifier of the query, to be used e.g. in log messages                     | [dhcp/pkt.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d71/classisc_1_1dhcp_1_1Pkt.html#af9888e61c5304f4bac1983a93ac6a473)          |
| `KEA_QUERY6_TRANSACTION_ID`           | `int`    | Transaction ID of the query                                                         | [dhcp/pkt.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d71/classisc_1_1dhcp_1_1Pkt.html#a8cd6c6ab6c434b1bf6949bb1cc4102b1)          |
| `KEA_RESPONSE6_TYPE`                  | `string` | Type of DHCPv6 message                                                              | [dhcp/dhcp6.h](https://jenkins.isc.org/job/Kea_doc/doxygen/db/d87/dhcp6_8h_source.html)                                                  |
| `KEA_RESPONSE6_INTERFACE`             | `string` | Interface on which response is being sent                                           |                                                                                                                                          |
| `KEA_RESPONSE6_IFINDEX`               | `int`    | Index of the interface on which response is being sent                              |                                                                                                                                          |
| `KEA_RESPONSE6_DUID`                  | `string` | TODO                                                                                |                                                                                                                                          |
| `KEA_RESPONSE6_HWADDR`                | `string` | Hardware address of the client (its MAC address)                                    |                                                                                                                                          |
| `KEA_RESPONSE6_HWADDR_TYPE`           | `int`    | Type of hardware address                                                            | [dhcp/dhcp4.h](https://jenkins.isc.org/job/Kea_doc/doxygen/d5/d8c/namespaceisc_1_1dhcp.html#addcff933049489d800f9869196c8e46f)           |
| `KEA_RESPONSE6_HWADDR_SOURCE`         | `int`    | How this MAC address was obtained                                                   | [dhcp/hwaddr.h](https://jenkins.isc.org/job/Kea_doc/doxygen/da/dae/group__hw__sources.html)                                              |
| `KEA_RESPONSE6_LOCAL_ADDRESS`         | `string` | Local IPv6 address, from which the response is being sent (link-local or multicast) | [dhcp/pkt.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d71/classisc_1_1dhcp_1_1Pkt.html#a55b5c3f4cbab0f60968b0498d8543c65)          |
| `KEA_RESPONSE6_LOCAL_PORT`            | `int`    | Local UDP or TCP port                                                               |                                                                                                                                          |
| `KEA_RESPONSE6_REMOTE_ADDRESS`        | `string` | Remote IPv6 address, to which the response is being sent (link-local)               | [dhcp/pkt.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d71/classisc_1_1dhcp_1_1Pkt.html#a1e20bcdc69d5f97ed8cc48290017b8d9)          |
| `KEA_RESPONSE6_REMOTE_PORT`           | `int`    | Remote UDP or TCP port                                                              |                                                                                                                                          |
| `KEA_RESPONSE6_LABEL`                 | `string` | Unique identifier of the response, to be used e.g. in log messages                  | [dhcp/pkt.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d71/classisc_1_1dhcp_1_1Pkt.html#af9888e61c5304f4bac1983a93ac6a473)          |
| `KEA_RESPONSE6_TRANSACTION_ID`        | `int`    | Transaction ID of the response                                                      | [dhcp/pkt.h](https://jenkins.isc.org/job/Kea_doc/doxygen/de/d71/classisc_1_1dhcp_1_1Pkt.html#a8cd6c6ab6c434b1bf6949bb1cc4102b1)          |
| `KEA_SUBNET6_PREFIX`                  | `IPv6`   | IP prefix of the subnet (without prefix length)                                     |                                                                                                                                          |
| `KEA_SUBNET6_PREFIXLEN`               | `int`    | Prefix length of the subnet (`0` to `128`)                                          |                                                                                                                                          |
| `KEA_SUBNET6`                         | `string` | `KEA_SUBNET6_PREFIX`/`KEA_SUBNET6_PREFIXLEN`                                        |                                                                                                                                          |
| `KEA_LEASE6_TYPE`                     | `string` | Type of lease, either "NA", "TA", or "PD"                                           | [dhcp/lease.h](https://jenkins.isc.org/job/Kea_doc/doxygen/d0/dee/structisc_1_1dhcp_1_1Lease.html#a9257a6a410119ea79f29b9d2756c8769)     |
| `KEA_LEASE6_ADDRESS`                  | `IPv6`   | IPv6 address leased to client                                                       |                                                                                                                                          |
| `KEA_LEASE6_DELEGATED_PREFIX`         | `string` | For TYPE="PD", prefix delegated to client (in `prefix/prefixlen` form)              |                                                                                                                                          |
| `KEA_LEASE6_DELEGATED_PREFIXLEN`      | `int`    | For TYPE="PD", length of the prefix delegated to client                             |                                                                                                                                          |
| `KEA_LEASE6_CLIENT_DUID`              | `string` | DUID of the client                                                                  |                                                                                                                                          |
| `KEA_LEASE6_HWADDR`                   | `string` | Hardware address of the client                                                      |                                                                                                                                          |
| `KEA_LEASE6_HOSTNAME`                 | `string` | Hostname associated to the client                                                   |                                                                                                                                          |
| `KEA_LEASE6_STATE`                    | `string` | Current state of the lease                                                          | [dhcpsrv/lease.h](https://jenkins.isc.org/job/Kea_doc/doxygen/d0/dee/structisc_1_1dhcp_1_1Lease.html#a7075e6229e9eadedf27fc9ff49ece3c1)  |
| `KEA_LEASE6_IS_EXPIRED`               | `bool`   | Whether the lease is expired                                                        |                                                                                                                                          |
| `KEA_LEASE6_CLIENT_LAST_TRANSMISSION` | `int`    | Unix timestamp of the last message received from the client                         | [dhcpsrv/lease.h](https://jenkins.isc.org/job/Kea_doc/doxygen/d0/dee/structisc_1_1dhcp_1_1Lease.html#ac71dc7f97dd753096a0f448c6649cdcf)  |
| `KEA_LEASE6_VALID_LIFETIME`           | `int`    | Valid lifetime of the lease, in seconds                                             | [dhcpsrv/lease.h](https://jenkins.isc.org/job/Kea_doc/doxygen/d0/dee/structisc_1_1dhcp_1_1Lease.html#a615302a9140991942225b9809ddd50fb)  |
| `KEA_LEASE6_PREFERRED_LIFETIME`       | `int`    | Preferred lifetime of the lease, in seconds                                         | [dhcpsrv/lease.h](https://jenkins.isc.org/job/Kea_doc/doxygen/da/ddc/structisc_1_1dhcp_1_1Lease6.html#acece7ab17d67a657637cf16a9a2f1f6e) |
| `KEA_LEASE6_IAID`                     | `string` | Identity Association Identifier, to differentiate between IA containers             | [dhcpsrv/lease.h](https://jenkins.isc.org/job/Kea_doc/doxygen/da/ddc/structisc_1_1dhcp_1_1Lease6.html#acc2e175c33e09dbdc8c93b943488431e) |
| `KEA_REMOVE_LEASE`                    | `bool`   | Whether the lease should be removed from the lease database                         | [DHCPv6 hook API](https://jenkins.isc.org/job/Kea_doc/doxygen/d1/d02/dhcpv6Hooks.html#dhcpv6HooksLease6Expire)                           |
| `KEA_FAKE_ALLOCATION`                 | `bool`   | Whether the query is a SOLICIT or a REQUEST                                         | [DHCPv6 hook API](https://jenkins.isc.org/job/Kea_doc/doxygen/d1/d02/dhcpv6Hooks.html#dhcpv6HooksLease6Select)                           |
526
527
528
529
530
531
532
533

## DHCPv6 hook points

For each Kea hook point, here are all variables usable in the external
script.

### [`pkt6_receive`](https://jenkins.isc.org/job/Kea_doc/doxygen/d1/d02/dhcpv6Hooks.html#dhcpv6HooksPkt6Receive)

534
535
- `KEA_QUERY6_TYPE`
- `KEA_QUERY6_INTERFACE`
536
- `KEA_QUERY6_IFINDEX`
537
538
- `KEA_QUERY6_DUID`
- `KEA_QUERY6_HWADDR`
539
540
541
542
543
544
545
546
- `KEA_QUERY6_HWADDR_TYPE`
- `KEA_QUERY6_HWADDR_SOURCE`
- `KEA_QUERY6_LOCAL_ADDRESS`
- `KEA_QUERY6_LOCAL_PORT`
- `KEA_QUERY6_REMOTE_ADDRESS`
- `KEA_QUERY6_REMOTE_PORT`
- `KEA_QUERY6_LABEL`
- `KEA_QUERY6_TRANSACTION_ID`
547
548
549

### [`pkt6_send`](https://jenkins.isc.org/job/Kea_doc/doxygen/d1/d02/dhcpv6Hooks.html#dhcpv6HooksPkt6Send)

550
551
- `KEA_QUERY6_TYPE`
- `KEA_QUERY6_INTERFACE`
552
- `KEA_QUERY6_IFINDEX`
553
554
- `KEA_QUERY6_DUID`
- `KEA_QUERY6_HWADDR`
555
556
557
558
559
560
561
562
- `KEA_QUERY6_HWADDR_TYPE`
- `KEA_QUERY6_HWADDR_SOURCE`
- `KEA_QUERY6_LOCAL_ADDRESS`
- `KEA_QUERY6_LOCAL_PORT`
- `KEA_QUERY6_REMOTE_ADDRESS`
- `KEA_QUERY6_REMOTE_PORT`
- `KEA_QUERY6_LABEL`
- `KEA_QUERY6_TRANSACTION_ID`
563
564
- `KEA_RESPONSE6_TYPE`
- `KEA_RESPONSE6_INTERFACE`
565
566
567
568
569
570
571
572
573
574
575
- `KEA_RESPONSE6_IFINDEX`
- `KEA_RESPONSE6_DUID`
- `KEA_RESPONSE6_HWADDR`
- `KEA_RESPONSE6_HWADDR_TYPE`
- `KEA_RESPONSE6_HWADDR_SOURCE`
- `KEA_RESPONSE6_LOCAL_ADDRESS`
- `KEA_RESPONSE6_LOCAL_PORT`
- `KEA_RESPONSE6_REMOTE_ADDRESS`
- `KEA_RESPONSE6_REMOTE_PORT`
- `KEA_RESPONSE6_LABEL`
- `KEA_RESPONSE6_TRANSACTION_ID`
576
577
578

### [`subnet6_select`](https://jenkins.isc.org/job/Kea_doc/doxygen/d1/d02/dhcpv6Hooks.html#dhcpv6HooksSubnet6Select)

579
580
- `KEA_QUERY6_TYPE`
- `KEA_QUERY6_INTERFACE`
581
- `KEA_QUERY6_IFINDEX`
582
583
- `KEA_QUERY6_DUID`
- `KEA_QUERY6_HWADDR`
584
585
586
587
588
589
590
591
- `KEA_QUERY6_HWADDR_TYPE`
- `KEA_QUERY6_HWADDR_SOURCE`
- `KEA_QUERY6_LOCAL_ADDRESS`
- `KEA_QUERY6_LOCAL_PORT`
- `KEA_QUERY6_REMOTE_ADDRESS`
- `KEA_QUERY6_REMOTE_PORT`
- `KEA_QUERY6_LABEL`
- `KEA_QUERY6_TRANSACTION_ID`
592
593
594
- `KEA_SUBNET6_PREFIX`
- `KEA_SUBNET6_PREFIXLEN`
- `KEA_SUBNET6`
595
596
597

### [`lease6_select`](https://jenkins.isc.org/job/Kea_doc/doxygen/d1/d02/dhcpv6Hooks.html#dhcpv6HooksLease6Select)

598
599
- `KEA_QUERY6_TYPE`
- `KEA_QUERY6_INTERFACE`
600
- `KEA_QUERY6_IFINDEX`
601
602
- `KEA_QUERY6_DUID`
- `KEA_QUERY6_HWADDR`
603
604
605
606
607
608
609
610
- `KEA_QUERY6_HWADDR_TYPE`
- `KEA_QUERY6_HWADDR_SOURCE`
- `KEA_QUERY6_LOCAL_ADDRESS`
- `KEA_QUERY6_LOCAL_PORT`
- `KEA_QUERY6_REMOTE_ADDRESS`
- `KEA_QUERY6_REMOTE_PORT`
- `KEA_QUERY6_LABEL`
- `KEA_QUERY6_TRANSACTION_ID`
611
612
613
614
- `KEA_SUBNET6_PREFIX`
- `KEA_SUBNET6_PREFIXLEN`
- `KEA_SUBNET6`
- `KEA_FAKE_ALLOCATION`
615
- `KEA_LEASE6_TYPE`
616
- `KEA_LEASE6_ADDRESS`
617
618
619
620
621
622
623
624
625
626
627
- `KEA_LEASE6_DELEGATED_PREFIX`
- `KEA_LEASE6_DELEGATED_PREFIXLEN`
- `KEA_LEASE6_CLIENT_DUID`
- `KEA_LEASE6_HWADDR`
- `KEA_LEASE6_HOSTNAME`
- `KEA_LEASE6_STATE`
- `KEA_LEASE6_IS_EXPIRED`
- `KEA_LEASE6_CLIENT_LAST_TRANSMISSION`
- `KEA_LEASE6_VALID_LIFETIME`
- `KEA_LEASE6_PREFERRED_LIFETIME`
- `KEA_LEASE6_IAID`
628
629
630

### [`lease6_renew`](https://jenkins.isc.org/job/Kea_doc/doxygen/d1/d02/dhcpv6Hooks.html#dhcpv6HooksLease6Renew)

631
632
- `KEA_QUERY6_TYPE`
- `KEA_QUERY6_INTERFACE`
633
- `KEA_QUERY6_IFINDEX`
634
635
- `KEA_QUERY6_DUID`
- `KEA_QUERY6_HWADDR`
636
637
638
639
640
641
642
643
644
- `KEA_QUERY6_HWADDR_TYPE`
- `KEA_QUERY6_HWADDR_SOURCE`
- `KEA_QUERY6_LOCAL_ADDRESS`
- `KEA_QUERY6_LOCAL_PORT`
- `KEA_QUERY6_REMOTE_ADDRESS`
- `KEA_QUERY6_REMOTE_PORT`
- `KEA_QUERY6_LABEL`
- `KEA_QUERY6_TRANSACTION_ID`
- `KEA_LEASE6_TYPE`
645
- `KEA_LEASE6_ADDRESS`
646
647
648
649
650
651
652
653
654
655
656
- `KEA_LEASE6_DELEGATED_PREFIX`
- `KEA_LEASE6_DELEGATED_PREFIXLEN`
- `KEA_LEASE6_CLIENT_DUID`
- `KEA_LEASE6_HWADDR`
- `KEA_LEASE6_HOSTNAME`
- `KEA_LEASE6_STATE`
- `KEA_LEASE6_IS_EXPIRED`
- `KEA_LEASE6_CLIENT_LAST_TRANSMISSION`
- `KEA_LEASE6_VALID_LIFETIME`
- `KEA_LEASE6_PREFERRED_LIFETIME`
- `KEA_LEASE6_IAID`
657
658
659

### [`lease6_rebind`](https://jenkins.isc.org/job/Kea_doc/doxygen/d1/d02/dhcpv6Hooks.html#dhcpv6HooksLease6Rebind)

660
661
- `KEA_QUERY6_TYPE`
- `KEA_QUERY6_INTERFACE`
662
- `KEA_QUERY6_IFINDEX`
663
664
- `KEA_QUERY6_DUID`
- `KEA_QUERY6_HWADDR`
665
666
667
668
669
670
671
672
673
- `KEA_QUERY6_HWADDR_TYPE`
- `KEA_QUERY6_HWADDR_SOURCE`
- `KEA_QUERY6_LOCAL_ADDRESS`
- `KEA_QUERY6_LOCAL_PORT`
- `KEA_QUERY6_REMOTE_ADDRESS`
- `KEA_QUERY6_REMOTE_PORT`
- `KEA_QUERY6_LABEL`
- `KEA_QUERY6_TRANSACTION_ID`
- `KEA_LEASE6_TYPE`
674
- `KEA_LEASE6_ADDRESS`
675
676
677
678
679
680
681
682
683
684
685
- `KEA_LEASE6_DELEGATED_PREFIX`
- `KEA_LEASE6_DELEGATED_PREFIXLEN`
- `KEA_LEASE6_CLIENT_DUID`
- `KEA_LEASE6_HWADDR`
- `KEA_LEASE6_HOSTNAME`
- `KEA_LEASE6_STATE`
- `KEA_LEASE6_IS_EXPIRED`
- `KEA_LEASE6_CLIENT_LAST_TRANSMISSION`
- `KEA_LEASE6_VALID_LIFETIME`
- `KEA_LEASE6_PREFERRED_LIFETIME`
- `KEA_LEASE6_IAID`
686
687
688

### [`lease6_decline`](https://jenkins.isc.org/job/Kea_doc/doxygen/d1/d02/dhcpv6Hooks.html#dhcpv6HooksLease6Decline)

689
690
691
692
- `KEA_QUERY6_TYPE`
- `KEA_QUERY6_INTERFACE`
- `KEA_QUERY6_DUID`
- `KEA_QUERY6_HWADDR`
693
694
695
696
697
698
699
700
701
- `KEA_QUERY6_HWADDR_TYPE`
- `KEA_QUERY6_HWADDR_SOURCE`
- `KEA_QUERY6_LOCAL_ADDRESS`
- `KEA_QUERY6_LOCAL_PORT`
- `KEA_QUERY6_REMOTE_ADDRESS`
- `KEA_QUERY6_REMOTE_PORT`
- `KEA_QUERY6_LABEL`
- `KEA_QUERY6_TRANSACTION_ID`
- `KEA_LEASE6_TYPE`
702
- `KEA_LEASE6_ADDRESS`
703
704
705
706
707
708
709
710
711
712
713
- `KEA_LEASE6_DELEGATED_PREFIX`
- `KEA_LEASE6_DELEGATED_PREFIXLEN`
- `KEA_LEASE6_CLIENT_DUID`
- `KEA_LEASE6_HWADDR`
- `KEA_LEASE6_HOSTNAME`
- `KEA_LEASE6_STATE`
- `KEA_LEASE6_IS_EXPIRED`
- `KEA_LEASE6_CLIENT_LAST_TRANSMISSION`
- `KEA_LEASE6_VALID_LIFETIME`
- `KEA_LEASE6_PREFERRED_LIFETIME`
- `KEA_LEASE6_IAID`
714
715
716

### [`lease6_release`](https://jenkins.isc.org/job/Kea_doc/doxygen/d1/d02/dhcpv6Hooks.html#dhcpv6HooksLease6Release)

717
718
- `KEA_QUERY6_TYPE`
- `KEA_QUERY6_INTERFACE`
719
- `KEA_QUERY6_IFINDEX`
720
721
- `KEA_QUERY6_DUID`
- `KEA_QUERY6_HWADDR`
722
723
724
725
726
727
728
729
730
- `KEA_QUERY6_HWADDR_TYPE`
- `KEA_QUERY6_HWADDR_SOURCE`
- `KEA_QUERY6_LOCAL_ADDRESS`
- `KEA_QUERY6_LOCAL_PORT`
- `KEA_QUERY6_REMOTE_ADDRESS`
- `KEA_QUERY6_REMOTE_PORT`
- `KEA_QUERY6_LABEL`
- `KEA_QUERY6_TRANSACTION_ID`
- `KEA_LEASE6_TYPE`
731
- `KEA_LEASE6_ADDRESS`
732
733
734
735
736
737
738
739
740
741
742
- `KEA_LEASE6_DELEGATED_PREFIX`
- `KEA_LEASE6_DELEGATED_PREFIXLEN`
- `KEA_LEASE6_CLIENT_DUID`
- `KEA_LEASE6_HWADDR`
- `KEA_LEASE6_HOSTNAME`
- `KEA_LEASE6_STATE`
- `KEA_LEASE6_IS_EXPIRED`
- `KEA_LEASE6_CLIENT_LAST_TRANSMISSION`
- `KEA_LEASE6_VALID_LIFETIME`
- `KEA_LEASE6_PREFERRED_LIFETIME`
- `KEA_LEASE6_IAID`
743
744
745

### [`lease6_expire`](https://jenkins.isc.org/job/Kea_doc/doxygen/d1/d02/dhcpv6Hooks.html#dhcpv6HooksLease6Expire)

746
- `KEA_LEASE6_TYPE`
747
- `KEA_LEASE6_ADDRESS`
748
749
750
751
752
753
754
755
756
757
758
- `KEA_LEASE6_DELEGATED_PREFIX`
- `KEA_LEASE6_DELEGATED_PREFIXLEN`
- `KEA_LEASE6_CLIENT_DUID`
- `KEA_LEASE6_HWADDR`
- `KEA_LEASE6_HOSTNAME`
- `KEA_LEASE6_STATE`
- `KEA_LEASE6_IS_EXPIRED`
- `KEA_LEASE6_CLIENT_LAST_TRANSMISSION`
- `KEA_LEASE6_VALID_LIFETIME`
- `KEA_LEASE6_PREFERRED_LIFETIME`
- `KEA_LEASE6_IAID`
759
- `KEA_REMOVE_LEASE`
760
761
762

### [`lease6_recover`](https://jenkins.isc.org/job/Kea_doc/doxygen/d1/d02/dhcpv6Hooks.html#dhcpv6HooksLease6Recover)

763
- `KEA_LEASE6_TYPE`
764
- `KEA_LEASE6_ADDRESS`
765
766
767
768
769
770
771
772
773
774
775
- `KEA_LEASE6_DELEGATED_PREFIX`
- `KEA_LEASE6_DELEGATED_PREFIXLEN`
- `KEA_LEASE6_CLIENT_DUID`
- `KEA_LEASE6_HWADDR`
- `KEA_LEASE6_HOSTNAME`
- `KEA_LEASE6_STATE`
- `KEA_LEASE6_IS_EXPIRED`
- `KEA_LEASE6_CLIENT_LAST_TRANSMISSION`
- `KEA_LEASE6_VALID_LIFETIME`
- `KEA_LEASE6_PREFERRED_LIFETIME`
- `KEA_LEASE6_IAID`
776
777


778
779
# TODO

Baptiste Jonglez's avatar
Baptiste Jonglez committed
780
- take stdout/stderr of script and turn it into proper Kea logs
Baptiste Jonglez's avatar
Baptiste Jonglez committed
781
782
- agree on a consistent terminology:
  - should a "prefix" variable contain the prefixlen (2001:db8::/48) or just the base address (2001:db8::)?
783
- also call the script at load/unload
Baptiste Jonglez's avatar
Baptiste Jonglez committed
784
- figure out how to call several scripts (loading the hook multiple times doesn't seem to work)
Baptiste Jonglez's avatar
Baptiste Jonglez committed
785
786
- allow to configure which hook points will trigger the script
- take into account the return code of the script to set the status
787
  of the callout (this should be configurable to avoid surprises...).
Baptiste Jonglez's avatar
Baptiste Jonglez committed
788
789
790
791
792
793
794
795

Some bugs to investigate/fix in Kea:

- `lease6_select` is called twice (once with `IA_NA` and once with `IA_PD`), but
  other functions (`lease6_renew`, `lease6_release`, `lease6_expire`) are only
  called with `IA_PD`.
- when an address reservation is changed for a given client, `lease6_expire` is never
  called for the old address.