From owner-freebsd-net Sun Dec 22 11:42: 5 2002 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 C1A5237B401 for ; Sun, 22 Dec 2002 11:42:02 -0800 (PST) Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1EFA243EDE for ; Sun, 22 Dec 2002 11:41:59 -0800 (PST) (envelope-from ru@whale.sunbay.crimea.ua) Received: from whale.sunbay.crimea.ua (root@localhost) by whale.sunbay.crimea.ua (8.12.6/8.12.6/Sunbay) with SMTP id gBMJftdc040228 for ; Sun, 22 Dec 2002 21:41:55 +0200 (EET) (envelope-from ru@whale.sunbay.crimea.ua) Received: from whale.sunbay.crimea.ua (ru@localhost [127.0.0.1]) by whale.sunbay.crimea.ua (8.12.6/8.12.6/Sunbay) with ESMTP id gBMJfreY040202 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Sun, 22 Dec 2002 21:41:54 +0200 (EET) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.12.6/8.12.6/Submit) id gBMJfqiO040197; Sun, 22 Dec 2002 21:41:52 +0200 (EET) Date: Sun, 22 Dec 2002 21:41:52 +0200 From: Ruslan Ermilov To: Garrett Wollman , Julian Elischer , ume@freebsd.org Cc: net@freebsd.org Subject: Re: Broken logic in rtrequest1(RTM_DELETE, ..., ret_nrt) Message-ID: <20021222194152.GA40093@sunbay.com> References: <20021222193329.GA37916@sunbay.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="s/l3CgOIzMHHjg/5" Content-Disposition: inline In-Reply-To: <20021222193329.GA37916@sunbay.com> User-Agent: Mutt/1.5.1i Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org --s/l3CgOIzMHHjg/5 Content-Type: multipart/mixed; boundary="2fHTh5uZTiUOsy+g" Content-Disposition: inline --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Dec 22, 2002 at 09:33:29PM +0200, Ruslan Ermilov wrote: > Hi! >=20 > The attached patch fixes the logic of rtrequest1() > when handling RTM_DELETE requests and the caller > asked for a copy of the removed entry. >=20 > Reviewers are highly welcome. >=20 > This makes the code more natural, similar to the > RTM_ADD and RTM_RESOLVE cases (wrt to handling > the returned rtentry's refcnt), and reduces some > code bloat in applications. >=20 > It also makes it safe to turn the RTF_UP bit before > rt_fixdelete() walk -- that was the start of my > looking at this part of code. >=20 Oops, missed one. Cheers, --=20 Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --2fHTh5uZTiUOsy+g Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Index: route.c =================================================================== RCS file: /home/ncvs/src/sys/net/route.c,v retrieving revision 1.72 diff -u -p -r1.72 route.c --- route.c 18 Dec 2002 11:45:27 -0000 1.72 +++ route.c 22 Dec 2002 19:39:54 -0000 @@ -1117,10 +1112,7 @@ rtinit(ifa, cmd, flags) * If we are deleting, and we found an entry, then * it's been removed from the tree.. now throw it away. */ - if (rt->rt_refcnt <= 0) { - rt->rt_refcnt++; /* make a 1->0 transition */ - rtfree(rt); - } + RTFREE(rt); } else if (cmd == RTM_ADD) { /* * We just wanted to add it.. we don't actually --2fHTh5uZTiUOsy+g-- --s/l3CgOIzMHHjg/5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+BhWAUkv4P6juNwoRAg6KAJ9SbGtshhHYaQwreyhPtcwTn2AfcgCfUqLj BIcjKB1bjbAZpE1ft9ls4/k= =sUVB -----END PGP SIGNATURE----- --s/l3CgOIzMHHjg/5-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message