diff options
author | wollman <wollman@FreeBSD.org> | 1995-03-21 19:50:34 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1995-03-21 19:50:34 +0000 |
commit | 73b8a7191866aeb72f531f2699e75bdccec5f8be (patch) | |
tree | 85daefc021765953a02df5e9bac370e07518b113 /sys/net | |
parent | f414596f26fef28cae14e5b146157c1f055699bc (diff) | |
download | FreeBSD-src-73b8a7191866aeb72f531f2699e75bdccec5f8be.zip FreeBSD-src-73b8a7191866aeb72f531f2699e75bdccec5f8be.tar.gz |
Protocol-cloned routes should gain a reference to their parents to make
sure that rt->rt_parent values can never be re-used harmfully.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/route.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index 98d228f..9cd58c9 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)route.c 8.2 (Berkeley) 11/15/93 - * $Id: route.c,v 1.17 1995/03/20 21:30:18 wollman Exp $ + * $Id: route.c,v 1.18 1995/03/20 23:00:57 davidg Exp $ */ #include <sys/param.h> @@ -166,6 +166,9 @@ rtfree(rt) } ifa = rt->rt_ifa; IFAFREE(ifa); + if (rt->rt_parent) { + RTFREE(rt->rt_parent); + } Free(rt_key(rt)); Free(rt); } @@ -445,10 +448,14 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt) ifa->ifa_refcnt++; rt->rt_ifa = ifa; rt->rt_ifp = ifa->ifa_ifp; + rt->rt_parent = 0; + if (req == RTM_RESOLVE) { rt->rt_rmx = (*ret_nrt)->rt_rmx; /* copy metrics */ - if ((*ret_nrt)->rt_flags & RTF_PRCLONING) + if ((*ret_nrt)->rt_flags & RTF_PRCLONING) { rt->rt_parent = (*ret_nrt); + (*ret_nrt)->rt_refcnt++; + } } if (ifa->ifa_rtrequest) ifa->ifa_rtrequest(req, rt, SA(ret_nrt ? *ret_nrt : 0)); |