From 547546f23490deed3dd0821e54bd70344c21e93e Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 23 Jul 2022 16:16:25 +0000 Subject: [PATCH] Delete autoconf or temporary address if flag is removed. OK kn --- sbin/slaacd/engine.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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 @@ -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, -- 2.20.1