From 6a7bff2c31d1bb57e006edbb82660cc13504a802 Mon Sep 17 00:00:00 2001 From: Kip Macy Date: Sat, 11 Jul 2009 21:56:23 +0000 Subject: [PATCH] Re-factoring for adding weighted routes introduced a fairly irritating bug where the system will panic when RADIX_MPATH is enabled. This change fixes this. Approved by: re@ --- sys/net/route.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/net/route.c b/sys/net/route.c index a3dc1693a36e..750829a77e6b 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -987,7 +987,16 @@ rn_mpath_update(int req, struct rt_addrinfo *info, (rt->rt_gateway->sa_len != gateway->sa_len || memcmp(rt->rt_gateway, gateway, gateway->sa_len))) error = ESRCH; - goto done; + else { + /* + * remove from tree before returning it + * to the caller + */ + rn = rnh->rnh_deladdr(dst, netmask, rnh); + KASSERT(rt == RNTORT(rn), ("radix node disappeared")); + goto gwdelete; + } + } /* * use the normal delete code to remove @@ -1005,6 +1014,7 @@ rn_mpath_update(int req, struct rt_addrinfo *info, */ if ((req == RTM_DELETE) && !rt_mpath_deldup(rto, rt)) panic ("rtrequest1: rt_mpath_deldup"); +gwdelete: RT_LOCK(rt); RT_ADDREF(rt); if (req == RTM_DELETE) {