From 7bd66a84f5a8b0921e6bd8a9884ac0ec1b399b19 Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 27 Feb 2021 17:53:23 +0000 Subject: [PATCH] Restore ability to handle default routes on multiple interfaces, this got lost shortly before initial import. While here explicitly delete the default route when deconfiguring an interface. There might be corner cases where the stack will not tear it down for us when we remove the IP address. --- sbin/dhcpleased/dhcpleased.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sbin/dhcpleased/dhcpleased.c b/sbin/dhcpleased/dhcpleased.c index dca6461bdef..1f420ae35cd 100644 --- a/sbin/dhcpleased/dhcpleased.c +++ b/sbin/dhcpleased/dhcpleased.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpleased.c,v 1.3 2021/02/27 10:21:08 florian Exp $ */ +/* $OpenBSD: dhcpleased.c,v 1.4 2021/02/27 17:53:23 florian Exp $ */ /* * Copyright (c) 2017, 2021 Florian Obser @@ -771,6 +771,9 @@ deconfigure_interface(struct imsg_configure_interface *imsg) memset(&ifaliasreq, 0, sizeof(ifaliasreq)); + if (imsg->router.s_addr != INADDR_ANY) + configure_gateway(imsg, RTM_DELETE); + if (if_indextoname(imsg->if_index, ifaliasreq.ifra_name) == NULL) { log_warnx("%s: cannot find interface %d", __func__, imsg->if_index); @@ -810,7 +813,7 @@ configure_gateway(struct imsg_configure_interface *imsg, uint8_t rtm_type) rtm.rtm_seq = ++rtm_seq; rtm.rtm_priority = RTP_NONE; rtm.rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK | RTA_LABEL; - rtm.rtm_flags = RTF_UP | RTF_GATEWAY | RTF_STATIC; + rtm.rtm_flags = RTF_UP | RTF_GATEWAY | RTF_STATIC | RTF_MPATH; iov[iovcnt].iov_base = &rtm; iov[iovcnt++].iov_len = sizeof(rtm); -- 2.20.1