-/* $OpenBSD: dhcpleased.c,v 1.25 2022/07/23 09:29:20 florian Exp $ */
+/* $OpenBSD: dhcpleased.c,v 1.26 2022/07/23 09:33:18 florian Exp $ */
/*
* Copyright (c) 2017, 2021 Florian Obser <florian@openbsd.org>
memset(&ifaliasreq, 0, sizeof(ifaliasreq));
+#if 0
+ /*
+ * When two default routes have the same gateway the kernel always
+ * deletes the first which might be the wrong one. When we then
+ * deconfigure the IP address from the interface the kernel deletes
+ * all routes pointing out that interface and we end up with no
+ * default.
+ * This can happen with a wired & wireless interface on the same
+ * layer 2 network and the user issues ifconfig $WIFI inet -autoconf.
+ * Work around this issue by not deleting the default route and let
+ * the kernel handle it when we remove the IP address a few lines
+ * down.
+ */
if (imsg->routes_len > 0)
configure_routes(RTM_DELETE, imsg);
+#endif
if (if_indextoname(imsg->if_index, ifaliasreq.ifra_name) == NULL) {
log_warnx("%s: cannot find interface %d", __func__,