summaryrefslogtreecommitdiffstats
path: root/sys/net/route.c
diff options
context:
space:
mode:
authorfenner <fenner@FreeBSD.org>1996-03-29 08:02:30 +0000
committerfenner <fenner@FreeBSD.org>1996-03-29 08:02:30 +0000
commitfe678071c2465dbd3005cabaacd14ecf0be1f06d (patch)
treeff00eef1f489f3902eb4542a7c37e8c5996465f2 /sys/net/route.c
parentbcaf3321ab5fccd7bef348ed0d5e7572bcc65432 (diff)
downloadFreeBSD-src-fe678071c2465dbd3005cabaacd14ecf0be1f06d.zip
FreeBSD-src-fe678071c2465dbd3005cabaacd14ecf0be1f06d.tar.gz
Eliminate panic("rtfree") caused by double-freeing the route
when rt == rt->rt_gwroute . rt == rt->gwroute shouldn't happen in the first place, but that's another problem. (try "route add -host <hostonmynet> <hostonmynet>; ping <hostonmynet>; route delete <hostonmynet>")
Diffstat (limited to 'sys/net/route.c')
-rw-r--r--sys/net/route.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index ecce455..a873953 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.31 1996/03/02 18:24:08 peter Exp $
+ * $Id: route.c,v 1.32 1996/03/11 15:13:05 davidg Exp $
*/
#include "opt_mrouting.h"
@@ -406,6 +406,11 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt)
rt_fixdelete, rt);
}
+ if (rt->rt_gwroute) {
+ rt = rt->rt_gwroute; RTFREE(rt);
+ (rt = (struct rtentry *)rn)->rt_gwroute = 0;
+ }
+
/*
* NB: RTF_UP must be set during the search above,
* because we might delete the last ref, causing
@@ -413,10 +418,6 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt)
*/
rt->rt_flags &= ~RTF_UP;
- if (rt->rt_gwroute) {
- rt = rt->rt_gwroute; RTFREE(rt);
- (rt = (struct rtentry *)rn)->rt_gwroute = 0;
- }
if ((ifa = rt->rt_ifa) && ifa->ifa_rtrequest)
ifa->ifa_rtrequest(RTM_DELETE, rt, SA(0));
rttrash++;
OpenPOWER on IntegriCloud