Make dhcpleased(8) always configure provided routes, regardless of
authorstsp <stsp@openbsd.org>
Thu, 22 Jul 2021 18:01:29 +0000 (18:01 +0000)
committerstsp <stsp@openbsd.org>
Thu, 22 Jul 2021 18:01:29 +0000 (18:01 +0000)
whether the address we received in our lease is already configured.

In the case I observed, no default route was added to the routing table
even though the server provided both an address and a route option.
As it happened the leased address was already configured on the interface.
This should not prevent routing table updates, but it did.

ok florian

sbin/dhcpleased/dhcpleased.c

index 8fc6069..0e08c20 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: dhcpleased.c,v 1.15 2021/07/21 03:53:50 kn Exp $      */
+/*     $OpenBSD: dhcpleased.c,v 1.16 2021/07/22 18:01:29 stsp Exp $    */
 
 /*
  * Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
@@ -693,10 +693,10 @@ configure_interface(struct imsg_configure_interface *imsg)
                req_sin_mask->sin_addr.s_addr = imsg->mask.s_addr;
                if (ioctl(ioctl_sock, SIOCAIFADDR, &ifaliasreq) == -1)
                        fatal("SIOCAIFADDR");
-
-               if (imsg->routes_len > 0)
-                       configure_routes(RTM_ADD, imsg);
        }
+       if (imsg->routes_len > 0)
+               configure_routes(RTM_ADD, imsg);
+
        req_sin_addr->sin_port = ntohs(CLIENT_PORT);
        if ((udpsock = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
                log_warn("socket");