summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-09-10 09:37:52 +0000
committermpi <mpi@openbsd.org>2015-09-10 09:37:52 +0000
commit9ad74bffdd643eba30fee774c3e694b19cd108d9 (patch)
tree901cf091ca80ad88b93b5be0378af26ac4aafc41
parentif_put dance, shuffle some code and switch a printf to print the ifindex (diff)
downloadwireguard-openbsd-9ad74bffdd643eba30fee774c3e694b19cd108d9.tar.xz
wireguard-openbsd-9ad74bffdd643eba30fee774c3e694b19cd108d9.zip
Use rtfree(9) rather than decrementing the reference counter.
We know the parent wont be freed at this point because cloned routes are always purged from the tree before parents. ok claudio@
-rw-r--r--sys/net/route.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index 64e1df22c6d..5952ce74dc3 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.230 2015/09/04 08:43:39 mpi Exp $ */
+/* $OpenBSD: route.c,v 1.231 2015/09/10 09:37:52 mpi Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -830,15 +830,11 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio,
if ((rt->rt_flags & RTF_CLONING) != 0)
rtflushclone(tableid, rt);
- if (rt->rt_gwroute) {
- rtfree(rt->rt_gwroute);
- rt->rt_gwroute = NULL;
- }
+ rtfree(rt->rt_gwroute);
+ rt->rt_gwroute = NULL;
- if (rt->rt_parent) {
- rt->rt_parent->rt_refcnt--;
- rt->rt_parent = NULL;
- }
+ rtfree(rt->rt_parent);
+ rt->rt_parent = NULL;
rt->rt_flags &= ~RTF_UP;
if ((ifa = rt->rt_ifa) && ifa->ifa_rtrequest)