Revert "config: recheck have_link_local on interface reload if already init"
authorChristian Marangi <ansuelsmth@gmail.com>
Mon, 3 Apr 2023 17:42:43 +0000 (19:42 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Mon, 3 Apr 2023 19:19:25 +0000 (21:19 +0200)
This reverts commit 29c934d7ab98ca0b5da0e3757b885a1d3c19a2f4.

Replace with a better more safe implementation.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
src/config.c

index 85d77b06986588dc55ceaf1ed9a8a774472e4953..6122fb1572d3ed3fef0263f62f28dfbbc728af50 100644 (file)
@@ -594,21 +594,21 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
                if (len > 0)
                        iface->addr6_len = len;
 
+               for (size_t i = 0; i < iface->addr6_len; i++) {
+                       struct odhcpd_ipaddr *addr = &iface->addr6[i];
+
+                       if (!addr->tentative) {
+                               iface->have_link_local = true;
+                               break;
+                       }
+               }
+
                len = netlink_get_interface_addrs(iface->ifindex,
                                                false, &iface->addr4);
                if (len > 0)
                        iface->addr4_len = len;
        }
 
-       for (size_t i = 0; i < iface->addr6_len; i++) {
-               struct odhcpd_ipaddr *addr = &iface->addr6[i];
-
-               if (!addr->tentative) {
-                       iface->have_link_local = true;
-                       break;
-               }
-       }
-
        iface->inuse = true;
 
        if ((c = tb[IFACE_ATTR_DYNAMICDHCP]))