From: florian Date: Wed, 31 May 2017 07:30:32 +0000 (+0000) Subject: do not leak address and dfr proposals if an interface goes away X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=aa80c1a218f6f5b8096f2bd4f1ae85e1a6520290;p=openbsd do not leak address and dfr proposals if an interface goes away --- diff --git a/usr.sbin/slaacd/engine.c b/usr.sbin/slaacd/engine.c index 6ecd6cb2f0e..c43bfc4c708 100644 --- a/usr.sbin/slaacd/engine.c +++ b/usr.sbin/slaacd/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.36 2017/05/31 07:14:58 florian Exp $ */ +/* $OpenBSD: engine.c,v 1.37 2017/05/31 07:30:32 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser @@ -847,6 +847,8 @@ remove_slaacd_iface(uint32_t if_index) { struct slaacd_iface *iface, *tiface; struct radv *ra; + struct address_proposal *addr_proposal; + struct dfr_proposal *dfr_proposal; LIST_FOREACH_SAFE (iface, &slaacd_interfaces, entries, tiface) { if (iface->if_index == if_index) { @@ -856,6 +858,19 @@ remove_slaacd_iface(uint32_t if_index) LIST_REMOVE(ra, entries); free_ra(ra); } + /* XXX inform netcfgd? */ + while(!LIST_EMPTY(&iface->addr_proposals)) { + addr_proposal = + LIST_FIRST(&iface->addr_proposals); + LIST_REMOVE(addr_proposal, entries); + free(addr_proposal); + } + while(!LIST_EMPTY(&iface->dfr_proposals)) { + dfr_proposal = + LIST_FIRST(&iface->dfr_proposals); + LIST_REMOVE(dfr_proposal, entries); + free(dfr_proposal); + } free(iface); break; }