From owner-freebsd-net@FreeBSD.ORG Wed Feb 25 06:13:31 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CBBDD16A4CE; Wed, 25 Feb 2004 06:13:31 -0800 (PST) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id E371D43D39; Wed, 25 Feb 2004 06:13:30 -0800 (PST) (envelope-from glebius@cell.sick.ru) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.12.9/8.12.8) with ESMTP id i1PEDQQE086309 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 25 Feb 2004 17:13:27 +0300 (MSK) (envelope-from glebius@cell.sick.ru) Received: (from glebius@localhost) by cell.sick.ru (8.12.9/8.12.6/Submit) id i1PEDQbB086308; Wed, 25 Feb 2004 17:13:26 +0300 (MSK) Date: Wed, 25 Feb 2004 17:13:26 +0300 From: Gleb Smirnoff To: Andre Oppermann , freebsd-net@freebsd.org Message-ID: <20040225141326.GA86194@cell.sick.ru> Mail-Followup-To: Gleb Smirnoff , Andre Oppermann , freebsd-net@freebsd.org References: <20040224080353.GA76272@cell.sick.ru> <403B2423.DABF2E48@freebsd.org> <20040224102113.GB77406@cell.sick.ru> <403B4182.F6BD7101@freebsd.org> <20040224123427.GA78495@cell.sick.ru> <403B47D4.6F783F4F@freebsd.org> <20040224130408.GA78658@cell.sick.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20040224130408.GA78658@cell.sick.ru> User-Agent: Mutt/1.5.6i Subject: Re: rtalloc()/rtfree() problems on CURRENT X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Feb 2004 14:13:31 -0000 On Tue, Feb 24, 2004 at 04:04:08PM +0300, Gleb Smirnoff wrote: T> A> Ah, sorry, forgot that in my last email. The only thing is to use RTFREE(). T> A> At first I thought your reassigning of rt is a problem, but you free the T> A> correct ro.ro_rt later. T> T> Thank you! I'll try everything you suggested today night. Thanks again. Using RTFREE() fixed the problem. It works OK both on STABLE and CURRENT. If you don't mind I have one more question, though. Looking through kernel code, seeking for examples, I have found following in in_gif.c: rt = rtalloc1((struct sockaddr *)&sin, 0, 0UL); if (!rt || rt->rt_ifp != ifp) { #if 0 log(LOG_WARNING, "%s: packet from 0x%x dropped " "due to ingress filter\n", if_name(&sc->gif_if), (u_int32_t)ntohl(sin.sin_addr.s_addr)); #endif if (rt) rtfree(rt); return 0; } rtfree(rt); And it doesn't crash. Looking through the code I understood that in case of rtalloc()/rtfree() or rtalloc_ign()/rtfree() macro RT_UNLOCK is called twice, and this leads to panic. But in case of rtalloc1()/rtfree() everything is OK, since RT_UNLOCK is called once. So, the question is: if I need some readonly access to routing table can I use rtalloc1()/rtfree() or not? Will RTFREE be mandatory in future? This will save some small amount of CPU time, but this code is executed really often. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE