Instead of closing the just received UDP socket we closed the imsg fd
thus cleanly shutting down dhcpleased(8).
Problem triggered by sf@ with something like
while :; do ifconfig vio0 -inet; done
while :; do ifconfig vio0 inet autoconf; done
The problem triggers when dhcpleased configured a lease and in just
the right moment the autoconf flag gets removed. The main process
opens a udp socket and sends it to the frontend. At the same time the
frontend learned (from the route socket), that the interface lost its
autoconf flag. When the frontend then receives the udp socket via fd
passing it tries to close it. Due to a typo it would instead close the
imsg file descriptor.
Found by me after lots of head scratching.
OK tb
-/* $OpenBSD: frontend.c,v 1.38 2024/08/26 06:06:04 florian Exp $ */
+/* $OpenBSD: frontend.c,v 1.39 2024/09/16 07:34:49 florian Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
fatalx("%s: invalid %s", __func__, i2s(type));
if ((iface = get_iface_by_id(if_index)) == NULL) {
- close(fd);
+ close(udpsock);
break;
}
if (iface->udpsock != -1)