summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ospfd/rde.c
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2015-03-14 02:22:09 +0000
committerclaudio <claudio@openbsd.org>2015-03-14 02:22:09 +0000
commitd9d28784953352336ed8530782fedb06e5a65f09 (patch)
tree3882ec675ab9941608481a7343ced4a68252d66c /usr.sbin/ospfd/rde.c
parentmove some deck chairs around in preparation for i386 PAE. no functional (diff)
downloadwireguard-openbsd-d9d28784953352336ed8530782fedb06e5a65f09.tar.xz
wireguard-openbsd-d9d28784953352336ed8530782fedb06e5a65f09.zip
When removing interfaces in the RDE we also need to remove all the RDE
neighbors that are part of that interface or we open us up to use after free situations like the one found by sthen@. Diff makes sense sthen@
Diffstat (limited to 'usr.sbin/ospfd/rde.c')
-rw-r--r--usr.sbin/ospfd/rde.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.sbin/ospfd/rde.c b/usr.sbin/ospfd/rde.c
index c1fa9f5e8c3..844bd5c6542 100644
--- a/usr.sbin/ospfd/rde.c
+++ b/usr.sbin/ospfd/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.96 2014/07/12 20:16:38 krw Exp $ */
+/* $OpenBSD: rde.c,v 1.97 2015/03/14 02:22:09 claudio Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -963,6 +963,22 @@ rde_nbr_new(u_int32_t peerid, struct rde_nbr *new)
}
void
+rde_nbr_iface_del(struct iface *iface)
+{
+ struct rde_nbr_head *head;
+ struct rde_nbr *nbr, *xnbr;
+ u_int32_t i;
+
+ for (i = 0; i <= rdenbrtable.hashmask; i++) {
+ head = &rdenbrtable.hashtbl[i];
+ LIST_FOREACH_SAFE(nbr, head, hash, xnbr) {
+ if (nbr->iface == iface)
+ rde_nbr_del(nbr);
+ }
+ }
+}
+
+void
rde_nbr_del(struct rde_nbr *nbr)
{
if (nbr == NULL)