if (k && !carrier_warned) {
ifd_state = D6_STATE(ifd);
ipv6_addaddrs(&ifd_state->addrs);
- if_initrt(ifd->ctx, AF_INET6);
- rt_build(ifd->ctx, AF_INET6);
+ /*
+ * Can't add routes here because that will trigger
+ * interface sorting which may break the current
+ * enumeration.
+ * This doesn't really matter thanks to DaD because
+ * calling the script will be delayed and routes
+ * will get re-built if needed first.
+ * This only cause minor confusion when dhcpcd is
+ * restarted and confirms a lease where prior delegation
+ * has already been assigned, because it will log it
+ * added routes after the script has run.
+ * The routes should still be there and fine though.
+ */
dhcp6_script_try_run(ifd, 1);
}
}
+
+ /* Now all addresses have been added, rebuild the routing table. */
+ if_initrt(ifp->ctx, AF_INET6);
+ rt_build(ifp->ctx, AF_INET6);
}
static void