summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2016-07-19 10:26:41 +0000
committermpi <mpi@openbsd.org>2016-07-19 10:26:41 +0000
commit3d544934a25338e64c52747e5bd5ff52f77a9b4f (patch)
treed9d7ea05a08e1d3dfba4f5a6498385b0cd9b7941
parentReplace malloc() + memset() with calloc(). (diff)
downloadwireguard-openbsd-3d544934a25338e64c52747e5bd5ff52f77a9b4f.tar.xz
wireguard-openbsd-3d544934a25338e64c52747e5bd5ff52f77a9b4f.zip
Return EAGAIN for every deleted route when detaching an interface.
Previously the code was "too clever" and returned EAGAIN only for cloning route assuming that other deletion did not modify the tree. Analysed by and ok dlg@
-rw-r--r--sys/net/route.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index 80cbd3aa34a..f9fa397009d 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.311 2016/07/11 13:06:31 bluhm Exp $ */
+/* $OpenBSD: route.c,v 1.312 2016/07/19 10:26:41 mpi Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -1721,22 +1721,14 @@ rt_if_remove(struct ifnet *ifp)
}
}
-/*
- * Note that deleting a RTF_CLONING route can trigger the
- * deletion of more entries, so we need to cancel the walk
- * and return EAGAIN. The caller should restart the walk
- * as long as EAGAIN is returned.
- */
int
rt_if_remove_rtdelete(struct rtentry *rt, void *vifp, u_int id)
{
struct ifnet *ifp = vifp;
if (rt->rt_ifidx == ifp->if_index) {
- int cloning = (rt->rt_flags & RTF_CLONING);
-
- if (rtdeletemsg(rt, ifp, id) == 0 && cloning)
- return (EAGAIN);
+ rtdeletemsg(rt, ifp, id);
+ return (EAGAIN);
}
return (0);