Cannot Allocate IP address with infinite lease and PostgresSQL
name: Cannot Allocate IP address with infinite lease and PostgresSQL
Describe the bug I am trying to use Kea to allocate IP address with infinite lease, using validity-timer=-1. I am using PostgresSQL DB to store the lease. When Kea tries to allocate an IP it throws an error Could not create bind array from Lease4: 192.168.89.3, reason: Time value is too large: 5854783399
Steps to reproduce the behavior:
- Run Kea 1.5 DHCPv4 demon with the following config
DHCPv4 configuration starts here.
"Dhcp4": {
Add names of interfaces to listen on.
"interfaces-config": { "interfaces": ["lo/10.10.10." ] },
Control gent configuration
"control-socket": { "socket-type": "unix", "socket-name": "/tmp/kea-dhcp4-ctrl.sock" },
Use PostgresDB
"lease-database": { "typedb": "postgresql", "host": "10.10.10.22", "user": "kea", "password": "kea", "namedb": "kea" },
Inifite lease
"valid-lifetime": -1,
Below an example of the simple subnet declaration. Uncomment to
enable it. This is a list, denoted with [ ], of structure, denoted
with { }. Each structure describes a single subnet and may have
several parameters. One of those parameters is "pools" that is
also a list of structures.
"subnet4": [ { "subnet": "192.168.89.0/24", "id": 4001, "pools": [ { "pool": "192.168.89.2 - 192.168.89.100" } ] } ] },
- A client send DISCOVER to the server
- The server then throws an error
- See error 2019-06-06 09:56:42.574 INFO [kea-dhcp4.dhcpsrv/106] DHCPSRV_PGSQL_DB opening PostgreSQL lease database: host=10.10.10.22 name=kea password=***** type=postgresql universe=4 user=kea 2019-06-06 10:04:42.024 INFO [kea-dhcp4.hosts/167] HOSTS_BACKENDS_REGISTERED the following host backend types are available: mysql postgresql 2019-06-06 10:04:42.024 INFO [kea-dhcp4.dhcpsrv/167] DHCPSRV_CFGMGR_SOCKET_TYPE_DEFAULT "dhcp-socket-type" not specified , using default socket type raw 2019-06-06 10:04:42.025 INFO [kea-dhcp4.dhcpsrv/167] DHCPSRV_CFGMGR_NEW_SUBNET4 a new subnet has been added to configuration: 192.168.89.0/24 with params: valid-lifetime=4294967295 2019-06-06 10:04:42.025 INFO [kea-dhcp4.commands/167] COMMAND_ACCEPTOR_START Starting to accept connections via unix domain socket bound to /tmp/kea-dhcp4-ctrl.sock 2019-06-06 10:04:42.025 INFO [kea-dhcp4.dhcp4/167] DHCP4_CONFIG_COMPLETE DHCPv4 server has completed configuration: added IPv4 subnets: 1; DDNS: disabled 2019-06-06 10:04:42.025 INFO [kea-dhcp4.dhcpsrv/167] DHCPSRV_PGSQL_DB opening PostgreSQL lease database: host=10.10.10.22 name=kea password=***** type=postgresql universe=4 user=kea 2019-06-06 10:04:42.044 INFO [kea-dhcp4.dhcp4/167] DHCP4_STARTED Kea DHCPv4 server version 1.5.0 started 2019-06-06 10:05:04.277 INFO [kea-dhcp4.leases/167] DHCP4_LEASE_ADVERT [hwtype=1 00:00:00:00:00:00], cid=[ff:00:00:00:00:00:02:00:00:00:09:01:10:49:52:38:30:39:47:2d:4c:54:45:2d:47:41:2d:4b:39:02:0b:4a:4d:58:32:3 0:32:33:58:30:30:30], tid=0x37fef8: lease 192.168.89.2 will be advertised 2019-06-06 10:05:04.279 ERROR [kea-dhcp4.alloc-engine/167] ALLOC_ENGINE_V4_ALLOC_ERROR [hwtype=1 00:00:00:00:00:00], cid=[ff:00:00:00:00:00:02:00:00:00:09:01:10:49:52:38:30:39:47:2d:4c:54:45:2d:47:41:2d:4b:39:02:0 b:4a:4d:58:32:30:32:33:58:30:30:30], tid=0x272c33: error during attempt to allocate an IPv4 address: Could not create bind array from Lease4: 192.168.89.2, reason: Time value is too large: 5854782799
Expected behavior If if I use lease storage on a local CSV file there are no issues. The server should store the lease in the database and allocate an IP address to the client
Environment:
- Kea version: 1.5
- OS: Ubuntu ocean
- using PostgresDB server 9.6