From: florian Date: Mon, 16 Sep 2024 07:34:49 +0000 (+0000) Subject: Close correct file descriptor. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1a83499475293943c4a4877f95fbd236a5ff897f;p=openbsd Close correct file descriptor. 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 --- diff --git a/sbin/dhcpleased/frontend.c b/sbin/dhcpleased/frontend.c index 399345c99f3..dd81bd892b0 100644 --- a/sbin/dhcpleased/frontend.c +++ b/sbin/dhcpleased/frontend.c @@ -1,4 +1,4 @@ -/* $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 @@ -310,7 +310,7 @@ frontend_dispatch_main(int fd, short event, void *bula) 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)