summaryrefslogtreecommitdiff
path: root/sbin/unwind
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2019-11-23 08:17:11 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2019-11-23 08:17:11 +0000
commitb6e66fcc904c338cf564f92730ba3dcdd503afc9 (patch)
tree1f6600c5106011e72ceb95f6185177a4d4d6a1f5 /sbin/unwind
parent3b3482ead22de263d0a631db5bc5c4766c6068e9 (diff)
An if_index of zero signals to remove all previous proposals from a
daemon. Soon to be used by slaacd(8) which handles all interfaces but can't know which interfaces had been set to autoconf before a restart.
Diffstat (limited to 'sbin/unwind')
-rw-r--r--sbin/unwind/resolver.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/sbin/unwind/resolver.c b/sbin/unwind/resolver.c
index f8626545246..7680ac8b041 100644
--- a/sbin/unwind/resolver.c
+++ b/sbin/unwind/resolver.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: resolver.c,v 1.73 2019/11/22 20:09:09 otto Exp $ */
+/* $OpenBSD: resolver.c,v 1.74 2019/11/23 08:17:10 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -1967,21 +1967,22 @@ replace_autoconf_forwarders(struct imsg_rdns_proposal *rdns_proposal)
}
TAILQ_FOREACH(tmp, &autoconf_forwarder_list, entry) {
- if (tmp->src != rdns_proposal->src || tmp->if_index !=
- rdns_proposal->if_index) {
- if ((uw_forwarder =
- calloc(1, sizeof(struct uw_forwarder))) == NULL)
- fatal(NULL);
- if (strlcpy(uw_forwarder->name, tmp->name,
- sizeof(uw_forwarder->name)) >=
- sizeof(uw_forwarder->name))
- fatalx("strlcpy");
- uw_forwarder->src = tmp->src;
- uw_forwarder->if_index = tmp->if_index;
- TAILQ_INSERT_TAIL(&new_forwarder_list, uw_forwarder,
- entry);
- }
+ /* if_index of zero signals to clear all proposals */
+ if (rdns_proposal->src == tmp->src &&
+ (rdns_proposal->if_index == 0 || rdns_proposal->if_index ==
+ tmp->if_index))
+ continue;
+ if ((uw_forwarder = calloc(1, sizeof(struct uw_forwarder))) ==
+ NULL)
+ fatal(NULL);
+ if (strlcpy(uw_forwarder->name, tmp->name,
+ sizeof(uw_forwarder->name)) >= sizeof(uw_forwarder->name))
+ fatalx("strlcpy");
+ uw_forwarder->src = tmp->src;
+ uw_forwarder->if_index = tmp->if_index;
+ TAILQ_INSERT_TAIL(&new_forwarder_list, uw_forwarder, entry);
}
+
changed = check_forwarders_changed(&new_forwarder_list,
&autoconf_forwarder_list);