Any interface created while retrying sockets are used unfiltered
Describe the bug
While retrying an interface that didn't met the socket requirements in IfaceMgr::openSockets4
yet, if new interfaces registered to system Kea DHCP4 server listens those interfaces even they are not listed in configuration file.
To Reproduce
Steps to reproduce the behavior:
- Set a dummy interface and ensure that it's down.
ip link add dummy0 type dummy
ip addr add 192.168.1.1/24 dev dummy0
ip link set dummy0 down
-
Run Kea dhcp4 server with the following config
{ "Dhcp4": { "valid-lifetime": 4000, "renew-timer": 1000, "rebind-timer": 2000, "interfaces-config": { "interfaces": [ "dummy0/192.168.1.1" ], "service-sockets-max-retries": 1000, "service-sockets-retry-wait-time": 1000 }, "lease-database": { "type": "memfile", "persist": true, "name": "/var/lib/dhcp4.leases" }, "subnet4": [ { "subnet": "192.168.1.0/24", "interface": "dummy0", "pools": [ { "pool": "192.168.1.4 - 192.168.1.254", } ] } ] } }
-
At this point Kea will print
DHCPSRV_OPEN_SOCKET_FAIL failed to open socket: the interface dummy0 is down
messages. -
Add another interface with
ip link add dummy1 type dummy
ip addr add 10.10.1.1/24 dev dummy1
ip link set dummy1 up
-
Set dummy0 online to let Kea run
ip link set dummy1 up
-
Check open sockets by Kea
netstat -tulpan | grep kea
which isudp 0 0 192.168.1.1:67 0.0.0.0:* 694387/kea-dhcp4 udp 0 0 10.10.1.1:67 0.0.0.0:* 694387/kea-dhcp4
Expected behavior
Server should only listen dummy0 interface.
Environment:
- Kea version: 2.2.0
- OS: Ubuntu 22.04.3 x64
Additional Information
This issue happened also on our custom yocto build on imx8qxp with aarch64