summaryrefslogtreecommitdiff
path: root/sbin/slaacd/engine.c
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2022-07-23 16:16:26 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2022-07-23 16:16:26 +0000
commit4de668d109828bf729e3ac9c6be06e536ecbd403 (patch)
tree95315cb7afa4ef88386a653e78f4fdf80afb57c1 /sbin/slaacd/engine.c
parentaf87665261b256914621a7a88f9dc768bd5bd690 (diff)
Delete autoconf or temporary address if flag is removed.
OK kn
Diffstat (limited to 'sbin/slaacd/engine.c')
-rw-r--r--sbin/slaacd/engine.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sbin/slaacd/engine.c b/sbin/slaacd/engine.c
index 1412d4d2405..6d0eed75dd3 100644
--- a/sbin/slaacd/engine.c
+++ b/sbin/slaacd/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.82 2022/07/23 09:00:10 florian Exp $ */
+/* $OpenBSD: engine.c,v 1.83 2022/07/23 16:16:25 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
@@ -1930,6 +1930,20 @@ update_iface_ra_prefix(struct slaacd_iface *iface, struct radv *ra,
found = found_temporary = duplicate_found = 0;
+ if (!!iface->autoconf != !!iface->temporary) {
+ struct address_proposal *tmp;
+ /*
+ * If only the autoconf or temporary flag is set, check if we
+ * have the "other kind" of address configured and delete it.
+ */
+ LIST_FOREACH_SAFE (addr_proposal, &iface->addr_proposals,
+ entries, tmp) {
+ if ((!addr_proposal->temporary && !iface->autoconf) ||
+ (addr_proposal->temporary && !iface->temporary))
+ free_address_proposal(addr_proposal);
+ }
+ }
+
LIST_FOREACH(addr_proposal, &iface->addr_proposals, entries) {
if (prefix->prefix_len == addr_proposal-> prefix_len &&
memcmp(&prefix->prefix, &addr_proposal->prefix,