Kea issueshttps://gitlab.isc.org/isc-projects/kea/-/issues2023-07-17T13:58:20Zhttps://gitlab.isc.org/isc-projects/kea/-/issues/2931Host commands fetching hosts by IP address from the backends return partial data2023-07-17T13:58:20ZMarcin SiodelskiHost commands fetching hosts by IP address from the backends return partial dataSuppose you have a host reservation that includes IPv6 addresses, prefixes and DHCP options. Now, if you send a command to fetch the host reservation by one of the IPv6 addresses, you'll get the host reservation with this IPv6 address (l...Suppose you have a host reservation that includes IPv6 addresses, prefixes and DHCP options. Now, if you send a command to fetch the host reservation by one of the IPv6 addresses, you'll get the host reservation with this IPv6 address (lacking other IPv6 addresses), without the prefixes and probably with only one of the options.
The reason for it is the invalid query that performs a simple inner join and filters by the IPv6 address. The other addresses and prefixes are ignored (filtered out) because they don't match the specified address. It seems that the correct query should run a sub-query selecting the host-id and then the main query that filters the host by this id.
The original issue was described here: https://gitlab.isc.org/isc-projects/kea/-/issues/2881#note_380311kea2.4.0Marcin SiodelskiMarcin Siodelskihttps://gitlab.isc.org/isc-projects/kea/-/issues/2901operation-target should have different values2023-07-17T13:58:20ZWlodzimierz Wenceloperation-target should have different valuesA the moment new parameter `operation-target` in host commands have values:
```
primary - query the primary source - JSON configuration.
alternate - query the alternate source - hosts database(s).
all - query both sources - JSON configu...A the moment new parameter `operation-target` in host commands have values:
```
primary - query the primary source - JSON configuration.
alternate - query the alternate source - hosts database(s).
all - query both sources - JSON configuration and host database(s).
default - query the default source - it's command specific.
```
While situation when someone will use both database and file is rare (in my opinion, I don't have data) and current values of `operation-target` are intuitive for ppl that knows internals of how reservation works. I propose to change those values to something like:
```
memory (not json, because it's not saved) - query the primary source - JSON configuration.
database - query the alternate source - hosts database(s).
all - query both sources - JSON configuration and host database(s).
default - query the default source - it's command specific.
```
or something that would be easier to understand for anyone.kea2.4.0Marcin SiodelskiMarcin Siodelskihttps://gitlab.isc.org/isc-projects/kea/-/issues/2815reservation-del for reservations from JSON config2023-07-17T13:58:21ZSlawek Figielreservation-del for reservations from JSON configTo implement Config Backend Migration #1623, the possibility of deleting host reservations from the JSON configuration is needed.
The reservations will be first inserted into the database and, after that, deleted from the config file.
Un...To implement Config Backend Migration #1623, the possibility of deleting host reservations from the JSON configuration is needed.
The reservations will be first inserted into the database and, after that, deleted from the config file.
Unfortunately, the hosts_cmds hook doesn't have any capabilities to manage the reservations from the configuration file. It supports only database entries.kea2.3.8Slawek FigielSlawek Figielhttps://gitlab.isc.org/isc-projects/kea/-/issues/2795Unable to retrieve multiple host reservations for the same IP with reservatio...2023-07-17T13:58:20ZDarren AnkneyUnable to retrieve multiple host reservations for the same IP with reservation-getAttempting to retrieve multiple host reservations for the same IP address with `reservation-get` fails with this error:
```
{
"result": 1,
"text": "multiple records were found in the database where only one was expected for query SEL...Attempting to retrieve multiple host reservations for the same IP address with `reservation-get` fails with this error:
```
{
"result": 1,
"text": "multiple records were found in the database where only one was expected for query SELECT h.host_id, h.dhcp_identifier, h.dhcp_identifier_type, h.dhcp4_subnet_id, h.dhcp6_subnet_id, h.ipv4_address, h.hostname, h.dhcp4_client_classes, h.dhcp6_client_classes, h.user_context, h.dhcp4_next_server, h.dhcp4_server_hostname, h.dhcp4_boot_file_name, h.auth_key, o.option_id, o.code, o.value, o.formatted_value, o.space, o.persistent, o.user_context FROM hosts AS h LEFT JOIN dhcp4_options AS o ON h.host_id = o.host_id WHERE h.dhcp4_subnet_id = ? AND h.ipv4_address = ? ORDER BY h.host_id, o.option_id"
}
```
To recreate, Consider this simple Kea configuration
```
{
"Dhcp4": {
"ip-reservations-unique": false,
"control-socket": {
"socket-type": "unix",
"socket-name": "/tmp/kea4-ctrl-socket"
},
"hosts-database": {
"type": "mysql",
"name": "kea",
"user": "kea",
"password": "kea",
},
"reservations-global": false,
"reservations-in-subnet": false,
"hooks-libraries": [
{
"library": "/usr/local/kea/2.3.5/lib/kea/hooks/libdhcp_host_cmds.so"
}
],
"subnet4": [
{
"subnet": "192.0.2.0/24",
"id": 1
}
]
}
}
```
Using the `reservation-add` API call from the host_cmds hook you can add multiple reservations for the same IP address if `"ip-reservations-unique": false,` is set in the Kea configuration:
```
{"command": "reservation-add","arguments": {"reservation": {"subnet-id": 1,"hw-address": "99:99:99:99:99:01","ip-address": "192.0.2.181"}}}
```
```
{"command": "reservation-add","arguments": {"reservation": {"subnet-id": 1,"circuit-id": "'1234'","ip-address": "192.0.2.181"}}}
```
Then try to retrieve the hosts using the `reservation-get` API call from the host_cmds hook:
```
{"command": "reservation-get","arguments": {"ip-address": "192.0.2.181","subnet-id": 1},"service": ["dhcp4"]}
```
which will result in the aforementioned error.
It should be noted that there are other calls that are able to retrieve the reservations such as `reservation-get-by-id` and `reservation-get-page`.
[RT 21902](https://support.isc.org/Ticket/Display.html?id=21902)kea2.4.0Piotrek ZadrogaPiotrek Zadrogahttps://gitlab.isc.org/isc-projects/kea/-/issues/2783host_cmds does not log deletes (double logs adds)2023-03-15T18:52:43ZDarren Ankneyhost_cmds does not log deletes (double logs adds)While testing the host_cmds premium hook, it was discovered that only "adds" are logged (and they are logged twice). Even at debug level 99. "deletes" are not logged. This simple DHCP configuration:
```
{
"Dhcp4": {
"interfaces-...While testing the host_cmds premium hook, it was discovered that only "adds" are logged (and they are logged twice). Even at debug level 99. "deletes" are not logged. This simple DHCP configuration:
```
{
"Dhcp4": {
"interfaces-config": {
"interfaces": [ "ens256" ]
},
"control-socket":
{
"socket-type": "unix",
"socket-name": "/tmp/kea/kea4-ctrl-socket"
},
"hosts-database":
{
"type": "mysql",
"name": "kea",
"user": "kea",
"password": "kea",
"host": "127.0.0.1"
},
"hooks-libraries": [
{
"library": "/usr/local/kea/2.3.5/lib/kea/hooks/libdhcp_host_cmds.so"
}
],
"valid-lifetime": 300,
"subnet4":
[
{
"subnet": "10.1.2.0/24",
"id": 1,
"option-data": [
{
"code": 54,
"data": "10.1.2.253"
}
]
}
],
"loggers":
[
{
"name": "kea-dhcp4.host-cmds-hooks",
"output_options": [
{
"output": "/tmp/kea/dhcp4-host-cmds-hooks.log",
"maxver": 1
}
],
"severity": "INFO",
"debuglevel": 0
}
]
}
}
```
is enough to reproduce the issue. Run the add command:`sudo su - -c "echo '{\"command\": \"reservation-add\",\"arguments\": {\"reservation\": {\"subnet-id\": 1,\"hw-address\": \"aa:aa:aa:aa:aa:aa\",\"ip-address\": \"10.1.2.100\"}},\"service\": [ \"dhcp4\" ]}' | socat UNIX:/tmp/kea/kea4-ctrl-socket -,ignoreeof | jq ."`. Confirm the host has been added to the database and then run the delete command: `sudo su - -c "echo '{\"command\": \"reservation-del\",\"arguments\": {\"subnet-id\": 1,\"ip-address\": \"10.1.2.100\"},\"service\": [ \"dhcp4\" ]}' | socat UNIX:/tmp/kea/kea4-ctrl-socket -,ignoreeof | jq ."` and confirm that the host has been removed from the database. Then check the logs:
```
2023-03-07 22:11:02.515 INFO [kea-dhcp4.host-cmds-hooks/74090.281473025732624] HOST_CMDS_RESERV_ADD reservation-add command successful (parameters: { "reservation": { "hw-address": "aa:aa:aa:aa:aa:aa", "ip-address": "10.1.2.100", "subnet-id": 1 } })
2023-03-07 22:11:02.516 INFO [kea-dhcp4.host-cmds-hooks/74090.281473025732624] HOST_CMDS_RESERV_ADD reservation-add command successful (parameters: { "reservation": { "hw-address": "aa:aa:aa:aa:aa:aa", "ip-address": "10.1.2.100", "subnet-id": 1 } })
```
where you will find only two "HOST_CMDS_RESERV_ADD" lines from nearly the exact same moment in time. Nothing is logged at the time of the delete.
[RT 21880](https://support.isc.org/Ticket/Display.html?id=21880)kea2.3.6Razvan BecheriuRazvan Becheriuhttps://gitlab.isc.org/isc-projects/kea/-/issues/2471reservation-get and reservation-get-all do not return subnet-id2023-07-17T13:58:25ZMarcin Godzinareservation-get and reservation-get-all do not return subnet-idAfter implementing isc-projects/kea#2209 we have still 2 commands, that are inconsistent with others and do not return `subnet-id` when it is included in request:
```
Does NOT return `subnet-id` which is mandatory in the request:
reserva...After implementing isc-projects/kea#2209 we have still 2 commands, that are inconsistent with others and do not return `subnet-id` when it is included in request:
```
Does NOT return `subnet-id` which is mandatory in the request:
reservation-get
reservation-get-all
Always returns `subnet-id`:
reservation-get-page
reservation-get-by-hostname
reservation-get-by-id
```kea2.3.0Andrei Pavelandrei@isc.orgAndrei Pavelandrei@isc.orghttps://gitlab.isc.org/isc-projects/kea/-/issues/2209reservation-get-by-hostname: subnet-id not in response if it is in request2022-06-30T09:53:14ZAndrei Pavelandrei@isc.orgreservation-get-by-hostname: subnet-id not in response if it is in requestExpected `subnet-id` to be contained in response regardless of arguments.
This is useful when users switch between API calls and they expect the response to be the same when, for example, they parse the response or they chain API calls.Expected `subnet-id` to be contained in response regardless of arguments.
This is useful when users switch between API calls and they expect the response to be the same when, for example, they parse the response or they chain API calls.kea2.1.7Francis DupontFrancis Duponthttps://gitlab.isc.org/isc-projects/kea/-/issues/1412Fix reservation-get-by-hostname without subnet-id2020-12-08T16:11:48ZFrancis DupontFix reservation-get-by-hostname without subnet-idWhen the subnet-id is not specified in the command:
* host entries with subnet id == SUBNET_ID_UNUSED should be ignored
* the subnet id should be added (as "subnet-id") to the host element
Note that reservation-get-by-hostname has an o...When the subnet-id is not specified in the command:
* host entries with subnet id == SUBNET_ID_UNUSED should be ignored
* the subnet id should be added (as "subnet-id") to the host element
Note that reservation-get-by-hostname has an optional subnet-id parameter so should be fixed to follow these simple rules.kea1.9.3Francis DupontFrancis Duponthttps://gitlab.isc.org/isc-projects/kea/-/issues/1163Fetching host reservations without a need for subnet id2020-11-09T14:53:04ZMarcin SiodelskiFetching host reservations without a need for subnet idI have the following use case in Stork. I start to monitor a particular Kea instance. After I make sure that the host_cmds hooks library is loaded I want to be able to fetch all host reservations stored in the db for this Kea app. We hav...I have the following use case in Stork. I start to monitor a particular Kea instance. After I make sure that the host_cmds hooks library is loaded I want to be able to fetch all host reservations stored in the db for this Kea app. We have several commands to do it. I could either use `reservation-get-all` or `reservation-get-page`. The latter seems better because with the presence of large number of reservations the former could get stuck for a long time and impact the DHCP server's ability to serve the clients. However, neither of these commands allow me to fetch all hosts regardless of the subnet id they belong to. I am not so much interested in getting the hosts for individual subnets, because I want to fetch all hosts. Also, if there are many subnets, each with low number of reservations, such fetch becomes very inefficient as I would send many commands with little or (worse!) no data carried in the response.
I want to make subnet-id parameter optional in `reservation-get-page` commands, so as I can get all reservations from the database with the predictable number of hosts returned for each command issued.kea1.9.0Francis DupontFrancis Duponthttps://gitlab.isc.org/isc-projects/kea/-/issues/549Implement reservation-update command2023-07-17T13:58:21ZTomek MrugalskiImplement reservation-update commandWe currently have commands that add, retrieve and delete host reservations. We're missing a command to update existing reservations.We currently have commands that add, retrieve and delete host reservations. We're missing a command to update existing reservations.kea2.3.7Andrei Pavelandrei@isc.orgAndrei Pavelandrei@isc.orghttps://gitlab.isc.org/isc-projects/kea/-/issues/427Investigate possiblity to get host reservations by subnet-id in Cassandra2021-10-27T09:15:38ZTomek MrugalskiInvestigate possiblity to get host reservations by subnet-id in Cassandra#313 implemented ability to retrieve all hosts in specific subnet. It offers two commands: reservation-get-all and reservation-get-page. Both are implemented for MySQL and PgSQL. However, there's a problem with Cassandra that it doesn't ...#313 implemented ability to retrieve all hosts in specific subnet. It offers two commands: reservation-get-all and reservation-get-page. Both are implemented for MySQL and PgSQL. However, there's a problem with Cassandra that it doesn't allow filtering on fields that are not primary keys.
This ticket is about finding out whether there's a reasonable way to implement those commands and either implement this or provide good justification (in a form of code comments) why it can't be done.outstandinghttps://gitlab.isc.org/isc-projects/kea/-/issues/158reservation is allowed for out-of-subnet address and/or non-existent subnet-id2020-05-27T08:08:16ZCathy Almondreservation is allowed for out-of-subnet address and/or non-existent subnet-idReported by a Support customer:
https://support.isc.org/Ticket/Display.html?id=13626
---
name: Bug report
about: Kea 1.4.0 P1
---
kea-dhcp4 API accepts the creation of reservations for non-existent subnet-IDs and/or for out-of-subnet ...Reported by a Support customer:
https://support.isc.org/Ticket/Display.html?id=13626
---
name: Bug report
about: Kea 1.4.0 P1
---
kea-dhcp4 API accepts the creation of reservations for non-existent subnet-IDs and/or for out-of-subnet ip addresses, tested with mysql backend for hosts.
To reproduce:
1) create a new subnet 192.0.0.0/24, with subnet id 999
REQUEST:
{
"arguments": {
"subnet4": [
{
"id": 999,
"match-client-id": true,
"option-data": [
{
"always-send": false,
"code": 3,
"csv-format": false,
"data": "c0000001",
"name": "routers",
"space": "dhcp4"
}
],
"pools": [
{
"pool": "192.0.0.2-192.0.0.254"
}
],
"rebind-timer": 2970,
"relay": {
"ip-addresses": [
"192.0.0.1"
]
},
"renew-timer": 1800,
"reservation-mode": "all",
"subnet": "192.0.0.0/24",
"valid-lifetime": 3600
}
]
},
"command": "subnet4-add",
"service": [
"dhcp4"
]
}
RESPONSE:
[ { "arguments": { "subnets": [ { "id": 999, "subnet": "192.0.0.0/24" } ] }, "result": 0, "text": "IPv4 subnet added" } ]
2) create a reservation for out-of-subnet address using 1.2.3.4 as IP and 999 as subnet-id
REQUEST:
{
"arguments": {
"reservation": {
"hw-address": "ca:fe:ca:fe:ca:fe",
"ip-address": "1.2.3.4",
"subnet-id": 999
}
},
"command": "reservation-add",
"service": [
"dhcp4"
]
}
RESPONSE:
[ { "result": 0, "text": "Host added." } ]
3) create a reservation for a non-existent subnet-id using 192.0.0.10 as IP and 123 as subnet-id
REQUEST:
{
"arguments": {
"reservation": {
"hw-address": "fa:ce:fa:ce:fa:ce",
"ip-address": "192.0.0.10",
"subnet-id": 123
}
},
"command": "reservation-add",
"service": [
"dhcp4"
]
}
RESPONSE:
[ { "result": 0, "text": "Host added." } ]
4) verify the presence of both reservations in the "hosts" tableKea1.5-beta2Marcin SiodelskiMarcin Siodelskihttps://gitlab.isc.org/isc-projects/kea/-/issues/70Global Host Reservations Task 5: data migration scripts to convert existing s...2018-11-07T11:38:39ZGhost UserGlobal Host Reservations Task 5: data migration scripts to convert existing subnet-id values of 0The changes made in 5704 to support global HRs necessitate migrating existing data. Specifically for MySQL and PostgreSQL, any columns with values of 0 for subnet IDs in hosts and options tables, need to replace with NULL, and for Cassa...The changes made in 5704 to support global HRs necessitate migrating existing data. Specifically for MySQL and PostgreSQL, any columns with values of 0 for subnet IDs in hosts and options tables, need to replace with NULL, and for Cassandra, they should be replaced with GLOBAL_ID_UNUSED.
Data migration steps need to be added to the schema upgrade scripts for 1.5.0 to accommodate this.Kea1.5-beta1https://gitlab.isc.org/isc-projects/kea/-/issues/69Global Host Reservations Task 4: Host Commands should accept global subnet id2018-11-07T17:52:34ZGhost UserGlobal Host Reservations Task 4: Host Commands should accept global subnet idHost Cmds need to accept a subnet-id value of SUBNET_ID_GLOBAL for either v4 or v6 subnet-ids, to allow manipulation of global reservations.Host Cmds need to accept a subnet-id value of SUBNET_ID_GLOBAL for either v4 or v6 subnet-ids, to allow manipulation of global reservations.Kea1.5-beta1https://gitlab.isc.org/isc-projects/kea/-/issues/2566reservation-get-page command result for RADIUS backend2023-07-17T13:58:24ZSlawek Figielreservation-get-page command result for RADIUS backend**Describe the bug**
The user configured Kea to use RADIUS as the host backend.
The `reservation-get-page` command (and similar) returns a general error. For example:
```shell
$ kea-shell --host 127.0.0.1 --port 8000 --service dhcp4 re...**Describe the bug**
The user configured Kea to use RADIUS as the host backend.
The `reservation-get-page` command (and similar) returns a general error. For example:
```shell
$ kea-shell --host 127.0.0.1 --port 8000 --service dhcp4 reservation-get-page
"subnet-id": 1, "limit": 10
^D
[ { "result": 1, "text": "not supported by the RADIUS backend" } ]
```
I think that the result should be different.
The first proposal is to return status 2 (unsupported). It will be consistent with the error description.
The second prosal is to skip the RADIUS backend for this command. Currently, if the user has other host databases configured simultaneously, it is impossible to query them using host commands.
**To Reproduce**
Steps to reproduce the behavior:
1. Run Kea DHCP daemon (I tested it only on the DHCPv4 daemon and Kea 1.8, 2.0, and 2.2) with `hosts_cmds`, `host_cache`, and `radius` hooks.
2. Generate some network traffic. It is necessary to activate the RADIUS host backend.
3. Send the `reservations-get-page` or `reservations-get-all` command
4. Observe an error with the `result` property equal to 1.
**Expected behavior**
Skip querying the unsupported host backend for the above commands (recommended) or return an unsupported status (`result` property equal to 2).
**Environment:**
- Kea version: Kea 1.8, 2.0, and 2.2 installed from the premium CloudSmith packages. (The user reports that he used the standard ones).
- Kea hooks: hosts_cmds, host_cache, and radius
- OS: Debian 10, 11, and RHEL 8.5
- Which features were compiled in (in particular which backends): I used the official CloudSmith packages.
**Additional Information**
The problem was originally described in [stork#792](https://gitlab.isc.org/isc-projects/stork/-/issues/792).
The reporter attached the configuration file, short parts of logs, and other details.
We will handle this problem on the Stork side because it affects already released Kea versions. But it'll be nice to change it in Kea for consistency.
**Contacting you**
I'm where I'm always. An original reporter is @vps-eric.kea2.3.2Francis DupontFrancis Dupont