summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2021-02-27 17:53:23 +0000
committerflorian <florian@openbsd.org>2021-02-27 17:53:23 +0000
commit7bd66a84f5a8b0921e6bd8a9884ac0ec1b399b19 (patch)
tree0afca43db2266d0e2b508ac78ef55bc36439060a
parentensure local array is same size as global (diff)
downloadwireguard-openbsd-7bd66a84f5a8b0921e6bd8a9884ac0ec1b399b19.tar.xz
wireguard-openbsd-7bd66a84f5a8b0921e6bd8a9884ac0ec1b399b19.zip
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.
-rw-r--r--sbin/dhcpleased/dhcpleased.c7
1 files 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 <florian@openbsd.org>
@@ -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);