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>")
This commit is contained in:
Bill Fenner 1996-03-29 08:02:30 +00:00
parent e206cebf59
commit 6ac3b69d76

View File

@ -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++;