The SIOCAIFADDR ioctl could lose a race against another process
authorflorian <florian@openbsd.org>
Mon, 26 Jul 2021 09:22:00 +0000 (09:22 +0000)
committerflorian <florian@openbsd.org>
Mon, 26 Jul 2021 09:22:00 +0000 (09:22 +0000)
configuring the same IP.
Found the hard way by afresh1

sbin/dhcpleased/dhcpleased.c

index 0e08c20..f4b2104 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: dhcpleased.c,v 1.16 2021/07/22 18:01:29 stsp Exp $    */
+/*     $OpenBSD: dhcpleased.c,v 1.17 2021/07/26 09:22:00 florian Exp $ */
 
 /*
  * Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -692,7 +692,7 @@ configure_interface(struct imsg_configure_interface *imsg)
                req_sin_mask->sin_len = sizeof(*req_sin_mask);
                req_sin_mask->sin_addr.s_addr = imsg->mask.s_addr;
                if (ioctl(ioctl_sock, SIOCAIFADDR, &ifaliasreq) == -1)
-                       fatal("SIOCAIFADDR");
+                       log_warn("SIOCAIFADDR");
        }
        if (imsg->routes_len > 0)
                configure_routes(RTM_ADD, imsg);